Skip to content

Create and initiate a batch of outbound call sessions

Request

Create a batch of outbound call sessions associated to the project's default service or to the service specified in the serviceId query parameter.

The request body contains a single set of SVAML commands describing the call flow, together with one parameters entry per call session to queue. Placeholders in the commands (prefixed with @) are substituted with the values of the matching parameters entry, so each session can be personalized without changing the command structure.

Queued sessions are initiated asynchronously, paced according to batchOptions.

Security
BasicAuth or SinchOAuth2
Path
projectIdstring, (uuid)(Project ID)required

The ID of the project.

Example:5c5bf2b1-35ae-4825-ab89-457e07bb60e6
Query
serviceIdstring, (uuid)(Service ID)

The ID of the service.

Example:serviceId=6e124178-c29d-46a5-943c-5c2ae544aade
Headers
Idempotency-Keystring, [ 16 .. 128 ] characters

Client-generated idempotency key to safely retry requests. The server uses this key to recognize retries of the same request. If a request with the same key is received within 10 minutes, the server returns the cached response from the original request. Using a random UUID (v4) is strongly recommended.

Bodyapplication/json
commandsArray of objects(SVAML Commands)required

An ordered list of SVAML v2 (Sinch Voice Application Markup Language) commands that describe a call flow. Commands are executed sequentially in the order they are defined.

Blocking vs. non-blocking: Some commands block execution until they complete (pause, webhook, menu, gotoMenu), while others return immediately and run in parallel (dial, messages, amd, answer, hangup, startRecording, stopRecording, bridgeCall, stopMessages). Each command's description specifies its behavior.

Nesting scope: Commands that appear inside event handlers (e.g., dial.events.onAnswer, messages.events.onFinish) form independent sequences and execute in their own context — they are not continuations of the parent sequence.

Nesting depth: A SVAML payload can be nested at most 128 levels deep, counting every JSON object and array from the root of the document. Each command nested inside an event handler adds three levels (the command object, its events object and the handler array), which allows roughly 40 levels of nested commands. A request that exceeds the limit is rejected with 400 Bad Request; a webhook response that exceeds it counts as a failed delivery.

parametersArray of objects, [ 1 .. 10000 ] items(Command Parameter Sets)required

An array of parameter objects that define values for dynamic placeholders in commands. Each object represents a set of parameters for a single queued call.

Use these parameters to inject customer-defined values into your SVAML commands, enabling personalized call flows without modifying the base command structure.

batchOptionsobject(Batch Options)

Options for batch dialing

Example:
{ "maxCps": 5, "ttlSeconds": 90 }
curl -i -X POST \
  -u '<username>:<password>' \
  'https://voice.api.sinch.com/v2/projects/{projectId}/batches' \
  -H 'Content-Type: application/json' \
  -d '{
    "commands": [
      {
        "command": "dial",
        "callName": "origin",
        "from": {
          "type": "PHONE",
          "phone": {
            "number": "+15551234567"
          }
        },
        "to": {
          "type": "PHONE",
          "phone": {
            "number": "@numberB"
          }
        },
        "dialTimeoutDurationSeconds": 30,
        "events": {
          "onAnswer": [
            {
              "command": "messages",
              "messages": [
                {
                  "type": "SAY",
                  "say": {
                    "text": "Hello, this is an automated reminder.",
                    "voiceName": "Emma_3"
                  }
                }
              ]
            }
          ],
          "onHangup": [
            {
              "command": "hangup"
            }
          ]
        }
      }
    ],
    "parameters": [
      {
        "numberB": "+15559876543"
      },
      {
        "numberB": "+15559876544"
      },
      {
        "numberB": "+15559876545"
      }
    ],
    "batchOptions": {
      "maxCps": 10,
      "ttlSeconds": 3600
    }
  }'

Responses

Batch created

Bodyapplication/json
projectIdstring, (uuid)(Project ID)required

The Id of the project associated with the call.

Example:"5c5bf2b1-35ae-4825-ab89-457e07bb60e6"
serviceIdstring, (uuid)(Service ID)required

The ID of the service used.

Example:"6e124178-c29d-46a5-943c-5c2ae544aade"
batchIdstring, (ulid)(Batch ID)required

The ID of the batch.

Example:"01BX5ZZKBKACTAV9WEVGEMMVRC"
Response
{ "projectId": "5c5bf2b1-35ae-4825-ab89-457e07bb60e6", "serviceId": "6e124178-c29d-46a5-943c-5c2ae544aade", "batchId": "01BX5ZZKBKACTAV9WEVGEMMVRC" }