Developer platform · v2

API reference

View as MarkdownAll docs

Voice sessions

8 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_nano_usdstringyes
created_atdate-timeyes
currencystringyes
directionstringyes
end_reasonstring or nullyes
ended_atdate-time or nullyes
hold_nano_usdstringyes
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_minstringyes
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.
sample_rate_inintegeryes
sample_rate_outintegeryes
started_atdate-time or nullyes
statusstringyes
store_transcriptbooleanyes
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"

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"

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.