Campaigns

Create a Campaign

Create a call campaign, optionally with its recipients and started, in one request.

Creates a campaign. You can supply the recipients in the same request and start it immediately, so the common case is a single call.

Your app
POST https://api.tryvox.io/v1/voice/accounts/{auth_id}/campaigns
request
TryVox
processing
response
Response 201
returned to your app

Endpoint

POSThttps://api.tryvox.io/v1/voice/accounts/{auth_id}/campaigns

Request body

FieldTypeRequiredDescription
namestringyesYour label for the campaign.
target_typestringyesai_agent or voxml.
target_configobjectyesSee Target config.
fromstringnoCaller ID in E.164. For ai_agent it must be a number bound to the integration.
max_concurrentintegernoCalls to run at once. Capped by your account's channel limit.
calls_per_minutenumbernoDial-rate cap. Capped by your account's CPS limit.
calls_per_secondnumbernoThe same governor in per-second terms. Use one or the other.
complete_within_minutesintegernoFinish within this many minutes of starting. Preferred over complete_by.
complete_bystringnoWall-clock deadline (RFC 3339). Starts counting immediately, even before the campaign runs.
start_atstringnoSchedule the campaign to begin at this time (RFC 3339).
window_startstringnoEarliest local time to dial, HH:MM. Must be set with window_end.
window_endstringnoLatest local time to dial, HH:MM.
timezonestringnoIANA zone for the calling window. Default Asia/Kolkata.
max_attemptsintegernoAttempts per number, 1–10. Default 1 (no redialling).
retry_onarraynoWhich outcomes to retry: no_answer, busy, failed, unknown.
retry_after_secondsintegernoGap before a redial. Minimum 60 when max_attempts > 1. Default 3600.
attempt_timeout_secondsintegernoHow long one attempt may hold a channel with no result. Default 300.
recipientsarraynoRecipients to add immediately. See Add recipients.
startbooleannoStart the campaign as part of this request.

Target config

For an AI agent:

{ "integration_id": "92b881f5-56be-4983-8001-405484f3283b" }
FieldRequiredDescription
integration_idyesA connected, verified AI integration.
agent_idnoOverride the agent bound to the number.

For a VoxML application:

{ "answer_url": "https://example.com/voxml" }
FieldRequiredDescription
answer_urlyesReturns VoxML when the call answers.
hangup_urlnoNotified when the call ends.
fallback_urlnoUsed if answer_url cannot be fetched.
ring_timeoutnoSeconds to ring before giving up.
time_limitnoMaximum call length in seconds.
caller_namenoDisplay name, where the carrier supports CNAM.
status_callback_urlnoNotified on ringing, answered and hangup.
machine_detectionnoAccepted for compatibility; no detection runs today.

Request example

Create, populate and start, in one request:

curl -X POST https://api.tryvox.io/v1/voice/accounts/$TRYVOX_AUTH_ID/campaigns \
  -u $TRYVOX_AUTH_ID:$TRYVOX_AUTH_TOKEN \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "December renewals",
    "target_type": "ai_agent",
    "target_config": { "integration_id": "92b881f5-56be-4983-8001-405484f3283b" },
    "from": "+912250658839",
    "max_concurrent": 3,
    "complete_within_minutes": 120,
    "window_start": "09:00",
    "window_end": "21:00",
    "timezone": "Asia/Kolkata",
    "max_attempts": 2,
    "retry_on": ["no_answer", "busy"],
    "retry_after_seconds": 3600,
    "recipients": [
      { "to": "+919876543210", "client_ref": "CUST-1001", "variables": { "name": "Asha", "due_date": "2026-12-01" } },
      { "to": "+919123456789", "client_ref": "CUST-1002", "variables": { "name": "Rahul", "due_date": "2026-12-05" } }
    ],
    "start": true
  }'

Response

{
  "data": {
    "campaign": {
      "id": "b91963bd-6dd3-430d-9a11-0cc57ada16cb",
      "name": "December renewals",
      "target_type": "ai_agent",
      "status": "running",
      "source": "api",
      "from_number": "+912250658839",
      "max_concurrent": 3,
      "complete_within_seconds": 7200,
      "window_start": "09:00",
      "window_end": "21:00",
      "timezone": "Asia/Kolkata",
      "max_attempts": 2,
      "retry_after_seconds": 3600,
      "retry_on": ["no_answer", "busy"],
      "attempt_timeout_seconds": 300,
      "total_recipients": 2,
      "created_at": "2026-11-19T08:29:35Z"
    },
    "intake": {
      "accepted": 2,
      "duplicates": 0,
      "problems": []
    }
  }
}
FieldDescription
campaign.idUse this for every other campaign call.
campaign.statusdraft unless you passed start.
intake.acceptedRecipients stored.
intake.duplicatesNumbers already present, skipped.
intake.problemsRows rejected, with the reason.

Errors

StatusCodeMeaning
400VALIDATION_FAILEDA field is missing or invalid. The message names it.
400VALIDATION_FAILEDThe deadline cannot be met — the message gives the channels needed and the time it would actually take.
401INVALID_TOKENAuth ID or token is wrong.

A campaign created without start sits in draft until you start it. Creating is always safe: nothing dials until a campaign is started.

On this page