> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/texml/calls.yml post /texml/Accounts/{account_sid}/Calls
openapi: 3.1.0
info:
  title: Telnyx TeXML Calls API
  version: 2.0.0
  description: API for managing TeXML Calls.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
tags:
  - name: Command
    description: TeXML command operations
  - name: Callbacks
    description: Webhook callbacks for call events
paths:
  /texml/Accounts/{account_sid}/Calls:
    post:
      tags:
        - TeXML REST Commands
      summary: Initiate an outbound call
      description: >-
        Initiate an outbound TeXML call. Telnyx will request TeXML from the XML
        Request URL configured for the connection in the Mission Control Portal.
      operationId: InitiateTexmlCall
      parameters:
        - $ref: '#/components/parameters/AccountSid'
      requestBody:
        description: Iniatiate Call request object
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InitiateCallRequest'
      responses:
        '200':
          $ref: '#/components/responses/InitiateCallResponse'
        '422':
          $ref: '#/components/responses/call-scripting_UnprocessableEntityResponse'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            const response = await
            client.texml.accounts.calls.calls('account_sid', {
              params: { Url: 'https://www.example.com/texml.xml' },
            });


            console.log(response.from);
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            response = client.texml.accounts.calls.calls(
                account_sid="account_sid",
                params={
                    "url": "https://www.example.com/texml.xml"
                },
            )
            print(response.from_)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Texml.Accounts.Calls.Calls(\n\t\tcontext.TODO(),\n\t\t\"account_sid\",\n\t\ttelnyx.TexmlAccountCallCallsParams{\n\t\t\tOfWithURL: &telnyx.TexmlAccountCallCallsParamsParamsWithURL{\n\t\t\t\tURL: \"https://www.example.com/texml.xml\",\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.From)\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
            import com.telnyx.sdk.models.texml.accounts.calls.CallCallsParams;
            import com.telnyx.sdk.models.texml.accounts.calls.CallCallsResponse;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    CallCallsParams params = CallCallsParams.builder()
                        .accountSid("account_sid")
                        .params(CallCallsParams.Params.WithUrl.builder()
                            .url("https://www.example.com/texml.xml")
                            .build())
                        .build();
                    CallCallsResponse response = client.texml().accounts().calls().calls(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


            telnyx = Telnyx::Client.new(api_key: "My API Key")


            response = telnyx.texml.accounts.calls.calls("account_sid", params:
            {Url: "https://www.example.com/texml.xml"})


            puts(response)
        - lang: CLI
          source: |-
            telnyx texml:accounts:calls calls \
              --api-key 'My API Key' \
              --account-sid account_sid \
              --params '{Url: https://www.example.com/texml.xml}'
components:
  parameters:
    AccountSid:
      name: account_sid
      in: path
      required: true
      description: The id of the account the resource belongs to.
      schema:
        type: string
  schemas:
    InitiateCallRequest:
      type: object
      title: Initiate Call Request
      required:
        - To
        - From
        - ApplicationSid
      properties:
        ApplicationSid:
          description: The ID of the TeXML Application.
          type: string
        To:
          description: >-
            The phone number of the called party. Phone numbers are formatted
            with a `+` and country code.
          example: '+16175551212'
          type: string
        From:
          description: >-
            The phone number of the party that initiated the call. Phone numbers
            are formatted with a `+` and country code.
          example: '+16175551212'
          type: string
        CallerId:
          description: >-
            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.
          example: Info
          type: string
        Url:
          description: The URL from which Telnyx will retrieve the TeXML call instructions.
          example: https://www.example.com/instructions.xml
          type: string
        UrlMethod:
          description: >-
            HTTP request type used for `Url`. The default value is inherited
            from TeXML Application setting.
          example: GET
          default: POST
          type: string
          enum:
            - GET
            - POST
        FallbackUrl:
          description: >-
            A failover URL for which Telnyx will retrieve the TeXML call
            instructions if the `Url` is not responding.
          example: https://www.example.com/instructions-fallback.xml
          type: string
        StatusCallback:
          description: >-
            URL destination for Telnyx to send status callback events to for the
            call.
          example: https://www.example.com/callback
          type: string
        StatusCallbackMethod:
          description: HTTP request type used for `StatusCallback`.
          example: GET
          default: POST
          type: string
          enum:
            - GET
            - POST
        StatusCallbackEvent:
          description: >-
            The call events for which Telnyx should send a webhook. Multiple
            events can be defined when separated by a space.
          example: initiated
          default: completed
          type: string
          enum:
            - initiated
            - ringing
            - answered
            - completed
        MachineDetection:
          description: Enables Answering Machine Detection.
          example: Enable
          default: Disable
          type: string
          enum:
            - Enable
            - Disable
            - DetectMessageEnd
        DetectionMode:
          description: Allows you to chose between Premium and Standard detections.
          example: Premium
          default: Regular
          type: string
          enum:
            - Premium
            - Regular
        AsyncAmd:
          description: >-
            Select whether to perform answering machine detection in the
            background. By default execution is blocked until Answering Machine
            Detection is completed.
          example: true
          default: false
          type: boolean
        AsyncAmdStatusCallback:
          description: >-
            URL destination for Telnyx to send AMD callback events to for the
            call.
          example: https://www.example.com/callback
          type: string
        AsyncAmdStatusCallbackMethod:
          description: >-
            HTTP request type used for `AsyncAmdStatusCallback`. The default
            value is inherited from TeXML Application setting.
          example: GET
          default: POST
          type: string
          enum:
            - GET
            - POST
        MachineDetectionTimeout:
          description: Maximum timeout threshold in milliseconds for overall detection.
          example: 5000
          default: 30000
          maximum: 60000
          minimum: 500
          type: integer
        MachineDetectionSpeechThreshold:
          description: >-
            Maximum threshold of a human greeting. If greeting longer than this
            value, considered machine. Ignored when `premium` detection is used.
          example: 2000
          default: 3500
          type: integer
        MachineDetectionSpeechEndThreshold:
          description: >-
            Silence duration threshold after a greeting message or voice for it
            be considered human. Ignored when `premium` detection is used.
          example: 2000
          default: 800
          type: integer
        MachineDetectionSilenceTimeout:
          description: >-
            If initial silence duration is greater than this value, consider it
            a machine. Ignored when `premium` detection is used.
          example: 2000
          default: 3500
          type: integer
        CancelPlaybackOnMachineDetection:
          description: >-
            Whether to cancel ongoing playback on `machine` detection. Defaults
            to `true`.
          default: true
          example: false
          type: boolean
        CancelPlaybackOnDetectMessageEnd:
          description: >-
            Whether to cancel ongoing playback on `greeting ended` detection.
            Defaults to `true`.
          default: true
          example: false
          type: boolean
        DeepfakeDetection:
          description: >-
            Enables Deepfake Detection on the dialed call. When enabled, audio
            from the remote party is analyzed to determine whether the voice is
            AI-generated. Results are delivered asynchronously via a callback.
          example: Enable
          type: string
          enum:
            - Enable
        DeepfakeDetectionCallbackUrl:
          description: >-
            URL destination for Telnyx to send deepfake detection callback
            events to for the call.
          example: https://www.example.com/deepfake-callback
          type: string
        DeepfakeDetectionCallbackMethod:
          description: HTTP request type used for `DeepfakeDetectionCallbackUrl`.
          example: GET
          default: POST
          type: string
          enum:
            - GET
            - POST
        PreferredCodecs:
          description: The list of comma-separated codecs to be offered on a call.
          example: PCMA,PCMU
          type: string
        Record:
          description: >-
            Whether to record the entire participant's call leg. Defaults to
            `false`.
          example: false
          type: boolean
        RecordingChannels:
          description: The number of channels in the final recording. Defaults to `mono`.
          example: dual
          type: string
          enum:
            - mono
            - dual
        RecordingStatusCallback:
          description: The URL the recording callbacks will be sent to.
          example: https://example.com/recording_status_callback
          type: string
        RecordingStatusCallbackMethod:
          description: >-
            HTTP request type used for `RecordingStatusCallback`. Defaults to
            `POST`.
          example: GET
          type: string
          enum:
            - GET
            - POST
        RecordingStatusCallbackEvent:
          description: >-
            The changes to the recording's state that should generate a call to
            `RecoridngStatusCallback`. Can be: `in-progress`, `completed` and
            `absent`. Separate multiple values with a space. Defaults to
            `completed`.
          example: in-progress completed absent
          type: string
        RecordingTimeout:
          description: >-
            The number of seconds that Telnyx will wait for the recording to be
            stopped if silence is detected. The timer only starts when the
            speech is detected. Please note that the transcription is used to
            detect silence and the related charge will be applied. The minimum
            value is 0. The default value is 0 (infinite)
          example: 5
          type: integer
          default: 0
        RecordingTrack:
          description: The audio track to record for the call. The default is `both`.
          example: inbound
          type: string
          enum:
            - inbound
            - outbound
            - both
        SendRecordingUrl:
          $ref: '#/components/schemas/SendRecordingUrl'
        SipAuthPassword:
          description: The password to use for SIP authentication.
          example: '1234'
          type: string
        SipAuthUsername:
          description: The username to use for SIP authentication.
          example: user
          type: string
        Trim:
          description: >-
            Whether to trim any leading and trailing silence from the recording.
            Defaults to `trim-silence`.
          example: trim-silence
          type: string
          enum:
            - trim-silence
            - do-not-trim
        CustomHeaders:
          description: >-
            Custom HTTP headers to be sent with the call. Each header should be
            an object with 'name' and 'value' properties.
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                description: The name of the custom header
              value:
                type: string
                description: The value of the custom header
            required:
              - name
              - value
          example:
            - name: X-Custom-Header
              value: custom-value
        SipRegion:
          description: Defines the SIP region to be used for the call.
          type: string
          default: US
          enum:
            - US
            - Europe
            - Canada
            - Australia
            - Middle East
          example: Canada
        MediaEncryption:
          description: >-
            Defines whether media should be encrypted on the call. When set to
            `SRTP`, the call will use Secure Real-time Transport Protocol for
            media encryption. When set to `DTLS`, the call will use DTLS for
            media encryption. Only supported for SIP destinations.
          example: disabled
          default: disabled
          type: string
          enum:
            - disabled
            - SRTP
            - DTLS
        SuperviseCallSid:
          description: >-
            The call control ID of the existing call to supervise. When
            provided, the created leg will be added to the specified call in
            supervising mode. Status callbacks and action callbacks will NOT be
            sent for the supervising leg.
          example: v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg
          type: string
        SupervisingRole:
          description: >-
            The supervising role for the new leg. Determines the audio behavior:
            barge (hear both sides), whisper (only hear supervisor), monitor
            (hear both sides but supervisor muted). Default: barge
          example: monitor
          type: string
          enum:
            - barge
            - whisper
            - monitor
          default: barge
        Timeout:
          description: >-
            The number of seconds to wait for the called party to answer the
            call before the call is canceled. The minimum value is 5 and the
            maximum value is 120. Default is 30 seconds.
          example: 60
          type: integer
          minimum: 5
          maximum: 120
          default: 30
          x-stainless-param: timeout_seconds
        TimeLimit:
          description: >-
            The maximum duration of the call in seconds. The minimum value is 30
            and the maximum value is 14400 (4 hours). Default is 14400 seconds.
          example: 3600
          type: integer
          minimum: 30
          maximum: 14400
          default: 14400
        Texml:
          description: >-
            TeXML to be used as instructions for the call. If provided, the call
            will execute these instructions instead of fetching from the Url.
          example: >-
            <?xml version="1.0"
            encoding="UTF-8"?><Response><Say>Hello</Say></Response>
          type: string
      oneOf:
        - title: With URL
          required:
            - Url
          properties:
            Texml:
              not: {}
        - title: With TeXML
          required:
            - Texml
          properties:
            Url:
              not: {}
        - title: Application Default
          properties:
            Url:
              not: {}
            Texml:
              not: {}
      example:
        To: '+13121230000'
        From: '+13120001234'
        Url: https://www.example.com/texml.xml
        StatusCallback: https://www.example.com/statuscallback-listener
        ApplicationSid: example-app-sid
    SendRecordingUrl:
      type: boolean
      description: Whether to send RecordingUrl in webhooks.
      example: false
      default: true
    InitiateCallResult:
      type: object
      title: Initaite TeXML Call Result
      example:
        from: '+13120001234'
        to: '+13121230000'
        status: queued
      properties:
        from:
          type: string
          example: '+13120001234'
        to:
          type: string
          example: '+13120000000'
        status:
          type: string
          example: accepted
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
              detail:
                type: string
              meta:
                type: object
                properties:
                  url:
                    type: string
                    format: uri
              title:
                type: string
              source:
                type: object
                properties:
                  pointer:
                    type: string
  responses:
    InitiateCallResponse:
      description: Successful response upon initiating a TeXML call.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InitiateCallResult'
    call-scripting_UnprocessableEntityResponse:
      description: >-
        Unprocessable entity. The request was well-formed but contains semantic
        errors.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing_required_parameter:
              summary: Missing required parameter
              value:
                errors:
                  - code: '10004'
                    title: Missing required parameter
                    detail: 'Can''t be blank: ApplicationId'
                    source:
                      pointer: /ApplicationId
            invalid_parameter_type:
              summary: Invalid parameter type
              value:
                errors:
                  - code: '10026'
                    title: Invalid parameter type
                    detail: The 'To' parameter must be of type 'string'
                    source:
                      pointer: /To
            invalid_enumerated_value:
              summary: Invalid enumerated value
              value:
                errors:
                  - code: '10032'
                    title: Invalid enumerated value
                    detail: Status must be one of completed
                    source:
                      pointer: /Status
            invalid_send_digits:
              summary: Invalid SendDigits format
              value:
                errors:
                  - code: '90014'
                    title: Invalid value for SendDigits
                    detail: >-
                      The 'SendDigits' parameter must be a 'string' made of a
                      combination of either 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B,
                      C, D, w, W, * or #
                    source:
                      pointer: /SendDigits
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````