| Use case | Auth method |
|---|---|
REST endpoints like /upload, /status/{document_id}, /documents, /credits, and /ws/token | capout-api-key request header |
Realtime subscriptions over /ws/status and /sse/status | token query parameter returned by POST /ws/token |
API key header
Send your organization-scoped API key in thecapout-api-key header on REST calls.
Realtime tokens
Realtime connections do not use the API key directly. Instead:- Call
POST /ws/tokenwith your API key. - Read
token,ws_url,sse_url, andexpires_at. - Connect with
?token=<token>in the query string.
EventSource.
Token-based stream URLs
Specific documents:Expiration strategy
Treat realtime tokens as short-lived connection credentials:- Mint them just before opening a stream.
- Re-mint on reconnect if the token has expired.
- Keep API keys on trusted backend infrastructure when possible.