Prerequisites
- A server-side
bt_live_key withbatches:writeandbatches:read. - An eligible
agent_idand either uniquecontact_idsor unique inline recipients from the same organization. - Separate nonsecret idempotency keys for creating and starting the batch.
- If scheduling, an RFC 3339
start_atand/or one contiguous dailycalling_windowsupported by the contract.
.mjs or run them in an ESM project. Their top-level await requires ESM, and Node 18 or later provides the built-in fetch they use.
Create the draft
The canonical example uses two existing contacts. Creation returnsstatus: draft and does not begin dialing.
Expected draft
The API returns201 Created with aggregate counts. Save the batch id.
Start the batch
Replacebat_demo_001 with the returned id. Starting immediately returns status: queued; configured scheduled eligibility can return status: scheduled.
202 Accepted. Capacity can keep eligible recipients queued; monitor aggregate counts instead of treating queueing as an error.
Inspect and control
Use the same batchid and preserve the required scope pair.
Pause, resume, and cancel accept an optional
Idempotency-Key. Use one when an action might be retried.