# Create an event stream

`POST https://api.cademi.com.br/api/v3/event-streams`

Operation ID: `event_streams.create` · API v3

Creates an event stream that delivers the account's public events over Server-Sent Events (SSE), with the same payloads and ordering as the events collection. Optional filters restrict the stream to specific event types and resource types.

Requires an `Idempotency-Key` header. The credential must also have the `events.read` permission; otherwise the request fails with `permission_denied`.

The number of active event streams is limited per credential and per account. Creating a stream beyond these limits returns `too_many_streams`.

Required permissions: `event_streams.manage`.

## Request body

Content type: `application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `expires_in_hours` | integer | no |  |
| `filters` | object | no |  |

## Responses

### 201

Returns the newly created event stream.

Body: `data`: EventStream.

Fields of EventStream:

| Field | Type | Required | Description |
|---|---|---|---|
| `connection` | object | yes |  |
| `created_at` | string (date-time) | yes |  |
| `cursor` | object | yes |  |
| `expires_at` | string (date-time) | yes |  |
| `filters` | object | yes | Filters applied to the stream, with optional eventtypes and resourcetypes arrays of strings. An empty object means no filtering. |
| `id` | string | yes |  |
| `last_seen_at` | string or null (date-time) | yes |  |
| `object` | string, one of `event_stream` | yes |  |
| `status` | string, one of `active`, `revoked`, `expired` | yes |  |

### 401

The credential is missing, malformed, expired, or revoked.

Body: Error.

### 403

The current credentials do not have the permission required by this operation.

Body: Error.

### 422

The request body is invalid or the Idempotency-Key header is missing.

Body: Error.

### 429

The maximum number of active event streams has been reached.

Body: Error.

Full schema: https://cademi.dev/openapi/v3.json
