Skip to content

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.

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.

api/specs/examples/subscribe.json (contract fixture)
{
"type": "subscribe",
"ticket": "example-ticket",
"after_sequence": 4
}
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.
api/specs/examples/event.json (contract fixture)
{
"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
}

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:

reasonAlso requiredMeaning
acceptedThe upload was stored durably and processing was scheduled.
planning_startedattemptAn attempt to count pages and plan chunks started.
plannedThe chunk plan was committed; the snapshot now has a plan.
chunk_claimedattempt, range (not null)A processing attempt started on a chunk.
chunk_requeuedattempt, range (not null), codeA chunk attempt ended with a retryable error and the chunk was queued again. code gives a client-safe reason.
chunk_succeededattempt, range (not null)A chunk’s page results were committed.
combiningAll chunks succeeded; combining was scheduled.
combine_startedattemptAn attempt to assemble the page results started.
export_startedattempt, formatWriting one output format started.
export_finishedattempt, formatOne output format was written.
succeededAll outputs were published. Terminal.
failedfailureProcessing stopped; failure explains why. Terminal.
webhook_attempt_starteddelivery_id, attemptA webhook delivery attempt started.
webhook_attempt_finisheddelivery_id, attempt, delivery_state, outcome, http_statusA webhook delivery attempt finished with an outcome and, unless it was a transport error, an HTTP status.
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.