curl -sSN "$BMA_BASE_URL/v1/sessions/ses_agray4o575ytrcguudsrm73sbq/events/stream" \
-H "x-api-key: $BMA_API_KEY" \
-H "bma-workspace-id: $BMA_PROJECT_ID" \
-H "accept: text/event-stream"{
"id": "<string>",
"content": [
{
"text": "<string>",
"type": "text"
}
],
"type": "user.message",
"processed_at": "<string>"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}Stream Events
Opens a Server-Sent Events stream of a session’s events. Without a Last-Event-ID header the stream starts at the current end of the log and delivers only what happens after it opens; with Last-Event-ID set to the SSE id of a received event it resumes right after that event, and a numeric value resumes after that bma_sequence (an ID that is no event of the session is refused with 400). Each frame is event: <type>, id: <event id> and data: <event JSON>; session.updated frames carry no id. The stream opens with a : ok comment and sends a : keepalive comment while idle. With event_deltas it also sends best-effort event_start and event_delta previews, which have no id and are never stored. BMA’s own extension event types are not streamed. If delivery fails after the stream opened, a final event: error frame ends it; reconnect with Last-Event-ID. The stream stays open until the client disconnects, also after the session is archived.
Authorization: Organization API key (x-api-key: bma_org_v1_…), personal access token (Authorization: Bearer bma_pat_v1_…), OAuth access token or signed-in dashboard session; a user credential names its organization with bma-organization-id. The request acts in one workspace: the one named by bma-workspace-id (or anthropic-workspace-id; when both are sent they must agree), else the credential’s default workspace (an API key’s own workspace, else its organization’s Default workspace), else the only workspace the credential can use. Every workspace role may call it (viewer included); organization owners and admins act as workspace admins in every workspace of their organization.
Limits:
- Keepalive: a
: keepalivecomment after 15 seconds without a frame. - At most 200 events are read from the log at a time; a backlog is sent in batches without waiting.
- Rate limit: one request of the organization’s read budget (Rate limits).
Errors (besides the common errors (401 authentication, 429 rate_limited, 500)):
| Status | error.type | error.code | Cause | Fix |
|---|---|---|---|---|
| 400 | invalid_request_error | invalid_event_deltas | event_deltas names a type other than agent.message and agent.thinking. | Correct the request as the message describes and send it again; the same request will keep failing. |
| 400 | invalid_request_error | organization_required | A user credential (personal access token, OAuth token, dashboard session) names no organization. | Name the organization with the bma-organization-id header. |
| 400 | invalid_request_error | project_required | The credential can use several workspaces and the request names none. | Name the workspace with the bma-workspace-id header. |
| 400 | invalid_request_error | workspace_id_conflict | bma-workspace-id and anthropic-workspace-id name different workspaces. | Correct the request as the message describes and send it again; the same request will keep failing. |
curl -sSN "$BMA_BASE_URL/v1/sessions/ses_agray4o575ytrcguudsrm73sbq/events/stream" \
-H "x-api-key: $BMA_API_KEY" \
-H "bma-workspace-id: $BMA_PROJECT_ID" \
-H "accept: text/event-stream"{
"id": "<string>",
"content": [
{
"text": "<string>",
"type": "text"
}
],
"type": "user.message",
"processed_at": "<string>"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"bma_error_code": "<string>"
},
"request_id": "<string>"
}Path Parameters
Query Parameters
Also send best-effort previews of these event types while they are produced: agent.message sends an event_start and then event_delta text fragments, agent.thinking only an event_start. Repeat the parameter or separate values with commas. Previews carry no SSE id, are not stored, and stop once the final event was delivered. Any other value is refused with 400 invalid_event_deltas.
An event type a stream can preview with event_deltas.
agent.message, agent.thinking Response
Success.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
- Option 15
- Option 16
- Option 17
- Option 18
- Option 19
- Option 20
- Option 21
- Option 22
- Option 23
- Option 24
- Option 25
- Option 26
- Option 27
- Option 28
- Option 29
- Option 30
- Option 31
- Option 32
- Option 33
- Option 34
- Option 35
- Option 36
- Option 37
- Option 38
- Option 39
- Option 40
- Option 41
- Option 42
- Option 43
- Option 44
- Option 45
Server-sent event in the session stream.