Developer platform · v2

API reference

View as MarkdownAll docs

Voice sessions

10 operations · all resources

What this covers#

One session is one call. Create it to get a single-use WebSocket URL for browser audio, or dial out on your own carrier line. Billing is settled from connected seconds when the session ends.

Every example below runs as written once these are exported:

bash
export DVAARIK_API_KEY="dvk_..."        # project API key, server side only
export DVAARIK_TOKEN="<account access token>"   # console session, from POST /console/auth/login
export PROJECT_ID="<uuid>"
export SESSION_ID="<uuid>"

A <value> inside a JSON body is a value you supply. Responses are JSON; every error body is { "detail": … }. Each schema is expanded once per page, where it first appears.

Machine door errors#

Raised by the project-key dependency before any handler on this page runs.

StatusCause
401Missing API key or Invalid API key — the X-Api-Key header is absent, unknown, or revoked.
403API key is not scoped to a project, Project unavailable, or API key is missing the required scope '<scope>'.
429The project's api_rpm ceiling was exceeded. Honour Retry-After; X-RateLimit-* headers are on every response.

Scopes used on this page: voice:read, voice:write. Mint a key with only these.

Account door errors#

StatusCause
401No account session was presented, or it is invalid or expired. Refresh once, then re-authenticate.
403The account is suspended or its email is not verified.

Operations — project API key#

Call these from your own server with a project key. Never from a browser or a mobile bundle.

GET /v2/voice/sessions#

List sessions newest first, filtered by status, agent or date range.

DetailValue
DoorProject API key — X-Api-Key: $DVAARIK_API_KEY
Scopevoice:read
Operationlist_voice_sessions_v2_voice_sessions_get
Success200 VoiceSessionInfo[]
ParameterInTypeRequiredNotes
limitqueryintegerno
offsetqueryintegerno
statusquerystring or nullno
agent_idqueryuuid or nullno
fromquerydate-time or nullno
toquerydate-time or nullno
has_insightsqueryboolean or nullnotrue for sessions whose post-call analysis produced a result; false for every other session.

VoiceSessionInfo#

FieldTypeRequiredNotes
agent_iduuid or nullyes
agent_versioninteger or nullyes
connected_secondsintegeryes
cost_minorstringyes
cost_nano_usdstring or nullyes
created_atdate-timeyes
currencystringyes
directionstringyes
end_reasonstring or nullyes
ended_atdate-time or nullyes
handoffsCallHandoffsInfo or nullno
hold_minorstringyes
hold_nano_usdstring or nullyes
iduuidyes
insightsCallInsightsInfo or nullno
languagestringyes
max_duration_secondsintegeryes
media_connected_atdate-time or nullyes
media_disconnected_atdate-time or nullyes
metadataobject or nullyes
money_scaleintegeryes
pipeline_modestringyes
pipeline_snapshotobjectyes
project_iduuidyes
project_revisionintegeryes
rate_nano_usd_per_minstring or nullyes
rate_per_minute_minorstringyes
rate_versionstringyes
recordbooleanyes
recording_refobject or nullnoWhere this call's audio is, or null when there is none. The audio lives in your own carrier account and is fetched with your own carrier credentials, not ours — Dvaarik does not store call recordings. The block is {provider, reference_id, url, fetched_from}: fetched_from is "carrier" when your carrier holds the recording (a null reference_id there means the carrier accepted the request and will name the recording on its own webhook), and "unavailable" with a detail sentence when the carrier could not be asked at all. Browser and bring-your-own-socket sessions have no carrier, so they have no recording and this is always null for them — there is no fallback, because a fallback would mean us storing the audio again.
retention_notestring or nullno
sample_rate_inintegeryes
sample_rate_outintegeryes
started_atdate-time or nullyes
statusstringyes
store_transcriptbooleanyes
timingsCallTimingsInfo or nullno
zero_retentionbooleannodefault false

CallHandoffsInfo#

Who spoke when, on a call whose agent may hand it to another agent of the project (L15).

FieldTypeRequiredNotes
handoffsintegernodefault 0; Hand-offs made on this call (a return after one counts too).
refusedintegernodefault 0; Hand-offs the agents asked for that could not happen.
segmentsCallHandoffSegment[]noEach agent's part, in order.

CallInsightsInfo#

What one call's analysis produced, as the session read returns it. status is pending while the analysis is queued, so a developer polling a session can tell "it is coming" from "this agent does not do analysis" (in which case the whole object is absent, not a status of its own).

FieldTypeRequiredNotes
errorstring or nullnoOne short clause when status is failed. Never a provider response body and never a prompt.
fallback_usedbooleannodefault false; Whether the agent's fallback language model (pipeline_config.llm_fallback) answered any part of this call because its main model failed. The detail (from which turn, and why) is on the session read, timings.fallback.
fieldsobjectno
generated_atdate-time or nullno
modelstring or nullno
providerstring or nullno
statusstringyes
summarystring or nullno
transcript_truncatedbooleannodefault false

CallTimingsInfo#

How fast each part of the call answered (L12), from at most the first 50 replies. A part that never ran is absent, never 0. Speech-to-speech (realtime) sessions report no timings yet.

FieldTypeRequiredNotes
fallbackCallFallbackInfo or nullnoWhich language model answered (pipeline_config.llm_fallback). Null when the agent has no fallback.
greeting_msinteger or nullnoThe agent started on the call -> its first audio, in milliseconds.
llm_first_token_msCallTimingStage or nullnoEvery model request -> its first token (discarded guesses and tool follow-ups included).
reply_msCallTimingStage or nullnoThe caller's words were understood -> the first sound of the reply. A holding phrase such as 'One moment' counts as the first sound.
tts_first_audio_msCallTimingStage or nullnoEvery time the voice was asked to speak -> its first audio (greeting and holding phrases included).
turnsinteger or nullnoReplies measured (at most the first 50).

CallFallbackInfo#

Which language model answered (L14): present on every call of an agent with a fallback.

FieldTypeRequiredNotes
availablebooleannodefault true; False when the call could not use the fallback (its account, model or key was not usable, or its client failed to build): the call ran on the main model alone and reason says why.
failurestring or nullnoThe main model's failure class (e.g. credits_exhausted). Null on a timeout and when the fallback never answered.
from_turninteger or nullnoThe caller line the fallback first answered from (0 = the greeting). Null when it never answered.
main_failedboolean or nullnoTrue when the main model failed but the call ended before the fallback answered (its client was still being built, or the switch was waiting for a clean turn). Null otherwise.
modelstring or nullnoThe fallback model that answered. Null when it never answered.
reasonstring or nullnoWhen it answered: error or timeout (the main model failed before saying anything). When it was unavailable: a short code such as account_changed or credentials_unavailable. Null when the fallback stood by.
usedbooleanyesWhether the agent's fallback language model answered any part of the call.

CallTimingStage#

One part of the call: how many times it ran and how long it took, in whole milliseconds.

FieldTypeRequiredNotes
countintegeryes
maxintegeryes
p50integeryes
p95integeryes
ErrorWhen
422The request body or query is not valid. detail is an array of {loc, msg, type} and loc names the offending field.

Plus the machine-door errors above. Full list on the errors page.

bash
curl -sS -X GET "https://api.developers.dvaarik.com/v2/voice/sessions?limit=20" \
  -H "X-Api-Key: $DVAARIK_API_KEY"

POST /v2/voice/sessions#

Admit a media session and return a single-use ws_url valid for expires_in_seconds. Hand only that URL to the client that streams audio.

DetailValue
DoorProject API key — X-Api-Key: $DVAARIK_API_KEY
Scopevoice:write
Operationcreate_voice_session_v2_voice_sessions_post
Success201 CreateVoiceSessionResponse

Request body: CreateVoiceSessionRequest.

CreateVoiceSessionRequest#

FieldTypeRequiredNotes
agent_iduuidyes
max_duration_secondsinteger or nullno
metadataobject or nullno
recordboolean or nullno
sample_rate_inintegernodefault 16000
sample_rate_outintegernodefault 24000
store_transcriptboolean or nullno
variablesobject<string>no

CreateVoiceSessionResponse#

FieldTypeRequiredNotes
expires_in_secondsintegeryes
sessionVoiceSessionInfoyes
ws_urlstringyes
ErrorWhen
422The request body or query is not valid. detail is an array of {loc, msg, type} and loc names the offending field.

Plus the machine-door errors above. Full list on the errors page.

bash
curl -sS -X POST "https://api.developers.dvaarik.com/v2/voice/sessions" \
  -H "X-Api-Key: $DVAARIK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "<agent uuid>",
    "sample_rate_in": 16000,
    "sample_rate_out": 24000,
    "variables": {
      "company": "Northline Dental"
    }
  }'

GET /v2/voice/sessions/{session_id}#

Read one session with its frozen pipeline snapshot, connected seconds and settled cost.

DetailValue
DoorProject API key — X-Api-Key: $DVAARIK_API_KEY
Scopevoice:read
Operationget_voice_session_v2_voice_sessions__session_id__get
Success200 VoiceSessionInfo
ParameterInTypeRequiredNotes
session_idpathuuidyes
ErrorWhen
422The request body or query is not valid. detail is an array of {loc, msg, type} and loc names the offending field.

Plus the machine-door errors above. Full list on the errors page.

bash
curl -sS -X GET "https://api.developers.dvaarik.com/v2/voice/sessions/$SESSION_ID" \
  -H "X-Api-Key: $DVAARIK_API_KEY"

GET /v2/voice/sessions/{session_id}/transcript#

What was said in a session of this key's project, when its agent kept transcripts.

DetailValue
DoorProject API key — X-Api-Key: $DVAARIK_API_KEY
Operationget_voice_session_transcript_v2_voice_sessions__session_id__transcript_get
Success200 TranscriptInfo
ParameterInTypeRequiredNotes
session_idpathuuidyes

TranscriptInfo#

FieldTypeRequiredNotes
call_iduuidyes
created_atdate-timeyes
retained_untildate-timeyes
truncatedbooleanyes
turn_countintegeryes
turnsobject[]yes
ErrorWhen
422The request body or query is not valid. detail is an array of {loc, msg, type} and loc names the offending field.

Plus the machine-door errors above. Full list on the errors page.

bash
curl -sS -X GET "https://api.developers.dvaarik.com/v2/voice/sessions/$SESSION_ID/transcript" \
  -H "X-Api-Key: $DVAARIK_API_KEY"

POST /v2/voice/sessions/outbound#

Queue one outbound call from a number on your own verified carrier connection. Send an Idempotency-Key; a repeat returns the first call with duplicate: true.

DetailValue
DoorProject API key — X-Api-Key: $DVAARIK_API_KEY
Scopevoice:write
Operationcreate_outbound_voice_session_v2_voice_sessions_outbound_post
Success202 CreateOutboundVoiceSessionResponse
ParameterInTypeRequiredNotes
Idempotency-Keyheaderstring or nullno

Request body: CreateOutboundVoiceSessionRequest.

CreateOutboundVoiceSessionRequest#

One queued call through a project-owned carrier connection and agent.

FieldTypeRequiredNotes
agent_iduuidyes
fromstringyes
max_duration_secondsinteger or nullno
metadataobject or nullno
recordboolean or nullno
store_transcriptboolean or nullno
tostringyes
variablesobject<string>no

CreateOutboundVoiceSessionResponse#

FieldTypeRequiredNotes
duplicatebooleannodefault false
sessionVoiceSessionInfoyes
ErrorWhen
422The request body or query is not valid. detail is an array of {loc, msg, type} and loc names the offending field.

Plus the machine-door errors above. Full list on the errors page.

bash
curl -sS -X POST "https://api.developers.dvaarik.com/v2/voice/sessions/outbound" \
  -H "X-Api-Key: $DVAARIK_API_KEY" \
  -H "Idempotency-Key: <unique per call attempt>" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "<agent uuid>",
    "from": "+15550000001",
    "to": "+15550000002"
  }'

Operations — account session#

The same resource through the console door. These are what the web console calls; both doors return the same shapes.

GET /console/v2/projects/{project_id}/voice/sessions#

List sessions newest first, filtered by status, agent or date range.

DetailValue
DoorAccount session — Authorization: Bearer $DVAARIK_TOKEN
OperationconsoleListVoiceSessions
Success200 VoiceSessionInfo[]
ParameterInTypeRequiredNotes
project_idpathuuidyes
limitqueryintegerno
offsetqueryintegerno
statusquerystring or nullno
agent_idqueryuuid or nullno
fromquerydate-time or nullno
toquerydate-time or nullno
has_insightsqueryboolean or nullnotrue for sessions whose post-call analysis produced a result; false for every other session.
ErrorWhen
401No account session was presented, or it is invalid or expired.
403The account is suspended or its email is not verified.
404The project or the addressed resource does not exist for this owner. A resource owned by another developer is deliberately indistinguishable from one that never existed.
422The request body or query is not valid. detail is an array of {loc, msg, type} and loc names the offending field.

Plus the account-door errors above. Full list on the errors page.

bash
curl -sS -X GET "https://api.developers.dvaarik.com/console/v2/projects/$PROJECT_ID/voice/sessions?limit=20" \
  -H "Authorization: Bearer $DVAARIK_TOKEN"

POST /console/v2/projects/{project_id}/voice/sessions#

Admit a media session and return a single-use ws_url valid for expires_in_seconds. Hand only that URL to the client that streams audio.

DetailValue
DoorAccount session — Authorization: Bearer $DVAARIK_TOKEN
OperationconsoleCreateVoiceSession
Success201 CreateVoiceSessionResponse
ParameterInTypeRequiredNotes
project_idpathuuidyes

Request body: CreateVoiceSessionRequest.

ErrorWhen
401No account session was presented, or it is invalid or expired.
402Wallet balance cannot cover this session's maximum duration.
403The account is suspended or its email is not verified.
404The project or the addressed resource does not exist for this owner. A resource owned by another developer is deliberately indistinguishable from one that never existed.
409The project or resource is in a state that refuses this change.
422The request body or query is not valid. detail is an array of {loc, msg, type} and loc names the offending field.
503BYOK provider accounts are unverified/unavailable, or the service is draining.

Plus the account-door errors above. Full list on the errors page.

bash
curl -sS -X POST "https://api.developers.dvaarik.com/console/v2/projects/$PROJECT_ID/voice/sessions" \
  -H "Authorization: Bearer $DVAARIK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "<agent uuid>",
    "sample_rate_in": 16000,
    "sample_rate_out": 24000,
    "variables": {
      "company": "Northline Dental"
    }
  }'

GET /console/v2/projects/{project_id}/voice/sessions/{session_id}#

Read one session with its frozen pipeline snapshot, connected seconds and settled cost.

DetailValue
DoorAccount session — Authorization: Bearer $DVAARIK_TOKEN
OperationconsoleGetVoiceSession
Success200 VoiceSessionInfo
ParameterInTypeRequiredNotes
session_idpathuuidyes
project_idpathuuidyes
ErrorWhen
401No account session was presented, or it is invalid or expired.
403The account is suspended or its email is not verified.
404The project or the addressed resource does not exist for this owner. A resource owned by another developer is deliberately indistinguishable from one that never existed.
422The request body or query is not valid. detail is an array of {loc, msg, type} and loc names the offending field.

Plus the account-door errors above. Full list on the errors page.

bash
curl -sS -X GET "https://api.developers.dvaarik.com/console/v2/projects/$PROJECT_ID/voice/sessions/$SESSION_ID" \
  -H "Authorization: Bearer $DVAARIK_TOKEN"

GET /console/v2/projects/{project_id}/voice/sessions/{session_id}/transcript#

Console Get Voice Session Transcript.

DetailValue
DoorAccount session — Authorization: Bearer $DVAARIK_TOKEN
OperationconsoleGetVoiceSessionTranscript
Success200 TranscriptInfo
ParameterInTypeRequiredNotes
session_idpathuuidyes
project_idpathuuidyes
ErrorWhen
401No account session was presented, or it is invalid or expired.
403The account is suspended or its email is not verified.
404The project or the addressed resource does not exist for this owner. A resource owned by another developer is deliberately indistinguishable from one that never existed.
422The request body or query is not valid. detail is an array of {loc, msg, type} and loc names the offending field.

Plus the account-door errors above. Full list on the errors page.

bash
curl -sS -X GET "https://api.developers.dvaarik.com/console/v2/projects/$PROJECT_ID/voice/sessions/$SESSION_ID/transcript" \
  -H "Authorization: Bearer $DVAARIK_TOKEN"

POST /console/v2/projects/{project_id}/voice/sessions/outbound#

Queue one outbound call from a number on your own verified carrier connection. Send an Idempotency-Key; a repeat returns the first call with duplicate: true.

DetailValue
DoorAccount session — Authorization: Bearer $DVAARIK_TOKEN
OperationconsoleCreateOutboundVoiceSession
Success202 CreateOutboundVoiceSessionResponse
ParameterInTypeRequiredNotes
project_idpathuuidyes
Idempotency-Keyheaderstring or nullno

Request body: CreateOutboundVoiceSessionRequest.

ErrorWhen
401No account session was presented, or it is invalid or expired.
402Wallet balance cannot cover this call's maximum duration.
403The account is suspended or its email is not verified.
404The project or the addressed resource does not exist for this owner. A resource owned by another developer is deliberately indistinguishable from one that never existed.
409The project or resource is in a state that refuses this change.
422The request body or query is not valid. detail is an array of {loc, msg, type} and loc names the offending field.
503The carrier connection or BYOK pipeline is unavailable.

Plus the account-door errors above. Full list on the errors page.

bash
curl -sS -X POST "https://api.developers.dvaarik.com/console/v2/projects/$PROJECT_ID/voice/sessions/outbound" \
  -H "Authorization: Bearer $DVAARIK_TOKEN" \
  -H "Idempotency-Key: <unique per call attempt>" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "<agent uuid>",
    "from": "+15550000001",
    "to": "+15550000002"
  }'

Try it without a key in the browser

The playground opens a real voice session with your account session, so a project key never reaches a browser. Machine calls belong on your own server.