# Update event

`PATCH /v1/events/{id}`

Changes the types the data of an event has to carry, or clears them.

Needs the scope: `events:write`

## Path parameters

- `id` (string, required): The id or the name of the event. Up to 120 characters.

## Body parameters

- `schema` (Record<string, string> | null, required): The type of each value its data has to carry, by name, or `null` to take any data.

## Returns

- `object` ("event"): Always `event`.
- `id` (string): The id of the event.
- `name` (string): The name of the event, such as `order.paid`.
- `schema` (Record<string, string> | null): The type of each value its data has to carry: `string`, `number`, `boolean` or `date`. `null` takes any data.
- `received` (integer): How many times it has been sent.
- `lastReceivedAt` (string | null): When it was last sent, or `null`.
- `createdAt` (string): When the event was first defined or sent.

## Example

cURL:

```bash
curl -X PATCH "$OPENSEND_API_URL/v1/events/order.paid" \
  -H "Authorization: Bearer $OPENSEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "schema": {
    "total": "number"
  }
}'
```

TypeScript:

```ts
await opensend.events.update('order.paid', {
  schema: {
    total: 'number',
  },
})
```

CLI:

```bash
opensend events update order.paid --schema '{"total":"number"}'
```

MCP:

```json
{
  "name": "events_update",
  "arguments": {
    "id": "order.paid",
    "schema": {
      "total": "number"
    }
  }
}
```

Answer:

```json
{
  "object": "event",
  "id": "evt_order.paid",
  "name": "order.paid",
  "schema": {
    "total": "number"
  },
  "received": 5310,
  "lastReceivedAt": "2026-11-27T09:22:00.000Z",
  "createdAt": "2026-09-08T09:30:00.000Z"
}
```
