Перейти к содержимому

Streams

A stream is a screen share on a member’s existing voice connection. These routes record a region preference and manage the stream’s JPEG preview image. A bot token or an OAuth2 bearer token gets 403 ACCESS_DENIED on every route here.

A stream key identifies one stream and has the form {guild_id}:{channel_id}:{connection_id}, or dm:{channel_id}:{connection_id} in a direct message or group direct message. A key that isn’t three colon-separated segments of 1-256 characters each returns 400 INVALID_STREAM_KEY_FORMAT.

FieldTypeDescription
scopestringdm for a private call, or the guild ID for a guild voice channel
channel_idstringThe ID of the voice channel or private channel the stream runs in
connection_idstringThe connection_id of the publisher’s voice connection

A scope that isn’t the channel’s guild ID, or dm for a direct message or group direct message, returns 400 STREAM_KEY_SCOPE_MISMATCH. Any other channel type returns 400 INVALID_CHANNEL_TYPE. Upload stream preview and Create stream preview upload URL also take a channel_id in the body, and one that doesn’t equal the key’s channel segment returns 400 STREAM_KEY_CHANNEL_MISMATCH.

AccessRequirements
ReadAccess to the channel as in Get channel, plus CONNECT in a guild
MutationRead access, plus STREAM in a guild and your own voice state in the channel with the key’s connection_id

A caller without CONNECT or STREAM gets 403 MISSING_PERMISSIONS. A caller without that voice state gets 403 ACCESS_DENIED.

A signed URL you can PUT stream preview JPEGs to until it expires.

FieldTypeDescription
upload_urlstringThe URL to PUT the preview JPEG to, sent exactly as returned
methodstringAlways PUT
content_typestringThe media type to send with the upload
expires_atISO8601 timestampThe time the URL expires
expires_inintegerThe lifetime of the URL in seconds
max_bytesintegerThe maximum accepted size, always 1000000
{
"upload_url": "https://cdn.example.com/stream-previews/1501314428688998182?t=fabricated-token",
"method": "PUT",
"content_type": "image/jpeg",
"expires_at": "2026-08-31T12:00:00.000Z",
"expires_in": 86400,
"max_bytes": 1000000
}
PATCH /v1/streams/{stream_key}/stream

Records the preferred media region for a stream. You need mutation access.

FieldTypeDescription
region?stringThe id of an RTC region (1-64 characters), or omit it to clear the preference
StatusBodyCondition
204emptyThe preference was recorded

The rate limit is 20 requests per 10 seconds, on the channel:stream:update::stream_key bucket.

GET /v1/streams/{stream_key}/preview

Returns the stored preview image with Cache-Control: no-store, private. You need read access to the stream.

StatusBodyCondition
200preview bytesA preview is stored
404emptyNo preview is stored, or it expired after one day

The channel:stream:preview:get::stream_key bucket allows 60 requests per 10 seconds.

POST /v1/streams/{stream_key}/preview

Replaces the preview with a JPEG sent as base64. You need mutation access. To send the bytes with a separate request, use Create stream preview upload URL.

FieldTypeDescription
channel_idsnowflakeThe ID of the channel the stream is active in
thumbnailbase64 stringThe canonical base64 JPEG (1-2000000 characters)
content_type?stringThe declared media type (1-64 characters)

The API treats the image as a JPEG when content_type contains jpeg or jpg, or when the bytes are a JPEG.

StatusBodyCondition
204emptyThe preview was accepted
400error responseINVALID_STREAM_THUMBNAIL_PAYLOAD when the payload isn’t canonical base64
400error responsePREVIEW_MUST_BE_JPEG when the payload isn’t a JPEG
400error responseFILE_SIZE_TOO_LARGE when the JPEG exceeds 1000000 bytes

The channel:stream:preview:post::stream_key bucket allows 20 requests per 10 seconds.

POST /v1/streams/{stream_key}/preview/upload-url

Returns a stream preview upload object. You need mutation access. PUT the JPEG to upload_url with the returned content_type, and each PUT replaces the preview until the URL expires.

FieldTypeDescription
channel_idsnowflakeThe ID of the channel the stream is active in
content_type?stringThe declared media type, which must contain jpeg or jpg (1-64 characters, default image/jpeg)
StatusBodyCondition
200stream preview upload objectThe upload URL was issued
400error responsePREVIEW_MUST_BE_JPEG when the media type isn’t JPEG

The channel:stream:preview:upload_url::stream_key bucket allows 20 requests per 10 seconds.

DELETE /v1/streams/{stream_key}/preview

Deletes the stored preview. You need mutation access.

StatusBodyCondition
204emptyThe preview was deleted or none was stored

The channel:stream:preview:delete::stream_key bucket allows 20 requests per 10 seconds.