WebSocket events
Planned Not deployed.
| URL | links.events from the receipt or snapshot, wss://…/v1/documents/{document_id}/events |
| Protocol | JSON text frames over WSS |
| Authentication | A single-use ticket from POST /documents/{document_id}/event-tickets (scope documents:read), sent in the first frame. No API key on the connection. |
See live events over WebSocket for the full flow.
Client frame
Section titled “Client frame”Send exactly one subscribe frame, within five seconds of connecting and no larger than 16 KiB. after_sequence is the last sequence you have applied; 0 replays all retained events.
{ "type": "subscribe", "ticket": "example-ticket", "after_sequence": 4}Server frames
Section titled “Server frames”type |
When |
|---|---|
ready |
The ticket was accepted; replay follows. Contains document_id. |
event |
One committed event, in sequence order. Same schema as HTTP event history. |
resync_required |
The cursor is outside the retained history or ahead of the document. Contains status_url. The server then closes with 1000. |
{ "type": "event", "document_id": "a~d17", "sequence": 5, "occurred_at": "2026-11-30T20:00:05Z", "reason": "chunk_succeeded", "range": { "first_page": 1, "last_page": 2 }, "attempt": 1}Event reasons
Section titled “Event reasons”Every event has type, document_id, sequence, occurred_at, reason and range. range is the chunk’s page range for chunk events and null for document-wide events. Some reasons require more fields:
reason | Also required | Meaning |
|---|---|---|
accepted | The upload was stored durably and processing was scheduled. | |
planning_started | attempt | An attempt to count pages and plan chunks started. |
planned | The chunk plan was committed; the snapshot now has a plan. | |
chunk_claimed | attempt, range (not null) | A processing attempt started on a chunk. |
chunk_requeued | attempt, range (not null), code | A chunk attempt ended with a retryable error and the chunk was queued again. code gives a client-safe reason. |
chunk_succeeded | attempt, range (not null) | A chunk’s page results were committed. |
combining | All chunks succeeded; combining was scheduled. | |
combine_started | attempt | An attempt to assemble the page results started. |
export_started | attempt, format | Writing one output format started. |
export_finished | attempt, format | One output format was written. |
succeeded | All outputs were published. Terminal. | |
failed | failure | Processing stopped; failure explains why. Terminal. |
webhook_attempt_started | delivery_id, attempt | A webhook delivery attempt started. |
webhook_attempt_finished | delivery_id, attempt, delivery_state, outcome, http_status | A webhook delivery attempt finished with an outcome and, unless it was a transport error, an HTTP status. |
Close codes
Section titled “Close codes”| Code | Meaning |
|---|---|
1000 |
Normal close, including after resync_required |
1008 |
Expired, reused, revoked or wrong-document ticket; missing, late or invalid subscription; access revoked; document deleted |
1013 |
Slow consumer: more than 1 MiB queued. Reconnect with a new ticket. |