Stream the Organization events
GET /v1/events/stream
| Property | Value |
|---|---|
| Operation | stream_events |
| Group | Events |
| Scope | events:read |
| Route class | read |
| Idempotency | No Idempotency-Key |
| Audit | Not audited: Vocal's types carry identifiers, status, codes and instants only (ADR 0051 rule 4); from 1.62.0 a custom event carries the customer's own data, which travels empty in PHI mode. |
| Released in | 1.52.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Answers text/event-stream: every record event of the credential's environment as it is relayed, at least once, each an EventStreamMessage whose SSE id is the event id. types, families and filter_id select as on the log. Resume with Last-Event-ID or after (the header wins), or start from since, within 72 hours (a target); an older resume point is sent one resume_gap first, and the client pages GET /v1/events. since beside either resume point is invalid_request. Up to three connections per credential (a target); a fourth answers 429 stream_limit_reached. A keepalive comment line every 15 seconds (a target).
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the events:read scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -N "$VOCAL_API/v1/events/stream" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Accept: text/event-stream"const response = await fetch(`${process.env.VOCAL_API}/v1/events/stream`, {
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
Accept: 'text/event-stream',
},
});
console.log(response.status);
for await (const chunk of response.body) {
process.stdout.write(chunk);
}import os
import requests
response = requests.get(
f"{os.environ['VOCAL_API']}/v1/events/stream",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Accept": "text/event-stream",
},
stream=True,
)
print(response.status_code)
for line in response.iter_lines(decode_unicode=True):
print(line)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
types | query | array of EventTypeName | no | Only these types, comma-separated; OR with families. Trace types reach the log and the stream only inside call.trace.ready, so naming one selects nothing. |
families | query | array of EventFamily | no | Only the types of these families, comma-separated. |
filter_id | query | EventFilterId | no | Narrow the selection with this event filter; a filter that is not the Organization's answers not_found. |
after | query | EventId | no | Resume after this event, as Last-Event-ID does; the header wins when both are sent. |
since | query | RequestTimestamp | no | Start from the first event created at or after this instant, within 72 hours (a target); refused beside after or Last-Event-ID. |
accept | header | string | yes | Must accept text/event-stream. |
last-event-id | header | EventId | no | The id of the last event the client received, which an SSE client sends itself. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | text/event-stream | string: A text/event-stream body: lines id:, event: and data: per message and a blank line between messages, each message an EventStreamMessage, with comment lines (:) as keepalives. | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden |
404 | application/json | ErrorEnvelope | not_found |
429 | application/json | ErrorEnvelope | stream_limit_reached, rate_limited |
500 | application/json | ErrorEnvelope | internal_error |