TeXML REST Commands

TeXML REST Commands

Initiate an outbound call

Initiate an outbound TeXML call. Telnyx will request TeXML from the XML Request URL configured for the connection in the Mission Control Portal.

SecuritybearerAuth
Request
path Parameters
application_id
required
string

The ID of the TeXML application used for the call.

Request Body schema: application/json
required

Iniatiate Call request object

To
required
string

The phone number of the called party. Phone numbers are formatted with a + and country code.

From
required
string

The phone number of the party that initiated the call. Phone numbers are formatted with a + and country code.

Url
string

The URL from which Telnyx will retrieve the TeXML call instructions.

UrlMethod
string
Default: "POST"

HTTP request type used for Url. The default value is inherited from TeXML Application setting.

Enum: "GET" "POST"
FallbackUrl
string

A failover URL for which Telnyx will retrieve the TeXML call instructions if the Url is not responding.

StatusCallback
string

URL destination for Telnyx to send status callback events to for the call.

StatusCallbackMethod
string
Default: "POST"

HTTP request type used for StatusCallback.

Enum: "GET" "POST"
StatusCallbackEvent
string
Default: "completed"

The call events for which Telnyx should send a webhook. Multiple events can be defined when separated by a space.

Enum: "initiated" "ringing" "answered" "completed"
Timeout
integer [ 5 .. 120 ]
Default: 30

The number of seconds Telnyx will wait for the dialed party to answer.

Responses
200

Successful response upon initiating a TeXML call.

Response Schema: application/json
object (Initaite TeXML Call Result)
from
string
to
string
status
string
post/texml/calls/{application_id}
Request samples
application/json
{}
Response samples
application/json
{
  • "data": {
    • "from": "+13120001234",
    • "to": "+13121230000",
    • "status": "queued"
    }
}

Update call

Update TeXML call. Please note that the keys present in the payload MUST BE formatted in CamelCase as specified in the example.

SecuritybearerAuth
Request
path Parameters
call_sid
required
string (CallControlId)

The CallSid that identifies the call resource.

Example: v3:KBnLO0ZK3DhKM5s7bE9VluaSmKsOchKht_fUYvxcp8ysbmzCCtpkmA
Request Body schema: application/json
required

Update Call request object

Status
string

The value to set the call status to. Setting the status to completed ends the call.

Url
string

The URL where TeXML will make a request to retrieve a new set of TeXML instructions to continue the call flow.

Method
string

HTTP request type used for Url.

Enum: "GET" "POST"
FallbackUrl
string

A failover URL for which Telnyx will retrieve the TeXML call instructions if the Url is not responding.

FallbackMethod
string

HTTP request type used for FallbackUrl.

Enum: "GET" "POST"
StatusCallback
string

URL destination for Telnyx to send status callback events to for the call.

StatusCallbackMethod
string

HTTP request type used for StatusCallback.

Enum: "GET" "POST"
Texml
string

TeXML to replace the current one with.

Responses
200

Successful response upon updating a TeXml call.

Response Schema: application/json
object (TeXml REST Update Command Result)
sid
string
status
string
post/texml/calls/{call_sid}/update
Request samples
application/json
{
  • "Status": "completed"
}
Response samples
application/json
{
  • "data": {
    • "sid": "c46e06d7-b78f-4b13-96b6-c576af9640ff",
    • "status": "accepted"
    }
}

Create a TeXML secret

Create a TeXML secret which can be later used as a Dynamic Parameter for TeXML when using Mustache Templates in your TeXML. In your TeXML you will be able to use your secret name, and this name will be replaced by the actual secret value when processing the TeXML on Telnyx side. The secrets are not visible in any logs.

SecuritybearerAuth
Request
Request Body schema: application/json
required

Create TeXML secret request object

name
required
string

Name used as a reference for the secret, if the name already exists within the account its value will be replaced

value
required
string
Responses
201

Successful response upon creating a TeXML secret.

Response Schema: application/json
object (Create TeXML Secret result)
name
string
value
string
Value: "*****"
422

Unprocessable entity

post/texml/secrets
Request samples
application/json
{
  • "name": "My Secret Name",
  • "value": "My Secret Value"
}
Response samples
application/json
{
  • "data": {
    • "name": "My Secret Name",
    • "value": "*****"
    }
}