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

# Update call

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



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/texml/calls.yml post /texml/Accounts/{account_sid}/Calls/{call_sid}
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/{call_sid}:
    post:
      tags:
        - TeXML REST Commands
      summary: Update call
      description: >-
        Update TeXML call. Please note that the keys present in the payload MUST
        BE formatted in CamelCase as specified in the example.
      operationId: UpdateTexmlCall
      parameters:
        - $ref: '#/components/parameters/CallSid'
        - $ref: '#/components/parameters/AccountSid'
      requestBody:
        description: Update Call request object
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/UpdateCallRequest'
      responses:
        '200':
          $ref: '#/components/responses/GetCallResponse'
        '404':
          $ref: '#/components/responses/call-scripting_NotFoundResponse'
        '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 call = await client.texml.accounts.calls.update('call_sid', {
            account_sid: 'account_sid' });


            console.log(call.account_sid);
        - 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
            )
            call = client.texml.accounts.calls.update(
                call_sid="call_sid",
                account_sid="account_sid",
            )
            print(call.account_sid)
        - 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\tcall, err := client.Texml.Accounts.Calls.Update(\n\t\tcontext.TODO(),\n\t\t\"call_sid\",\n\t\ttelnyx.TexmlAccountCallUpdateParams{\n\t\t\tAccountSid: \"account_sid\",\n\t\t\tUpdateCall: telnyx.UpdateCallParam{},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", call.AccountSid)\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.CallUpdateParams;

            import
            com.telnyx.sdk.models.texml.accounts.calls.CallUpdateResponse;

            import com.telnyx.sdk.models.texml.accounts.calls.UpdateCall;


            public final class Main {
                private Main() {}

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

                    CallUpdateParams params = CallUpdateParams.builder()
                        .accountSid("account_sid")
                        .callSid("call_sid")
                        .updateCall(UpdateCall.builder().build())
                        .build();
                    CallUpdateResponse call = client.texml().accounts().calls().update(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            call = telnyx.texml.accounts.calls.update("call_sid", account_sid:
            "account_sid")


            puts(call)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $call = $client->texml->accounts->calls->update(
                'call_sid',
                accountSid: 'account_sid',
                fallbackMethod: 'GET',
                fallbackURL: 'https://www.example.com/intruction-c.xml',
                method: 'GET',
                status: 'completed',
                statusCallback: 'https://www.example.com/callback',
                statusCallbackMethod: 'GET',
                texml: '<?xml version="1.0" encoding="UTF-8"?><Response><Say>Hello</Say></Response>',
                url: 'https://www.example.com/intruction-b.xml',
              );

              var_dump($call);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx texml:accounts:calls update \
              --api-key 'My API Key' \
              --account-sid account_sid \
              --call-sid call_sid
components:
  parameters:
    CallSid:
      name: call_sid
      in: path
      required: true
      description: The CallSid that identifies the call to update.
      schema:
        type: string
    AccountSid:
      name: account_sid
      in: path
      required: true
      description: The id of the account the resource belongs to.
      schema:
        type: string
  schemas:
    UpdateCallRequest:
      type: object
      title: Update Call Request
      properties:
        Status:
          description: >-
            The value to set the call status to. Setting the status to completed
            ends the call.
          example: completed
          type: string
        Url:
          description: >-
            The URL where TeXML will make a request to retrieve a new set of
            TeXML instructions to continue the call flow.
          example: https://www.example.com/intruction-b.xml
          type: string
        Method:
          description: HTTP request type used for `Url`.
          example: GET
          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/intruction-c.xml
          type: string
        FallbackMethod:
          description: HTTP request type used for `FallbackUrl`.
          example: GET
          type: string
          enum:
            - GET
            - POST
        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
          type: string
          enum:
            - GET
            - POST
        Texml:
          description: TeXML to replace the current one with.
          example: >-
            <?xml version="1.0"
            encoding="UTF-8"?><Response><Say>Hello</Say></Response>
          type: string
      example:
        Status: completed
    CallResource:
      type: object
      title: Call resource
      example:
        account_sid: 61bf923e-5e4d-4595-a110-56190ea18a1b
        answered_by: human
        caller_name: '+13122010094'
        date_created: Thu, 15 Jun 2023 09:56:45 +0000
        date_updated: Thu, 15 Jun 2023 09:56:56 +0000
        direction: inbound
        duration: '11'
        end_time: Thu, 15 Jun 2023 09:56:56 +0000
        from: '+13123456789'
        from_formatted: (312) 345-6789
        sid: v3:KBnLO0ZK3DhKM5s7bE9VluaSmKsOchKht_fUYvxcp8ysbmzCCtpkmA
        start_time: Thu, 15 Jun 2023 09:56:45 +0000
        status: completed
        to: '+13987654321'
        to_formatted: (398) 765-4321
        uri: >-
          /v2/texml/Accounts/61bf923e-5e4d-4595-a110-56190ea18a1b/Calls/v3:KBnLO0ZK3DhKM5s7bE9VluaSmKsOchKht_fUYvxcp8ysbmzCCtpkmA.json
      properties:
        account_sid:
          type: string
          description: The id of the account the resource belongs to.
          example: 61bf923e-5e4d-4595-a110-56190ea18a1b
        answered_by:
          type: string
          description: >-
            The value of the answering machine detection result, if this feature
            was enabled for the call.
          enum:
            - human
            - machine
            - not_sure
          example: human
        caller_name:
          type: string
          description: Caller ID, if present.
          example: CALLER
        date_created:
          type: string
          description: The timestamp of when the resource was created.
          example: Thu, 15 Jun 2023 09:56:45 +0000
        date_updated:
          type: string
          description: The timestamp of when the resource was last updated.
          example: Thu, 15 Jun 2023 09:56:45 +0000
        direction:
          type: string
          description: The direction of this call.
          enum:
            - inbound
            - outbound
          example: inbound
        duration:
          type: string
          description: The duration of this call, given in seconds.
          example: '12'
        end_time:
          type: string
          description: The end time of this call.
          example: Thu, 15 Jun 2023 09:56:45 +0000
        from:
          type: string
          description: The phone number or SIP address that made this call.
          example: '+13123456789'
        from_formatted:
          type: string
          description: The from number formatted for display.
          example: (312) 345-6789
        price:
          type: string
          description: >-
            The price of this call, the currency is specified in the price_unit
            field. Only populated when the call cost feature is enabled for the
            account.
          example: '0.10'
        price_unit:
          type: string
          description: The unit in which the price is given.
          example: USD
        sid:
          type: string
          description: The identifier of this call.
          example: v3:KBnLO0ZK3DhKM5s7bE9VluaSmKsOchKht_fUYvxcp8ysbmzCCtpkmA
        start_time:
          type: string
          description: The start time of this call.
          example: Thu, 15 Jun 2023 09:56:45 +0000
        status:
          type: string
          description: The status of this call.
          enum:
            - ringing
            - in-progress
            - canceled
            - completed
            - failed
            - busy
            - no-answer
          example: completed
        to:
          type: string
          description: The phone number or SIP address that received this call.
          example: '+13987654321'
        to_formatted:
          type: string
          description: The to number formatted for display.
          example: (398) 765-4321
        uri:
          type: string
          description: The relative URI for this call.
          example: >-
            /v2/texml/Accounts/61bf923e-5e4d-4595-a110-56190ea18a1b/Calls/v3:KBnLO0ZK3DhKM5s7bE9VluaSmKsOchKht_fUYvxcp8ysbmzCCtpkmA.json
    call-scripting_ResourceNotFoundError:
      type: object
      title: Resource not found
      example:
        errors:
          - detail: Resource not found
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              detail:
                type: string
    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:
    GetCallResponse:
      description: Call resource.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CallResource'
    call-scripting_NotFoundResponse:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/call-scripting_ResourceNotFoundError'
    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

````