---
title: "Fetch callback API"
method: POST
path: "fetch-markup-language"
tags: ["channels", "voice", "calls-markup-language", "markup-language-instructions"]
---

# Fetch callback API

`POST fetch-markup-language` (webhook)

When the Infobip platform executes a Fetch instruction, it generates a request to the **url** you set up in the 
Fetch instruction. The request carries the call context together with the fetch instruction details.

## Payload

- 60d0e6d5cbcf8382b5a6bad1f38781f71991c7ea63dad2e6ec22ddc8893af51cWebhookCallbackRequest: Markup language callback request object.
  - `callId` string: Unique identifier of the call.
  - `from` string: The phone number of the caller in the [E.164](https://en.wikipedia.org/wiki/E.164) format.
  - `to` string: The phone number of the callee in the [E.164](https://en.wikipedia.org/wiki/E.164) format.
  - `direction` 'INBOUND' | 'OUTBOUND': The direction of the call. Possible values are: INBOUND, OUTBOUND.
  - `endpoint` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CallbackEndpoint: Endpoint involved in the call delivered to the Markup Language callback.
    - `type` 'PHONE' | 'SIP' | 'WEBRTC' | 'VIBER' | 'WHATSAPP' | 'WEBSOCKET', required
  - `startTime` string, date-time: The timestamp when the call started, in ISO-8601 UTC format (yyyy-MM-dd'T'HH:mm:ss.SSSZ).

## Acknowledgement `200`

OK

- Eaaf11bb9830fc826a8597df01bea6f2a14ef6d1ed129a4f6623981d52827778WebhookCallbackResponse: Response from the markup language callback containing instructions to execute.
  - `actions` union[]: Array of markup language instructions defining the call flow.
    - union
      - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CaptureDtmf: CaptureDtmf action collects DTMF input from the caller.
        - `action` 'captureDtmf', required: Action discriminator.
        - `callback` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CaptureDtmfCallbackUrl, required: Callback URL configuration for captureDtmf action.
          - `url` string, required: Callback URL.
          - `method` 'POST' | 'GET': Allowed markup HTTP method.
          - `callOnEmpty` boolean: Whether to invoke the callback URL when no DTMF digits were collected.
        - `maxLength` integer: Maximum number of digits to capture.
        - `timeout` integer: Timeout in seconds waiting for input.
        - `terminator` string: DTMF digit that terminates input.
        - `play` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CapturePlayInstruction: Audio content to play before capturing DTMF input.
          - `content` union, required: Polymorphic content played to the caller.
            - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8FilePlayContent: Plays an audio file previously uploaded to Infobip storage.
              - …
            - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8UrlPlayContent: Plays an audio file fetched from a remote URL.
              - …
            - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8RecordingPlayContent: Plays a previously recorded call file.
              - …
        - `say` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CaptureSayInstruction: Text-to-speech content to say before capturing DTMF input.
          - `text` string, required: Text to be spoken.
          - `language` string: Text language. Must be defined for correct pronunciation. More info about available languages and voices can be found [here](https://www.infobip.com/docs/voice-and-video/reference#text-to-speech-languages). Use value from Abbreviation column in the table.
          - `speechRate` number, double: Speech rate (0.5 to 2.0).
          - `voicePreferences` 49f1996e051117ce119ddfc3e07857856b24a0d3f7351242fd9c4615508a2845VoicePreferences: Voice preferences for text-to-speech.
            - `voiceGender` 'FEMALE' | 'MALE': Voice gender in which text would be synthesized.
            - `voice` string: Voice name in which text would be synthesized. More info about available languages and voices can be found [here](https://www.infobip.com/docs/voice-and-video/reference#available-voices-by-language). Use value from Name column in the table.
      - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CaptureSpeech: CaptureSpeech action captures speech from the caller.
        - `action` 'captureSpeech', required: Action discriminator.
        - `callback` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CallbackUrl, required: Callback URL configuration.
          - `url` string, required: Callback URL.
          - `method` 'POST' | 'GET': Allowed markup HTTP method.
        - `language` string, required: Speech language. Must be defined for correct pronunciation. More info about available languages can be found [here](https://www.infobip.com/docs/voice-and-video/reference#speech-recognition-languages). Use language code column in the table.
        - `timeout` integer: The maximum duration of speech capture.
        - `maxSilence` integer: The silence duration before terminating the speech capture after speech has been detected.
        - `keyPhrases` string[]: Array of key-phrases used for matching capturing speech.
        - `terminateOnKeyPhrase` boolean: Indicates whether speech capture should terminate immediately upon detecting a key phrase. When false, capture proceeds until completion and retains only the first matched key phrase, if any.
        - `customDictionary` string[]: Array of custom words (typically, industry-specific terms) used for improved speech capture.
        - `advancedFormatting` boolean: Toggles enhanced text formatting features like punctuation, proper casing, numeral normalization, and disfluency filtering.
      - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8Dial: Dial action connects the call to one or more endpoints.
        - `action` 'dial', required: Action discriminator.
        - `callback` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CallbackUrl: Callback URL configuration.
          - `url` string, required: Callback URL.
          - `method` 'POST' | 'GET': Allowed markup HTTP method.
        - `endpointCallback` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CallbackUrl: Callback URL configuration.
          - `url` string, required: Callback URL.
          - `method` 'POST' | 'GET': Allowed markup HTTP method.
        - `from` string: Caller ID to use when dialing.
        - `connectTimeout` integer: Connection timeout in seconds.
        - `hangupOn` string: Digit to press to hang up the call.
        - `answerBeforeConnecting` boolean: Whether to answer the call before connecting to endpoints. This value is applied only when `dial` is executed on unanswered call.
        - `recording` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8DialRecording: Recording configuration for dial actions.
          - `filePrefix` string: Prefix for recorded file names.
          - `recordingStatusCallbackUrl` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CallbackUrl: Callback URL configuration.
            - `url` string, required: Callback URL.
            - `method` 'POST' | 'GET': Allowed markup HTTP method.
          - `recordingStatusCallbackEvents` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8RecordingStatusEvent[]: Set of recording status events that trigger the recording status callback.
          - `customData` object: Custom data to attach to recordings.
          - `recordingComposition` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8RecordingComposition: Sets recording composition options.
            - `enabled` boolean, required: Indicates whether to create a single recording of both participants. If set to `true`, both participants are merged into a single audio or video file. Otherwise, both participants will have their own individual audio or video file.
        - `maxDuration` integer: Maximum call duration in seconds.
        - `ringTone` string: URL of the remote ring tone audio file to play while connecting. If it cannot be played, the default ring tone will be played.
        - `endpoints` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CallEndpoint[], required: List of endpoints to dial (1 to 10).
          - `type` 'PHONE' | 'SIP' | 'WEBRTC' | 'VIBER' | 'WHATSAPP' | 'WEBSOCKET'
        - `machineDetection` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8MachineDetection: Machine detection configuration for the dial.
          - `detectionTime` number, double: Detection time in seconds
          - `mode` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8MachineDetectionMode: Machine detection mode configuration
            - `type` 'SYNC' | 'ASYNC'
          - `messageDetection` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8MessageDetection: Message detection configuration
            - `timeout` integer: Timeout in seconds
        - `sendDtmf` string: DTMF digits to send after endpoint answered, but before connecting to the endpoint. `W` and `w` characters are supported to introduce one-second and half-second pause.
      - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8Fetch: Fetch action retrieves markup instructions from a URL at runtime.
        - `action` 'fetch', required: Action discriminator.
        - `url` string, required: URL to fetch markup instructions from.
        - `method` string: HTTP method for the fetch request (POST or GET).
      - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8Hangup: Hangup action terminates the call.
        - `action` 'hangup', required: Action discriminator.
        - `errorCode` string: Error code used to reject a call. This value is applied only when `hangup` is executed on unanswered call.
      - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8Pause: Pause action waits for a specified duration before executing the next instruction.
        - `action` 'pause', required: Action discriminator.
        - `duration` number, double, required: Duration of the pause in seconds (1 to 5).
      - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8Play: Play action plays an audio file or stream to the caller.
        - `action` 'play', required: Action discriminator.
        - `content` union, required: Polymorphic content played to the caller.
          - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8FilePlayContent: Plays an audio file previously uploaded to Infobip storage.
            - `type` 'FILE', required: Content type discriminator.
            - `fileId` string, required: Identifier of the audio file stored in Infobip storage.
          - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8UrlPlayContent: Plays an audio file fetched from a remote URL.
            - `type` 'URL', required: Content type discriminator.
            - `fileUrl` string, required: URL of the remote audio file to play.
            - `cacheDuration` integer: How long, in seconds, the fetched file may be cached (1 to 86400).
          - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8RecordingPlayContent: Plays a previously recorded call file.
            - `type` 'RECORDING', required: Content type discriminator.
            - `fileId` string, required: Identifier of the recording to play.
        - `loopCount` integer: Number of times to loop the content.
      - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8Record: Record action records audio from the call.
        - `action` 'record', required: Action discriminator.
        - `callback` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CallbackUrl, required: Callback URL configuration.
          - `url` string, required: Callback URL.
          - `method` 'POST' | 'GET': Allowed markup HTTP method.
        - `recordingStatusCallbackUrl` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CallbackUrl: Callback URL configuration.
          - `url` string, required: Callback URL.
          - `method` 'POST' | 'GET': Allowed markup HTTP method.
        - `recordingStatusCallbackEvents` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8RecordingStatusEvent[]: Set of recording status events that trigger the recording status callback.
        - `timeout` integer: Maximum recording duration in seconds.
        - `maxSilence` integer: Maximum silence duration in seconds before stopping recording.
        - `escapeDtmf` string: DTMF digit to escape recording.
        - `playBeep` boolean: Whether to play a beep before recording starts.
      - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8Say: Say action converts text to speech and plays it to the caller.
        - `action` 'say', required: Action discriminator.
        - `text` string, required: Text to be spoken.
        - `language` string: Text language. Must be defined for correct pronunciation. More info about available languages and voices can be found [here](https://www.infobip.com/docs/voice-and-video/reference#text-to-speech-languages). Use value from abbreviation column in the table.
        - `speechRate` number, double: Speech rate (0.5 to 2.0).
        - `loopCount` integer: Number of times to repeat the speech.
        - `voicePreferences` 49f1996e051117ce119ddfc3e07857856b24a0d3f7351242fd9c4615508a2845VoicePreferences: Voice preferences for text-to-speech.
          - `voiceGender` 'FEMALE' | 'MALE': Voice gender in which text would be synthesized.
          - `voice` string: Voice name in which text would be synthesized. More info about available languages and voices can be found [here](https://www.infobip.com/docs/voice-and-video/reference#available-voices-by-language). Use value from Name column in the table.
      - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8SendDtmf: SendDtmf action sends DTMF digits on a call.
        - `action` 'sendDtmf', required: Action discriminator.
        - `dtmf` string, required: DTMF digits to send. `W` and `w` characters are supported to introduce one-second and half-second pause.
      - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8StartRecording: StartRecording action starts recording the call.
        - `action` 'startRecording', required: Action discriminator.
        - `recordingStatusCallbackUrl` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CallbackUrl: Callback URL configuration.
          - `url` string, required: Callback URL.
          - `method` 'POST' | 'GET': Allowed markup HTTP method.
        - `recordingStatusCallbackEvents` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8RecordingStatusEvent[]: Set of recording status events that trigger the recording status callback.
        - `playBeep` boolean: Whether to play a beep when recording starts.
      - 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8StopRecording: StopRecording action stops an ongoing recording.
        - `action` 'stopRecording', required: Action discriminator.
        - `callback` 287f18f04e9f129a7bc94ed3ae48e2480e2673b8fdf041ab5125fde9674634b8CallbackUrl, required: Callback URL configuration.
          - `url` string, required: Callback URL.
          - `method` 'POST' | 'GET': Allowed markup HTTP method.

---

[API](https://skmtc.dev/infobip/apis/infobip-openapi-specification.md) - [All operations](https://skmtc.dev/infobip/apis/infobip-openapi-specification/llms.txt) - [OpenAPI document](https://skmtc.dev/infobip/apis/infobip-openapi-specification/revisions/9dcbbaf902de?raw)
