Realtime API

Create a short-lived Realtime API browser session and receive a client secret for the BeatAPI realtime SDK. Create the Session on your trusted server, pass only `client_secret` to the browser, connect with `@beatapi/realtime`, and close the Session when the experience ends. See the [Quick Guide](/quick-guide) for the security and lifecycle checklist.

Authentication

AuthorizationBearer

Send your API key as Authorization: Bearer <BEATAPI_API_KEY>.

Headers

Idempotency-KeystringRequired1-128 characters

Request

This endpoint expects an object.
max_duration_secondsenumRequired
Required maximum live session duration in seconds. The USD amount is reserved for the selected 15, 60, or 300 second tier.
Allowed values:
allowed_originslist of stringsRequired

Exact browser origins allowed to use the short-lived session secret.

metadatamap from strings to stringsOptional

Optional server-defined string metadata for your own correlation. Up to 20 keys; keys are at most 64 characters and values at most 256 characters.

Response

Realtime session created
dataobject

Created Realtime Session including the one-time short-lived browser credential.

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
409
Conflict Error
429
Too Many Requests Error
503
Service Unavailable Error