Sessions v2

Create a session

Changed on

Creates a session and returns its token. The token is returned here and in GET /v2/sessions/{id}. List responses do not include it.

Repeating the call with the same client_reference_id creates an independent session. Each session has its own id, token and lifetime.

post/session-storage/v2/sessions

Request

  • Base URL
    https://api.palabra.ai
  • URL
    https://api.palabra.ai/session-storage/v2/sessions
  • Auth
    API key in header Authorization

Request body

intent's2s' | 'stt' | 'tts' required

Product the session token is valid for:

  • s2s: speech-to-speech translation
  • stt: speech-to-text
  • tts: text-to-speech

A token presented to a different product is refused.

connection_type'ws' | 'webrtc'

Transport the end user will connect with. webrtc is available for s2s only. A token issued for one transport cannot be used with the other.

expires_in_secondsinteger

Connect window: how long after creation the token can open a new stream. Streams already running are not affected when the window closes. To extend, issue a new session.

max_session_duration_secondsinteger

Maximum duration of any single stream opened with this token, counted from that stream's own start. The stream is closed when it is reached. When omitted, streams are limited only by your account limits.

single_useboolean

true: the token opens exactly one stream in its lifetime. A second connection while that stream is running is refused, usually with HTTP 409 session_in_use. After the stream ends, every connection is refused with HTTP 409 session_already_used. In both cases the application must request a new session; connecting again with the same token does not help. false: the token can open several streams, one after another, until the connect window closes. One connection is live at a time. Over ws a second connection while the first one is live is refused with HTTP 409 session_in_use; connect again after the first one ends. Over webrtc a new connection replaces the previous one. The live stream counts toward your concurrent session limit.

client_reference_idstring

Your own identifier for the customer, device or order this session belongs to. Stored as is, not unique, and used to filter sessions and usage. Set it from your server; end users cannot change it.

subscriber_countinteger

Number of listener tokens to issue alongside the publisher token. Available for s2s over webrtc only. Listener tokens can join the room and receive the translation but cannot publish audio or change the translation task. Listeners do not count toward your concurrent session limit.

Response

Session created.

oktrue required

Example response

{
  "data": {
    "id": "ses_01K64W6F7C8MD2VP7ZQ9J3B5NR"
  }
}

Changes