v52

OpenAPI 3.1.0raw.githubusercontent.com2026-07-311,1941,9384.1 MB
Call Commands

Dial

Dial a number or SIP URI from a given connection. A successful response will include a call_leg_id which can be used to correlate the command with subsequent webhooks.

Expected Webhooks:

  • call.initiated
  • call.answered or call.hangup
  • call.hold and call.unhold if the call is held/unheld
  • call.machine.detection.ended if answering_machine_detection was requested
  • call.machine.greeting.ended if answering_machine_detection was requested to detect the end of machine greeting
  • call.machine.premium.detection.ended if answering_machine_detection=premium was requested
  • call.machine.premium.greeting.ended if answering_machine_detection=premium was requested and a beep was detected
  • call.deepfake_detection.result if deepfake_detection was enabled
  • call.deepfake_detection.error if deepfake_detection was enabled and an error occurred
  • streaming.started, streaming.stopped or streaming.failed if stream_url was set

When the record parameter is set to record-from-answer, the response will include a recording_id field.

post/calls

Request body

answering_machine_detection'premium' | 'detect' | 'detect_beep' | 'detect_words' | 'greeting_end' | 'disabled'

Enables Answering Machine Detection. Telnyx offers Premium and Standard detections. With Premium detection, when a call is answered, Telnyx runs real-time detection and sends a call.machine.premium.detection.ended webhook with one of the following results: human_residence, human_business, machine, silence or fax_detected. If we detect a beep, we also send a call.machine.premium.greeting.ended webhook with the result of beep_detected. If we detect a beep before call.machine.premium.detection.ended we only send call.machine.premium.greeting.ended, and if we detect a beep after call.machine.premium.detection.ended, we send both webhooks. With Standard detection, when a call is answered, Telnyx runs real-time detection to determine if it was picked up by a human or a machine and sends an call.machine.detection.ended webhook with the analysis result. If greeting_end or detect_words is used and a machine is detected, you will receive another call.machine.greeting.ended webhook when the answering machine greeting ends with a beep or silence. If detect_beep is used, you will only receive call.machine.greeting.ended if a beep is detected.

audio_urlstring

The URL of a file to be played back to the callee when the call is answered. The URL can point to either a WAV or MP3 file. media_name and audio_url cannot be used together in one request.

billing_group_idstring uuid

Use this field to set the Billing Group ID for the call. Must be a valid and existing Billing Group ID.

bridge_intentboolean

Indicates the intent to bridge this call with the call specified in link_to. When bridge_intent is true, link_to becomes required and the from number will be overwritten by the from number from the linked call.

bridge_on_answerboolean

Whether to automatically bridge answered call to the call specified in link_to. When bridge_on_answer is true, link_to becomes required.

client_statestring

Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string.

command_idstring

Use this field to avoid duplicate commands. Telnyx will ignore others Dial commands with the same command_id.

connection_idstring required

The ID of the Call Control App (formerly ID of the connection) to be used when dialing the destination.

enable_dialogflowboolean

Enables Dialogflow for the current call. The default value is false.

fromstring required

The from number to be used as the caller id presented to the destination (to number). The number should be in +E164 format.

from_display_namestring

The from_display_name string to be used as the caller id name (SIP From Display Name) presented to the destination (to number). The string should have a maximum of 128 characters, containing only letters, numbers, spaces, and -_~!.+ special characters. If ommited, the display name will be the same as the number in the from field.

link_tostring

Use another call's control id for sharing the same call session id

media_encryption'disabled' | 'SRTP' | 'DTLS'

Defines whether media should be encrypted on the call. For SIP URI destinations, media encryption can also be requested per endpoint with the secure URI parameter: ;secure=true or ;secure=srtp enables SRTP, and ;secure=dtls enables DTLS. This parameter, when set to SRTP or DTLS, takes precedence over the per-endpoint secure value.

media_namestring

The media_name of a file to be played back to the callee when the call is answered. The media_name must point to a file previously uploaded to api.telnyx.com/v2/media by the same user/organization. The file must either be a WAV or MP3 file.

park_after_unbridgestring

If supplied with the value self, the current leg will be parked after unbridge. If not set, the default behavior is to hang up the leg. When park_after_unbridge is set, link_to becomes required.

preferred_codecsstring

The list of comma-separated codecs in a preferred order for the forked media to be received.

prevent_double_bridgeboolean

Prevents bridging and hangs up the call if the target is already bridged. Disabled by default.

privacy'id' | 'none'

Indicates the privacy level to be used for the call. When set to id, caller ID information (name and number) will be hidden from the called party. When set to none or omitted, caller ID will be shown normally.

record'record-from-answer'

Start recording automatically after an event. Disabled by default.

record_channels'single' | 'dual'

Defines which channel should be recorded ('single' or 'dual') when record is specified.

record_custom_file_namestring

The custom recording file name to be used instead of the default call_leg_id. Telnyx will still add a Unix timestamp suffix.

record_format'wav' | 'mp3'

Defines the format of the recording ('wav' or 'mp3') when record is specified.

record_max_lengthinteger

Defines the maximum length for the recording in seconds when record is specified. The minimum value is 0. The maximum value is 43200. The default value is 0 (infinite).

record_timeout_secsinteger

The number of seconds that Telnyx will wait for the recording to be stopped if silence is detected when record is specified. The timer only starts when the speech is detected. Please note that call transcription is used to detect silence and the related charge will be applied. The minimum value is 0. The default value is 0 (infinite).

record_track'both' | 'inbound' | 'outbound'

The audio track to be recorded. Can be either both, inbound or outbound. If only single track is specified (inbound, outbound), channels configuration is ignored and it will be recorded as mono (single channel).

record_trim'trim-silence'

When set to trim-silence, silence will be removed from the beginning and end of the recording.

retry_on_timeoutboolean

Whether to keep trying the remaining routing paths (e.g. alternate providers/gateways) for the same destination after timeout_secs is reached for the current attempt. When set to false, reaching timeout_secs aborts the entire dial attempt and the call.hangup webhook reports a hangup_cause of no_answer instead of timeout.

route_to_mobileboolean

When set to true, routes the call directly to the mobile device associated with the destination Telnyx Mobile number, bypassing Inbound Calls Interception configured in the Telnyx Portal under Mobile Numbers → select the number → Voice → Call Interception. Use this when transferring an intercepted call to the mobile device to prevent the call from being intercepted again. Defaults to false.

send_digits_on_answerstring

DTMF digits to send automatically after the called party answers. Useful for reaching an extension behind an IVR (e.g. "200" to dial extension 200 once the called party picks up). Allowed characters: 0-9, A-D, w (0.5s pause), W (1s pause), *, #. Maximum 64 characters. When omitted, no automatic DTMF is sent. May also be supplied inline by appending ,<digits> to to (e.g. to=+18004247767,200); if both forms are present, this explicit field takes precedence.

send_silence_when_idleboolean

Generate silence RTP packets when no transmission available.

sip_auth_passwordstring

SIP Authentication password used for SIP challenges.

sip_auth_usernamestring

SIP Authentication username used for SIP challenges.

sip_region'US' | 'Europe' | 'Canada' | 'Australia' | 'Middle East'

Defines the SIP region to be used for the call.

sip_transport_protocol'UDP' | 'TCP' | 'TLS'

Defines SIP transport protocol to be used on the call.

stream_auth_tokenstring

An authentication token to be sent as part of the WebSocket connection when using streaming. Maximum length is 4000 characters.

stream_bidirectional_codec'PCMU' | 'PCMA' | 'G722' | 'OPUS' | 'AMR-WB' | 'L16'

Indicates codec for bidirectional streaming RTP payloads. Used only with stream_bidirectional_mode=rtp. Case sensitive.

stream_bidirectional_mode'mp3' | 'rtp'

Configures method of bidirectional streaming (mp3, rtp).

stream_bidirectional_sampling_rate8000 | 16000 | 22050 | 24000 | 48000

Audio sampling rate.

stream_bidirectional_target_legs'both' | 'self' | 'opposite'

Specifies which call legs should receive the bidirectional stream audio.

stream_codec'PCMU' | 'PCMA' | 'G722' | 'OPUS' | 'AMR-WB' | 'L16' | 'default'

Specifies the codec to be used for the streamed audio. When set to 'default' or when transcoding is not possible, the codec from the call will be used.

stream_establish_before_call_originateboolean

Establish websocket connection before dialing the destination. This is useful for cases where the websocket connection takes a long time to establish.

stream_track'inbound_track' | 'outbound_track' | 'both_tracks'

Specifies which track should be streamed.

stream_urlstring

The destination WebSocket address where the stream is going to be delivered.

supervise_call_control_idstring

The call leg which will be supervised by the new call.

supervisor_role'barge' | 'whisper' | 'monitor'

The role of the supervisor call. 'barge' means that supervisor call hears and is being heard by both ends of the call (caller & callee). 'whisper' means that only supervised_call_control_id hears supervisor but supervisor can hear everything. 'monitor' means that nobody can hear supervisor call, but supervisor can hear everything on the call.

time_limit_secsinteger

Sets the maximum duration of a Call Control Leg in seconds. If the time limit is reached, the call will hangup and a call.hangup webhook with a hangup_cause of time_limit will be sent. For example, by setting a time limit of 120 seconds, a Call Leg will be automatically terminated two minutes after being answered. The default time limit is 14400 seconds or 4 hours and this is also the maximum allowed call length.

timeout_secsinteger

The number of seconds that Telnyx will wait for the call to be answered by the destination to which it is being called. If the timeout is reached before an answer is received, the call will hangup and a call.hangup webhook with a hangup_cause of timeout will be sent. Minimum value is 5 seconds. Maximum value is 600 seconds.

transcriptionboolean

Enable transcription upon call answer. The default value is false.

webhook_retries_policiesobject

A map of event types to retry policies. Each retry policy contains an array of retries_ms specifying the delays between retry attempts in milliseconds. Maximum 5 retries, total delay cannot exceed 60 seconds.

webhook_urlstring

Use this field to override the URL for which Telnyx will send subsequent webhooks to for this call.

webhook_url_method'POST' | 'GET'

HTTP request type used for webhook_url.

webhook_urlsobject

A map of event types to webhook URLs. When an event of the specified type occurs, the webhook URL associated with that event type will be called instead of the default webhook URL. Events not mapped here will use the default webhook URL.

webhook_urls_method'POST' | 'GET'

HTTP request method to invoke webhook_urls.

Example request

{
  "answering_machine_detection": "detect",
  "answering_machine_detection_config": {
    "after_greeting_silence_millis": 1000,
    "between_words_silence_millis": 1000,
    "greeting_duration_millis": 1000,
    "greeting_silence_duration_millis": 2000,
    "greeting_total_analysis_time_millis": 50000,
    "initial_silence_millis": 1000,
    "maximum_number_of_words": 1000,
    "maximum_word_length_millis": 2000,
    "silence_threshold": 512,
    "total_analysis_time_millis": 5000
  },
  "audio_url": "http://www.example.com/sounds/greeting.wav",
  "bridge_intent": true,
  "bridge_on_answer": true,
  "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
  "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
  "conference_config": {
    "conference_name": "telnyx-conference",
    "start_conference_on_enter": true
  },
  "connection_id": "7267xxxxxxxxxxxxxx",
  "conversation_relay_config": {
    "custom_parameters": {
      "customer_id": "12345"
    },
    "dtmf_detection": true,
    "greeting": "Hi! Ask me anything!",
    "interruptible": "speech",
    "interruptible_greeting": "dtmf",
    "language": "en-US",
    "tts_provider": "telnyx",
    "url": "wss://example.com/conversation-relay",
    "voice": "Telnyx.KokoroTTS.af"
  },
  "custom_headers": [
    {
      "name": "head_1",
      "value": "val_1"
    },
    {
      "name": "head_2",
      "value": "val_2"
    }
  ],
  "deepfake_detection": {
    "enabled": true,
    "rtp_timeout": 30,
    "timeout": 15
  },
  "dialogflow_config": {
    "analyze_sentiment": false,
    "partial_automated_agent_reply": false
  },
  "enable_dialogflow": false,
  "from": "+18005550101",
  "from_display_name": "Company Name",
  "link_to": "ilditnZK_eVysupV21KzmzN_sM29ygfauQojpm4BgFtfX5hXAcjotg==",
  "media_encryption": "SRTP",
  "send_digits_on_answer": "wwww200",
  "send_silence_when_idle": true,
  "sip_auth_password": "password",
  "sip_auth_username": "username",
  "sip_headers": [
    {
      "name": "User-to-User",
      "value": "12345"
    }
  ],
  "sip_transport_protocol": "TLS",
  "stream_track": "both_tracks",
  "stream_url": "wss://www.example.com/websocket",
  "time_limit_secs": 60,
  "timeout_secs": 60,
  "to": "+18005550100 or sip:username@sip.telnyx.com;secure=srtp",
  "webhook_retries_policies": {
    "call.hangup": {
      "retries_ms": [
        1000,
        2000,
        5000
      ]
    }
  },
  "webhook_url": "https://www.example.com/server-b/",
  "webhook_url_method": "POST",
  "webhook_urls": {
    "call.bridge": "https://www.example.com/webhooks/bridge",
    "call.hangup": "https://www.example.com/webhooks/hangup"
  },
  "webhook_urls_method": "POST"
}

Response

Successful response with details about a call status that includes recording_id.

Example response

{
  "data": {
    "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
    "call_duration": 50,
    "call_leg_id": "2dc6fc34-f9e0-11ea-b68e-02420a0f7768",
    "call_session_id": "2dc1b3c8-f9e0-11ea-bc5a-02420a0f7768",
    "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
    "end_time": "2019-01-23T18:11:52.574Z",
    "is_alive": false,
    "record_type": "call",
    "recording_id": "d7e9c1d4-8b2a-4b8f-b3a7-9a671c9e9b0a",
    "start_time": "2019-01-23T18:10:02.574Z"
  }
}