POST /v1/call/session-token

Issue a short-lived call session token for a client participant.

POST /v1/call/session-token

Issues a short-lived session token that a client can use to connect to the WebSocket signaling endpoint.

Description

The application backend calls this endpoint after it has authenticated the user and confirmed that the call is allowed.

Headers

HeaderRequiredDescription
Content-Type: application/jsonYesRequest body format.
X-BCS-Product-Key-IDYesProduct key ID issued by Blendlix.
X-BCS-Product-SecretYesProduct secret issued by Blendlix.

Request body

FieldTypeRequiredDescription
productstringOptional when product auth maps the key to one productProduct namespace.
context_typestringYesApplication-defined context type.
context_idstringYesApplication-defined context ID.
user_idstringYesParticipant ID from the application.
rolestringYesParticipant role in the application.
display_namestringYesName shown in call UI.
device_idstringNoClient device ID.
app_versionstringNoClient application version.
allowed_peer_rolestringYesReceiver role this participant may call.
{
  "product": "example_application",
  "context_type": "session",
  "context_id": "SESSION-1001",
  "user_id": "caller-123",
  "role": "caller",
  "display_name": "Caller One",
  "device_id": "web-01",
  "app_version": "1.0.0",
  "allowed_peer_role": "receiver"
}

Success response

{
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "expires_at": "2026-07-04T12:00:00Z",
  "ws_url": "wss://rtc-svc.blendlix.com/v1/ws",
  "ice_servers": [
    {
      "urls": ["stun:turn-rtc-svc.blendlix.com:3478"]
    },
    {
      "urls": ["turn:turn-rtc-svc.blendlix.com:3478?transport=udp"],
      "username": "temporary_or_configured_username",
      "credential": "temporary_or_configured_credential"
    }
  ],
  "user": {
    "user_id": "caller-123",
    "role": "caller",
    "display_name": "Caller One"
  },
  "allowed_actions": [
    "call.invite",
    "call.accept",
    "call.reject",
    "call.cancel",
    "call.end",
    "call.connected",
    "webrtc.offer",
    "webrtc.answer",
    "webrtc.ice_candidate"
  ]
}

Error responses

StatusCodeMeaning
400INVALID_REQUEST_BODYRequest body is missing or invalid.
400PRODUCT_REQUIREDProduct is required.
400CONTEXT_TYPE_REQUIREDcontext_type is required.
400CONTEXT_ID_REQUIREDcontext_id is required.
400ROLE_REQUIREDrole is required.
400USER_ID_REQUIREDuser_id is required.
400DISPLAY_NAME_REQUIREDdisplay_name is required.
400ALLOWED_PEER_ROLE_REQUIREDallowed_peer_role is required.
401PRODUCT_AUTH_KEY_ID_REQUIREDProduct key ID header is missing.
401PRODUCT_AUTH_SECRET_REQUIREDProduct secret header is missing.
401PRODUCT_AUTH_INVALID_KEYProduct key ID is unknown or disabled.
401PRODUCT_AUTH_INVALID_SECRETProduct secret is incorrect.
403PRODUCT_AUTH_PRODUCT_MISMATCHProduct in the request does not match the authenticated key.
429BOOTSTRAP_IP_RATE_LIMITEDToo many token requests from the same IP.
429BOOTSTRAP_KEY_RATE_LIMITEDToo many token requests for the same product key.

Example

curl -X POST https://rtc-svc.blendlix.com/v1/call/session-token \
  -H "Content-Type: application/json" \
  -H "X-BCS-Product-Key-ID: your_key_id" \
  -H "X-BCS-Product-Secret: your_secret" \
  -d '{
    "product": "example_application",
    "context_type": "session",
    "context_id": "SESSION-1001",
    "user_id": "caller-123",
    "role": "caller",
    "display_name": "Caller One",
    "allowed_peer_role": "receiver"
  }'