Get the address and capability to subscribe to a stream's events
Code Mode: praxis.media.streams.subscribeToken.create
HTTP: POST /media/v1/streams/{stream_id}/subscribe-token
Mint a subscribe capability for the stream’s event socket: a WebSocket that sends every event after a sequence number, then each new event as it is written. Use it for live delivery to an app or a dashboard; to read the log in pages without holding a socket use streams.events.list, and to receive events at your server use a webhook element of a pipeline. The response carries {url, token, expires_at}: open the url as a WebSocket and append &after=<seq> with the highest seq you have already seen (omit it, or use 0, to read from the start). A subscriber that was away comes back with its last seq and is sent every event it missed, then the live ones; the same event can arrive again, so de-duplicate on the event id. The token opens the socket and nothing else, is valid for one hour, may be held by any number of subscribers at once and is shown only in this response; mint a new one to reconnect after it expires. Example: POST /media/v1/streams/mst_zpnqd7a2kxwg3vhr5tj4bfm6ec/subscribe-token with no body.
Signature
praxis.media.streams.subscribeToken.create(args:{path:{/** e.g. "mst_zpnqd7a2kxwg3vhr5tj4bfm6ec" */ stream_id:string}}):Promise<{/** Always media.stream.subscription. e.g. "media.stream.subscription" */ object:"media.stream.subscription";/** The WebSocket address of the stream's event socket with the token in it; append &after=<seq> to start after the highest seq you have already seen, omit it to re e.g. "wss://realtime.deepraxis.com/v1/media-streams/mst_zpnqd7a2kxwg3vhr5tj4bfm6ec/subscribe?token=Qm9v" */ url:string;/** The subscribe capability, the same value that is in url; it opens the event socket of this stream and nothing else. e.g. "Qm9vdC1jYXAtdG9rZW4tZXhhbXBsZS0wMDAwMDAwMDAwMDA" */ token:string;/** When the capability stops opening the socket, RFC 3339 UTC, one hour after it was minted; a socket that is already open keeps running. e.g. "2026-11-28T13:00:00.000Z" */ expires_at:string}>;Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| stream_id | path | string | yes | The stream’s id, the id field returned by streams.create or streams.list (mst_ followed by 26 lowercase base32 characters); a stream of another organization answers 404. |
Responses
| Status | Content types | Description |
|---|---|---|
| 200 | application/json | The socket address and its capability. |
| 401 | application/json | The request carries no valid API key or session. Send a key of your organization. |
| 404 | application/json | No stream with this id in your organization, or Media Streams is not released for it. List your streams to find the id. |
| 503 | application/json | Subscribing is not available in this environment; retry later. |