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.

身份验证

AuthorizationBearer

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

请求头

Idempotency-Keystring必需1-128 characters

请求

This endpoint expects an object.
max_duration_secondsenum必需
Required maximum live session duration in seconds. The USD amount is reserved for the selected 15, 60, or 300 second tier.
允许的值:
allowed_originslist of strings必需

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

metadatamap from strings to strings可选

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.

响应

Realtime session created
dataobject

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

错误

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