API referenceConversations

Create an audio session

POST
/conversations/{id}/audio-sessions

Grants a WebSocket that streams one source of the conversation's audio, local for the microphone or remote for everyone else, to be transcribed into its turns. Hand url to the browser that captures the audio: it opens the socket once, within a minute, with no API key. One socket streams each source at a time. No audio is stored.

Each stream's audio counts toward the month's transcription minutes, so a microphone and a tab count twice. Once the plan's allowance for the key's environment is used, a new session is refused with limit.transcription_minutes or limit.test_transcription_minutes; a socket already streaming runs on.

Authorization

apiKey
X-API-Key<token>

API key (prefix spk_test_ or spk_live_) or personal access token (prefix pat_)

In: header

Path Parameters

id*string

Conversation ID

Header Parameters

Idempotency-Key*string

Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request.

Lengthlength <= 255

Request Body

application/json

encoding*"linear16"

How the binary frames encode audio: linear16 is raw 16-bit little-endian PCM, mono

Value in

  • "linear16"
language?string

The language spoken, a language code such as en or pt-BR, or multi to detect it; en when left out

sample_rate*integer

The audio's samples per second

Formatint64

Value in

  • 16000
  • 24000
  • 44100
  • 48000
source*string

local for the capturing person's microphone, remote for everyone else

Value in

  • "local"
  • "remote"

Response Body

application/json

application/json

curl -X POST "https://example.com/conversations/cnv_2jxsy8cc8v0348asy6t1/audio-sessions" \  -H "Idempotency-Key: string" \  -H "Content-Type: application/json" \  -d '{    "encoding": "linear16",    "sample_rate": 16000,    "source": "local"  }'
{  "expires_at": "2019-08-24T14:15:22Z",  "token": "string",  "url": "string"}