Skip to content

Voice ​

17 operations. Paths are relative to https://api.frege.io.

Show the environment's speech vendors ​

GET/v1/projects/{id}/voice

Every speech vendor the voice worker can drive, whether this environment has an account connected for it, and which vendor and model it speaks and listens with by default. A credential is never returned — only a hint (the last characters of a key, or a service account's email) to tell accounts apart. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID

Responses

StatusDescriptionBody
200OKdata
403Forbiddenerror envelope

List the environment's voice calls ​

GET/v1/projects/{id}/voice/calls

The voice sessions opened in this environment — from the dashboard, a widget or Telegram — newest first, one page at a time. started_at, ended_at and duration_seconds come from LiveKit and stay empty until it reports them; a call with no agent_joined_at is one the voice worker never answered. Paginated by page/page_size like every other listing in this API, or by limit/offset. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
pagequeryintegerPage to return, 1-based (default 1)
page_sizequeryintegerRows per page (default 50, max 200)
sortquerystringOrder: created_at, also accepted with a leading - for descending (default -created_at)
limitqueryintegerMax calls per window (max 200); with offset, instead of page/page_size
offsetqueryintegerCalls to skip (default 0)

Responses

StatusDescriptionBody
200OKdata
403Forbiddenerror envelope
422Unprocessable Entityerror envelope

One voice call, turn by turn ​

GET/v1/projects/{id}/voice/calls/{callID}

The call as listed, plus its conversation: each turn's words as speech-to-text heard them, the agent's answer, the tools it called, the model and tokens. A call that never reached a turn has none. The newest 200 turns at most. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
callID (required)pathintegerCall ID

Responses

StatusDescriptionBody
200OKdata
403Forbiddenerror envelope
404Not Founderror envelope

The environment's phone numbers ​

GET/v1/projects/{id}/voice/numbers

Every number that reaches this environment, oldest first, with the route its calls take: virtual lines (reached from the dashboard and tests, never the phone network) and the numbers of the environment's own SIP trunks. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID

Responses

StatusDescriptionBody
200OKdata
403Forbiddenerror envelope

Add a phone number ​

POST/v1/projects/{id}/voice/numbers

With buy, Frege buys that number, on sale through its carrier account (GET .../numbers/available), for this environment, at the carrier's price; with trunk_id, number is one of that trunk's numbers, which the trunk then may call; with neither, Frege picks a virtual line ("*7" and six digits). route says which agent answers, when (hours in a time zone, and where calls go after hours: another agent, or a spoken message and hang up), and whether a caller proves the customer their number suggests with a code sent by SMS. 409 phone_number_taken when any environment has the number. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID

Request body (application/json)

Schema: api.voiceNumberRequest.

FieldTypeDescription
buystringBuy is a number on sale through Frege, as GET .../numbers/available answered it, bought for this environment; Country is the one it was found in.
countrystring
numberstring
routeapi.voiceRoute
trunk_idintegerTrunkID adds the trunk's number; with neither, Frege picks a virtual line.

Responses

StatusDescriptionBody
201Createddata
404Not Founderror envelope
409Conflicterror envelope
422Unprocessable Entityerror envelope
503Service Unavailableerror envelope

One phone number ​

GET/v1/projects/{id}/voice/numbers/{numberID}

The number and its route. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
numberID (required)pathintegerNumber ID

Responses

StatusDescriptionBody
200OKdata
404Not Founderror envelope

Remove a phone number ​

DELETE/v1/projects/{id}/voice/numbers/{numberID}

The number stops reaching this environment at once; a trunk's number is taken off what the trunk may call. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
numberID (required)pathintegerNumber ID

Responses

StatusDescriptionBody
204No Content
404Not Founderror envelope

Change where a number's calls go ​

PUT/v1/projects/{id}/voice/numbers/{numberID}/route

Replaces the number's route; the next call takes it. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
numberID (required)pathintegerNumber ID

Request body (application/json)

Schema: api.voiceRoute.

FieldTypeDescription
after_hoursapi.voiceDestination
agent_idstring
hoursapi.voiceHours
proofstringOne of: sms, none.

Responses

StatusDescriptionBody
200OKdata
404Not Founderror envelope
422Unprocessable Entityerror envelope

Call a virtual line from the dashboard ​

POST/v1/projects/{id}/voice/numbers/{numberID}/test-call

Calls one of the environment's virtual lines as the phone network would, from the number in from (a customer's, to try how a caller is recognised; empty for none): the call takes the line's route, and Frege's voice worker joins it. Answers the LiveKit room to join from the browser, and, when the route asks the caller to prove who they are, the code that would have been texted to them, shown here instead. 422 for a number that is not a virtual line, 503 when live voice is not configured. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
numberID (required)pathintegerNumber ID

Request body (application/json)

Schema: api.voiceTestCallRequest.

FieldTypeDescription
fromstringFrom is the number the call comes from: a customer's, to try how a caller is recognised; empty for none.

Responses

StatusDescriptionBody
201Createddata
404Not Founderror envelope
422Unprocessable Entityerror envelope
503Service Unavailableerror envelope

Phone numbers on sale through Frege ​

GET/v1/projects/{id}/voice/numbers/available

Numbers Frege can buy for this environment through its carrier account, in a country (ISO 3166-1 alpha-2, like US) and optionally containing some digits (an area code), at the carrier's price: a number costs what the carrier charges, with no margin. At most 50, 20 unless limit says. 503 when the deployment has no carrier. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
country (required)querystringCountry, like US
containsquerystringDigits the number contains
limitqueryintegerHow many, at most 50

Responses

StatusDescriptionBody
200OKdata
422Unprocessable Entityerror envelope
503Service Unavailableerror envelope

Hear a voice before choosing it ​

POST/v1/projects/{id}/voice/preview

Speaks a short text with one of Frege's own speech models and one of its voices, through the deployment's gateway on the project's key, and answers with the audio: MP3 (audio/mpeg), or WAV (audio/wav) from a model that speaks only raw PCM, such as Gemini's. Without text it reads a sample line in language (en, ru or uz; en otherwise). speed paces it as the agent's speaking speed would pace a call. Recorded as usage of kind voice_tts. At most 300 characters. Organization admin or a manager of the environment. 409 when Frege's own voice is not offered, 402 when the organization's billing is suspended, 502 when the gateway fails.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID

Request body (application/json)

Schema: api.voicePreviewRequest.

FieldTypeDescription
languagestring
speednumberSpeed paces it, as a call would be: 0.5 to 2, 1 by default.
textstring
ttsstring
voicestring

Responses

StatusDescriptionBody
200OK
402Payment Required
409Conflict
422Unprocessable Entity
502Bad Gateway

Choose the environment's default speech vendors ​

PUT/v1/projects/{id}/voice/settings

Each choice is "provider/model" — "deepgram/nova-3", "elevenlabs/eleven_flash_v2_5" — or empty for none. The vendor must be connected in this environment and able to do that job. An agent can still choose its own in config.voice.stt / config.voice.tts, or a text-to-speech vendor in tts_model. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID

Request body (application/json)

Schema: api.voiceSettingsRequest.

FieldTypeDescription
sttstring
ttsstring

Responses

StatusDescriptionBody
200OKdata
422Unprocessable Entityerror envelope

The environment's SIP trunks ​

GET/v1/projects/{id}/voice/trunks

The trunks members point their own carriers' numbers at, oldest first; a trunk's password is never answered here. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID

Responses

StatusDescriptionBody
200OKdata
403Forbiddenerror envelope

Create a SIP trunk ​

POST/v1/projects/{id}/voice/trunks

A trunk for the member's own carrier: point its calls at sip_address and sign them with username and password, answered only here; or, with allowed_addresses, its calls are admitted by the carrier's public IPs and there is no password. 503 when this deployment has no SIP bridge. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID

Request body (application/json)

Schema: api.voiceTrunkRequest.

FieldTypeDescription
allowed_addressesstring[]AllowedAddresses, for a carrier that answers no password challenge: its public IPs or networks, at most 10.
namestring

Responses

StatusDescriptionBody
201Createddata
422Unprocessable Entityerror envelope
503Service Unavailableerror envelope

Remove a SIP trunk ​

DELETE/v1/projects/{id}/voice/trunks/{trunkID}

The trunk's numbers go with it and its calls are refused at once. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
trunkID (required)pathintegerTrunk ID

Responses

StatusDescriptionBody
204No Content
404Not Founderror envelope

Connect a speech vendor account to the environment ​

PUT/v1/projects/{id}/voice/vendors/{provider}

Stores the vendor's credential encrypted, replacing any this environment already had for that vendor. Deepgram, ElevenLabs, OpenAI and Cartesia take api_key; Google Cloud takes service_account_json, the service account key file's contents. The credential is never shown again. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
provider (required)pathstringVendor One of: deepgram, elevenlabs, openai, cartesia, google.

Request body (application/json)

Schema: api.connectVoiceVendorRequest.

FieldTypeDescription
api_keystring
service_account_jsonstring

Responses

StatusDescriptionBody
200OKdata
404Not Founderror envelope
422Unprocessable Entityerror envelope

Disconnect a speech vendor account ​

DELETE/v1/projects/{id}/voice/vendors/{provider}

Deletes the stored credential. Refused (409) while the environment's default speech-to-text or text-to-speech still names this vendor; choose another first. Agents that name the vendor themselves stop connecting until they are changed. Organization admin or a manager of the environment.

Authentication: bearer token.

Parameters

NameInTypeDescription
id (required)pathstringProject ID
provider (required)pathstringVendor

Responses

StatusDescriptionBody
200OKdata
404Not Founderror envelope
409Conflicterror envelope