DM Champ Docs

Campaigns API

Deprecated. Campaigns have been replaced by AI Agents (the bot: instructions, knowledge, tools, active hours, follow-ups), Broadcasts (the send: audience, opener, schedule) and Entry Points (which Agent picks up a new conversation). The endpoints on this page keep working for existing integrations, but new integrations should not use them. Every response now carries a Deprecation: true header and a Sunset header with the date after which these endpoints stop answering; we announce that date to every account with API access well ahead of time. See Campaigns Have Moved to Broadcasts & Agents for the mapping.

Where each endpoint went

The Sunset header currently advertises 31 December 2026. After that date every endpoint on this page answers 410 Gone with a message pointing back here. Move each call you make to the row’s replacement before then; the replacements all accept sub_account_id for agencies exactly as the campaign calls do.

Campaigns API call Use instead
GET /campaigns GET /agents for the bots, GET /broadcasts for the sends.
GET /campaigns/{campaignId} GET /agents/{agentId} or GET /broadcasts/{broadcastId}.
POST /campaigns (Incoming / Combined) POST /agents, then PUT /entry-points/channel-defaults so new conversations reach it.
POST /campaigns (Outgoing) POST /broadcasts with the Agent that should answer replies.
PUT /campaigns/{campaignId} PUT /agents/{agentId} for bot fields (bot.*, anthropic_model, follow-ups), PUT /broadcasts/{broadcastId} for audience, opener and schedule.
PUT /campaigns/{campaignId} with status PATCH /agents/{agentId}/active to pause or resume the bot; pause and resume or launch on the broadcast.
PATCH /campaigns/{campaignId}/enabled PATCH /agents/{agentId}/active.
PATCH /campaigns/{campaignId}/archived Pause the Agent, or DELETE /agents/{agentId} when it is no longer needed.
DELETE /campaigns/{campaignId} DELETE /agents/{agentId} or DELETE /broadcasts/{broadcastId}.
POST /campaigns/{campaignId}/duplicate POST /agents/{agentId}/duplicate or POST /broadcasts/{broadcastId}/duplicate.
POST /subaccounts/campaigns/copy POST /subaccounts/agents/copy.
PUT /campaigns/{campaignId}/bot-config PUT /agents/{agentId}/bot-config.
PUT /campaigns/{campaignId}/active-hours PUT /agents/{agentId}/active-hours.
/campaigns/{campaignId}/custom-functions /agents/{agentId}/custom-functions.
/campaigns/{campaignId}/kb-sources /agents/{agentId}/kb-sources.
/campaigns/{campaignId}/mcp-servers /agents/{agentId}/mcp-servers.
/campaigns/{campaignId}/media-library /agents/{agentId}/media-library.
/campaigns/{campaignId}/tags and tags on the campaign /agents/{agentId}/tags.
POST /campaigns/{campaignId}/channels, /incoming-routing, /reactivate, /stop-incoming PUT /entry-points/channel-defaults; one Agent per channel, no conflicts to stop.
Comment-to-DM settings on the campaign A comment rule via POST /agents/{agentId}/entry-points.
POST /campaigns/{campaignId}/optimize POST /agents/{agentId}/optimize.
POST /campaigns/{campaignId}/contacts/{contactId}/assign POST /contacts/{contactId}/assign-agent to hand a conversation to an Agent. To send a campaign’s approved template to one contact, bring it into the library once with POST /whatsapp-templates/from-campaign, then POST /whatsapp-templates/{templateId}/send-to-contact.
DELETE /campaigns/{campaignId}/contacts/{contactId} POST /contacts/{contactId}/assign-agent with {"agentId": null} clears the assignment so the conversation goes back to your team inbox, or pass another Agent’s id to move it there.
POST /whatsapp-templates/campaign/{campaignId} POST /broadcasts/{broadcastId}/template, or create it in the library and select it on the broadcast.
GET /campaigns/{campaignId}/template-cost-estimate, /sms-cost-estimate POST /broadcasts/{broadcastId}/estimate-cost.
GET /campaigns/{campaignId}/limits/*, GET /campaigns/limits/* No separate call. Launching a broadcast refuses with the reason when a limit is in the way.
GET /campaigns/stats/totals GET /agents/stats/totals: the same totals keyed by Agent id.
/campaigns/{campaignId}/try-out/* The same calls under /agents/{agentId}/try-out/*: POST .../try-out/test-message, GET .../try-out/messages, POST .../try-out/reset, or the editor’s Test step in the dashboard.
POST /campaigns/{campaignId}/template-generation POST /agents/{agentId}/template-generation.

How campaigns work

A campaign bundles everything the AI bot needs to talk to your contacts: its instructions, the channels it runs on, its active hours, and its follow-up behaviour. The calls below let existing integrations keep reading and changing campaigns until the sunset date.

All paths are relative to https://api.dmchamp.com/v1. Every request needs your API key: see API Access and Authentication. Without API access on your plan, requests get a 403. The examples use the ?apiKey=YOUR_API_KEY query form; the X-API-Key header works the same everywhere. Shared error codes are in Errors & Pagination. Field-level detail for every call is in the API Reference.

Campaign types

When you create a campaign you pick one of these types:

Type What it’s for
Incoming from Unknown Contacts The bot replies to people who message you for the first time.
Outgoing The bot starts conversations with contacts you add to the campaign.
Keywords Inert, do not use. Still accepted for backwards compatibility, but invisible to inbound routing on every channel, and nothing reads its trigger keywords. Use an Entry Point of type Keyword on an AI Agent instead.
Combined A mix of incoming and outgoing behaviour.

Casing doesn’t matter. type, status, booking_provider, first_response_mode, bot.anthropic_model and bot.ai_speed accept any casing ("live", "Live" and "LIVE" are the same) and are stored in their canonical form, which is what you read back. The one exception is the pause pair below: an ambiguous "PAUSED" is rejected with a 400.

The two pause states

Status Who writes it What it means
Paused The platform’s own safety checks (low engagement, repeated send errors, a limit hit) and the newer Agents and Broadcasts surfaces The campaign is held. A scheduled sweep can lift a safety pause automatically once the reason clears.
paused The dashboard’s Pause button, paired with resumed on Resume A person paused it by hand. Scheduled sends are torn down and rebuilt on resume.

Both stop the campaign: inbound routing only runs while the status is exactly Live. From the API, use Paused to pause and Live to resume. The lower-case pair exists for the dashboard button.

Neither is what happens when the AI stops replying inside one conversation. That is a per-contact switch, is_bot_active on the contact, set when a human takes over, when the contact opts out, or when the AI concludes the chat. The campaign’s status is untouched and every other conversation keeps running. See pause or resume the AI for one contact.

Creating a campaign does not decide who answers a channel. Routing is handled by Entry Points on an AI Agent. Each channel has one channel-default Entry Point naming the Agent that answers new, unknown contacts on it: set it with PUT /entry-points/channel-defaults, check whether routing is live for the account with GET /entry-points/routing-status, clear it with DELETE /entry-points/channel-defaults. POST /channels/campaign still writes the legacy per-channel campaign routing map, but that map is no longer consulted for inbound routing on any account; it is kept for rollback only. Do not build against it. See Route a channel to a campaign.

Endpoints

Task Method + path Explorer
List campaigns GET /campaigns Open in API Reference
Get a campaign GET /campaigns/{campaignId} Open in API Reference
Create a campaign POST /campaigns Open in API Reference
Update a campaign (also sets tags and Comment-to-DM) PUT /campaigns/{campaignId} Open in API Reference
Delete a campaign DELETE /campaigns/{campaignId} Open in API Reference
Duplicate a campaign POST /campaigns/{campaignId}/duplicate Open in API Reference
Enable or disable PATCH /campaigns/{campaignId}/enabled Open in API Reference
Archive or restore PATCH /campaigns/{campaignId}/archived Open in API Reference
Merge bot settings PUT /campaigns/{campaignId}/bot-config Open in API Reference
Set bot active hours PUT /campaigns/{campaignId}/active-hours Open in API Reference
List linked custom functions GET /campaigns/{campaignId}/custom-functions Open in API Reference
Link a custom function POST /campaigns/{campaignId}/custom-functions Open in API Reference
Unlink a custom function DELETE /campaigns/{campaignId}/custom-functions/{customFunctionId} Open in API Reference
Link a knowledge-base source POST /campaigns/{campaignId}/kb-sources Open in API Reference
Unlink a knowledge-base source DELETE /campaigns/{campaignId}/kb-sources/{kbSourceId} Open in API Reference
Link an MCP server POST /campaigns/{campaignId}/mcp-servers Open in API Reference
Unlink an MCP server DELETE /campaigns/{campaignId}/mcp-servers/{mcpServerId} Open in API Reference
List the media library GET /campaigns/{campaignId}/media-library Open in API Reference
Upload a media item POST /campaigns/{campaignId}/media-library Open in API Reference
Update a media item PATCH /campaigns/{campaignId}/media-library/{itemId} Open in API Reference
Delete a media item DELETE /campaigns/{campaignId}/media-library/{itemId} Open in API Reference
Add one tag POST /campaigns/{campaignId}/tags Open in API Reference
Update one tag PUT /campaigns/{campaignId}/tags/{tagId} Open in API Reference
Remove one tag DELETE /campaigns/{campaignId}/tags/{tagId} Open in API Reference
Toggle channels POST /campaigns/{campaignId}/channels Open in API Reference
Optimize with AI POST /campaigns/{campaignId}/optimize Open in API Reference
Assign a contact POST /campaigns/{campaignId}/contacts/{contactId}/assign Open in API Reference
Remove a contact DELETE /campaigns/{campaignId}/contacts/{contactId} Open in API Reference
Assign to incoming channels POST /campaigns/{campaignId}/incoming-routing Open in API Reference
Clear incoming routing DELETE /campaigns/{campaignId}/incoming-routing Open in API Reference
Reactivate a dormant campaign POST /campaigns/{campaignId}/reactivate Open in API Reference
Stop a conflicting incoming campaign POST /campaigns/{campaignId}/stop-incoming Open in API Reference
WhatsApp template cost estimate GET /campaigns/{campaignId}/template-cost-estimate Open in API Reference
SMS cost estimate GET /campaigns/{campaignId}/sms-cost-estimate Open in API Reference
AI-credit messaging limit check GET /campaigns/{campaignId}/limits/ai-credit-messaging Open in API Reference
Daily messaging limit check GET /campaigns/{campaignId}/limits/messaging Open in API Reference
Monthly campaign-creation limit check GET /campaigns/limits/campaigns Open in API Reference
Contact limit check GET /campaigns/limits/contacts Open in API Reference
Sent and replied totals GET /campaigns/stats/totals Open in API Reference
Generate follow-up templates POST /campaigns/{campaignId}/template-generation Open in API Reference
Submit the opening template POST /whatsapp-templates/campaign/{campaignId} Open in API Reference
Bring a campaign’s template into the library POST /whatsapp-templates/from-campaign Open in API Reference
Legacy channel routing map (rollback only) POST /channels/campaign Open in API Reference
Playground (see Test a campaign in the playground) /campaigns/{campaignId}/try-out/* Not in the API Reference

Agencies: copy a campaign into a sub-account with POST /subaccounts/campaigns/copy (Open in API Reference), described below.

Create and update a campaign

name and type are required on create; any other campaign field can go in the same request. The owner and creation time are set for you. Besides the fields in the API Reference, create and update also take list_id (the contact list), event_id (the event type the AI may book) or event_ids (an ordered array, the first is the default; send one or the other, not both; an empty array unlinks them all), and on update contact_ids (the campaign’s contacts) and tags. Knowledge-base entries go through the FAQs API, not here.

curl -X PUT "https://api.dmchamp.com/v1/campaigns/NBCXrhqGPSFsd6MV7pRo?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Spring Promo v2", "bot": {"instructions": "Greet warmly and ask about their goals."}}'

Good to know:

  • PUT is the only general update. It is partial: send only what changes. There is no PATCH /campaigns/{campaignId}; the two PATCH routes are the narrow enable and archive toggles.
  • One unknown key rejects the whole request. The body is checked against an allow-list. user, id and created_at are locked, and any unrecognised key returns 400 with nothing in that request written.
  • Bot fields merge. Dotted keys ("bot.instructions") and a nested bot object both write leaf by leaf; fields you leave out keep their values. The same goes for test_bot, frequency and follow_up_config. To replace an object wholesale send bot_replace (or test_bot_replace) with the complete object. A replace and a merge of the same object in one request is a 400.
  • API writes to bot.* go live at once. The dashboard saves edits as a draft in test_bot until the client clicks Publish, so an API read of bot always shows what the AI uses right now.
  • PUT /campaigns/{campaignId}/bot-config is the safe way to tweak a few bot settings: each field merges into the existing config. Field keys may only use letters, numbers, underscores and hyphens, and extra bot fields beyond the documented ones are stored as sent. anthropic_model values max and mini only take effect on accounts eligible for those tiers; economy is deprecated.
  • ai_mode on an Agent-backed campaign reflects the Agent. Reads return the Agent’s Active toggle, the switch that actually decides whether the AI replies. Writing ai_mode there is accepted but changes nothing you read back; flip the Agent’s Active toggle instead. On classic campaigns without an Agent, ai_mode reads and writes the stored value.
  • Active hours: availability is keyed monday to sunday (any other key is a 400); days you leave out are unchanged. Each day holds one window or an array of windows, each with start_time and end_time in 24-hour HH:MM. Outside the windows the bot does not reply automatically.
  • Duplicate copies within one account. The copy starts disabled, gets a (copy) suffix, and never sends until you enable it.
  • Disable stops a campaign engaging contacts but keeps its configuration. Archive hides it from the default list (pass archived=true on the list call to include it) and keeps all data. Delete is permanent; archive if you might need it again.
  • A campaign owned by another account returns 404 Campaign not found, not 403, so you cannot tell whether an ID exists elsewhere.
  • Linking a custom function, knowledge-base source or MCP server that is already linked, unlinking one that is not, or deleting a media item that is already gone is a no-op.
  • Media library: media_url is a signed URL captured at upload time and may already be expired when you read it back; the dashboard re-signs it on demand. Updating an item edits only its metadata; to replace the file, delete the item and upload a new one. On update, max_sends_per_conversation takes null to clear the cap.
  • Toggle channels changes enabled_channels without resending the array, which is safer when something else may be editing the campaign. Send channel + action ("add" or "remove") or the batch form add / remove arrays, not both. Valid channels: whatsapp, whatsapp_web, sms, instagram, messenger, facebook, chat_widget, custom_channel, imessage, telegram, instagram_private, line, viber, tiktok, email, linkedin, skool. It only changes which channels the campaign advertises, not who answers them.

Copy a campaign into a sub-account (agencies)

POST /subaccounts/campaigns/copy copies a campaign from your agency account (or one of your sub-accounts) into another sub-account: the way to start every new client from one master template campaign. Unlike duplicate, it crosses accounts and deep-copies what the campaign depends on, so the copy works on its own.

curl -X POST "https://api.dmchamp.com/v1/subaccounts/campaigns/copy?apiKey=YOUR_AGENCY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"campaignId": "TEMPLATE_CAMPAIGN_ID", "targetUserId": "abc123def456", "newName": "Inbound Instagram Leads", "copyFaqs": true}'

The new campaign’s id comes back in data.newCampaignId.

  • What carries over: bot configuration, instructions and settings; FAQs and knowledge-base sources with their uploaded files when copyFaqs is on (default true); custom functions and MCP servers when copyCustomFunctions is on (default false); the media library. newName defaults to the source name with a (copy) suffix.
  • What deliberately does not: the source account’s WhatsApp templates (approved against one account, so they must be re-submitted), connected Instagram or Facebook posts, per-tag webhook URLs, contacts and lists, and all usage history.
  • It takes targetUserId, not sub_account_id. The campaign’s owner is the source and targetUserId the destination, so the usual sub_account_id is not used. Authenticate with your agency key; a non-agency key gets a 403. Source and target must both belong to your agency.
  • The copy lands as a Draft with no channel routing, so it never messages a client’s contacts before you are ready. To finish: PUT /campaigns/{newCampaignId} with { "status": "Live", "sub_account_id": "abc123def456" }, then POST /channels/campaign with { "campaign_id": "...", "channels": ["instagram"], "sub_account_id": "abc123def456" }.
  • If any step of the copy fails, everything it created is rolled back.

Campaign tags

A campaign tag is a label the bot applies to a contact during a conversation: hot-lead, not-interested, booked-a-call. Each tag has a name (what the bot applies and what you match on later, so keep it short and stable), a description (the instruction for when to apply it; “the person confirms they joined the community” gets used, “hot lead” does not), an optional webhook (a URL that receives a POST the moment the tag lands on a contact) and an optional tag_id (links the entry to an existing tag in your account, so the single-tag calls can address it).

Set the whole set with PUT /campaigns/{campaignId} and a tags array, the same thing the dashboard’s Tags tab does on save:

curl -X PUT "https://api.dmchamp.com/v1/campaigns/NBCXrhqGPSFsd6MV7pRo?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tags": [
    {"name": "hot-lead", "description": "The person confirms they want to buy, or asks how to get started right away.", "webhook": "https://example.com/hooks/campaign-events"},
    {"name": "not-interested", "description": "The person declines the offer or says they are not a fit."}
  ]}'
  • Tags replace, they don’t merge. Send the complete array every time: a tag you leave out is deleted, and [] clears them all. Read them back with GET /campaigns/{campaignId}.
  • Tag names must be unique within a campaign. The bot applies tags by name, so two entries with one name have no defined winner.
  • POST /campaigns/{campaignId}/tags appends one tag without resending the rest. Posting the exact same tag twice does nothing the second time; posting the same tag_id with a different name or description appends a second entry instead of editing the first.
  • The single-tag PUT and DELETE address an entry by tag_id, so they only work on tags created with one; change the others with the whole-array PUT. A tagId not on the campaign returns 404 with "Tag not found in campaign tags".

Comment-to-DM (Instagram and Facebook)

Comment-to-DM turns a comment on one of your posts into a private conversation: someone comments, the bot sends them a DM, and the campaign takes it from there. It is configured entirely through the campaign object with PUT /campaigns/{campaignId}. Connect the Facebook Page first: see Channel Connection.

curl -X PUT "https://api.dmchamp.com/v1/campaigns/NBCXrhqGPSFsd6MV7pRo?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "Live",
    "monitor_instagram_posts": true,
    "instagram_comment_delay_minutes": 2,
    "first_response_mode": "exact_text",
    "first_response_exact_text": "Hey! Sending the details over now.",
    "first_response_exact_text_variants": ["Hi there, here are the details you asked for."],
    "public_comment_reply_exact_text": "Just sent you a DM."
  }'
Field Type Description
monitor_instagram_posts boolean Watch every Instagram post on the connected page.
instagram_post_ids string[] Watch only these Instagram posts. Leave unset when monitor_instagram_posts is on.
instagram_comment_delay_minutes number Wait this many minutes after a comment before sending the DM.
monitor_facebook_posts boolean Watch every Facebook post on the connected page.
facebook_post_ids string[] Watch only these Facebook posts.
facebook_comment_delay_minutes number Delay before the DM, in minutes.
public_comment_reply_instructions string Guidance for the visible reply on the comment itself. Overrides the default “check your DMs” wording.
first_response_mode string "ai" (default) generates the first DM and the public reply. "exact_text" sends your wording verbatim, with no AI generation and no credit charge.
first_response_exact_text string The verbatim first DM in "exact_text" mode. Required for that mode to take effect.
first_response_exact_text_variants string[] Extra wordings for the first DM; one is picked at random per send, so repeated DMs are not identical.
public_comment_reply_exact_text string The verbatim public reply in "exact_text" mode. Leave blank to skip the public reply and send only the DM.
public_comment_reply_exact_text_variants string[] Extra wordings for the public reply.
monitor_instagram_followers boolean Treat a new follower as a trigger and send an opening DM (Instagram personal accounts).
follower_outreach_instructions string Guidance for that new-follower opening DM.
respond_to_instagram_story_replies boolean Whether the AI answers replies to your Instagram Stories. Default true. false lands Story replies in the chat (with the Story attached) without an AI reply. Live setting, not part of the draft, so no publishing needed.
respond_to_instagram_shares boolean Whether the AI answers a post or Reel the contact shares into the chat with no text of their own. Absent or null (the default) keeps the AI quiet and the chat shows a note saying so; true makes it reply. A share with the contact’s own text is always answered. Story mentions are not affected. Live setting, not part of the draft.
respond_to_instagram_story_mentions boolean Whether the AI answers when someone tags your business in their own Story. Default true. false lands the mention in the chat (with the Story attached) without an AI reply; automations still run. Live setting, not part of the draft.
  • The campaign must be Live (any casing). Any other status silently disables comment monitoring, and an invented one like "Active" is rejected with a 400. Valid statuses include Draft, Pending Approval, Scheduled, Live, Paused, Completed, Sent and Failed.
  • Sending null removes the field so the bot falls back to its default, for instagram_post_ids, facebook_post_ids, instagram_comment_delay_minutes, facebook_comment_delay_minutes, public_comment_reply_instructions, follower_outreach_instructions, first_response_exact_text, first_response_exact_text_variants, public_comment_reply_exact_text and public_comment_reply_exact_text_variants.
  • The visible reply on the comment needs the comment-reply feature on your plan. Without it the DM still sends and the public reply is skipped.

Contacts on a campaign

Assign (POST /campaigns/{campaignId}/contacts/{contactId}/assign) puts an existing contact into a campaign. sendOpeningMessage: true sends the campaign’s opening message right away (the approved WhatsApp template on a WhatsApp campaign); triggerAIResponse: true lets the AI write its own first message instead. Both default to false. This was the way to send a campaign’s approved template to one contact, because that template belongs to the campaign and is not in the Templates API library or sendable through /whatsapp-templates/send. Credits: on WhatsApp the opening message is charged like any template send, priced by the recipient’s country and the template’s category; on other channels it is a normal outgoing message.

Remove a contact from a campaign

DELETE /campaigns/{campaignId}/contacts/{contactId} takes a contact off a campaign: it clears the contact’s current campaign when it is this one, removes the campaign from the contact’s history, and, if the campaign still exists, removes the contact from its contact list. Nothing is sent, and the contact’s assigned AI agent, AI on/off state and list memberships stay as they are. From the next message on, the contact is answered by its assigned AI agent, or lands in your team inbox if it has none.

curl -X DELETE "https://api.dmchamp.com/v1/campaigns/NBCXrhqGPSFsd6MV7pRo/contacts/contact_abc123?apiKey=YOUR_API_KEY"
{ "success": true, "data": { "contactId": "contact_abc123", "campaignId": "NBCXrhqGPSFsd6MV7pRo", "clearedCurrentCampaign": true, "removedFromCampaigns": true, "campaignExists": false } }

It also works for a campaign that has already been deleted, which is how you clean a stale campaign reference off a contact. Deleting a campaign now removes it from every contact by itself; this call is for references left from before that, or for a campaign that is still running. It is safe to repeat: a contact never on the campaign returns 200 with every flag false.

Incoming routing (legacy)

These calls manage which campaign answers new, unknown contacts on a channel the older way. Prefer Entry Points for anything new; these stay useful for campaigns routed the old way and for resolving a channel conflict between two incoming campaigns.

  • Assign returns channels (the ones actually routed) and failed. If every requested channel fails, the request fails.
  • Clear takes an optional channelToUnassign; leave it out to clear every channel the campaign answers.
  • Reactivate brings a campaign back from Ended, Completed, Paused or Draft and re-claims its channels. Only Incoming from Unknown Contacts and Combined campaigns; an already Live campaign is a success with nothing to do; any other type or status is a 400. A channel held by another campaign’s agent comes back in channelsBlockedByConflict instead of failing the call.
  • Stop-incoming frees this campaign’s channels from whichever OTHER campaign holds them, so this one can claim them next: the REST version of what the dashboard does when you launch an incoming campaign into a channel someone else answers. released_channels is empty when this campaign already owns every channel it advertises.

Optimize, estimates, limits and totals

  • Optimize with AI runs the dashboard’s Optimize / thumbs-down rewrite: send user_feedback or thumbs_down_feedback (one is required, plus optional thumbs_down_message). It stages the result as a draft. Poll GET /campaigns/{campaignId} and watch test_bot.status: "Optimizing" at once, back to "Draft" when the rewrite lands in test_bot; then review and publish it in the dashboard. A 409 means an optimization is already running. It costs credits like any AI operation.
  • WhatsApp template cost estimate: billing_mode is "credits" on the managed WhatsApp lane. Where Meta bills your own WhatsApp Business Account directly, costPerContact, subtotal and totalTemplateCost come back null (never 0, which would read as free).
  • SMS cost estimate: SMS always goes through your own Twilio account (see SMS provider), so estimatedCostUsd estimates that Twilio bill, not a credit charge.
  • Limit checks let you check before launching instead of finding out from a failed send. The two campaign-scoped checks (AI-credit messaging limit, daily messaging limit) answer 400 with the reason in error when launching or scheduling would exceed the limit. The account-scoped checks report whether you have hit your plan’s monthly campaign-creation limit or contact limit.
  • Stat totals return sent and replied totals for every campaign AND every AI agent over a trailing window (days, 1 to 365, default 90), the same numbers the campaign list shows. byAgent is its own roll-up, not a sum of byCampaign: an Agent-native account’s traffic can carry no campaign at all.

Test a campaign in the playground

The playground holds a conversation with a campaign’s bot without a real channel or contact: the same sandbox as the dashboard’s try-out panel. These calls are not in the API Reference; the Agent versions are (see the table at the top). The flow: create a hidden test contact, record the visitor’s message, ask the bot to reply, then poll the campaign. Replies arrive asynchronously in test_messages on the campaign, not in the response body.

Playground runs over the API cost credits. A test conversation started with an API key is charged at the normal AI-message rate and appears in your usage history as a regular entry. Testing from the dashboard stays free.

Call What it does
POST /campaigns/{campaignId}/try-out/contact Creates the hidden test contact and links it. Optional first_name, last_name, email, phone; anything left out falls back to a sample identity (John Doe).
POST /campaigns/{campaignId}/try-out/messages Appends to the test thread. messages (required, max 200), each with body and direction ("inbound" visitor, "outbound" bot), optional timestamp (ISO-8601 or epoch ms), role, name. Optional ignoreCounter (integer) resets the ignore counter in the same write. Send the visitor’s message here first so the bot reads it in the history.
POST /campaigns/{campaignId}/try-out/test-message Sends message (the visitor’s latest text) to the AI. "Published" means it went to the AI; "Ignored" means a newer test message superseded it. A rapid burst folds into one reply about four seconds after the last message, so this call takes a few seconds to return.
GET /campaigns/{campaignId} Read the reply: poll until a new outbound entry appears in test_messages.
POST /campaigns/{campaignId}/try-out/reset Clears the whole sandbox: deletes the test contact, wipes test_messages, releases the bot’s response locks. Use between runs.
DELETE /campaigns/{campaignId}/try-out/contact Deletes just the test contact and unlinks it, keeping test_messages. Succeeds even when no contact is linked.
POST /campaigns/{campaignId}/try-out/transfer Starts a fresh playground seeded with an existing conversation in one request: replaces the test contact and overwrites test_messages. Takes first_name, last_name, messages (may be empty) and ignoreCounter. Prefer it over delete, create and append, which triples your rate-limit spend.
POST /campaigns/{campaignId}/try-out/messages/replace Overwrites test_messages wholesale, for truncating or rewinding a thread.
POST /campaigns/{campaignId}/try-out/contact/reset-ignore-counter Resets only the test contact’s ignore counter, for redo and repeat flows.

Errors

Besides the shared codes in Errors & Pagination: 400 for a missing or invalid field (a bad type, a non-boolean enabled, an unknown weekday key, an unknown body key), for a limit check when the limit would be exceeded, and for reactivate on an unsupported type or status; 404 when the campaign does not exist or belongs to another account; 409 when an optimization is already running.