Create SMS campaign
Creates an SMS campaign with its contacts in one call. No channel field is needed — this URL is the SMS channel.
The workspace must have SMS campaigns enabled (an organization owner turns this on under Organization → Workspaces), or the request is rejected with 403. Contacts on the workspace's unsubscribe register are dropped before any row is written; the count comes back as sms_opted_out_excluded. If every contact is opted out the request fails with 400.
The campaign lands in ready when it can actually send — a composed message_body (or, with sms_message_source: "flow", an attached automation) plus sms_from_number and sms_carrier — and in draft otherwise, so setup can be finished in the app. Nothing is sent until the campaign is started from the app.
message_body supports {{first_name}}, {{last_name}}, {{email}}, {{company}}, {{phone_number}} and any key supplied in a contact's custom_variables.
Authorization: Bearer <api_key>. Create a key in the Inspra dashboard under Workspace Settings → API Keys.Body application/json
- channelstringoptionalSelects this body on
POST /campaigns. Implied — and ignored if sent — onPOST /sms-campaigns.sms - namestring1–100 charsrequired
- descriptionstring0–500 charsoptional
- sms_modestringoptionalRecorded, not yet acted on — reply handling ships with SMS delivery.Default
"one_way"one_wayconversational - sms_message_sourcestringoptional
customsendsmessage_body.flowruns the Automations flow named bysms_flow_id.Default"custom"customflow - message_bodystring0–1600 charsoptionalThe message to send. **Required when
sms_message_source=custom.** Messages over 1600 characters cannot be delivered reliably. - sms_flow_idstringnullableuuidoptionalAutomations flow that drives the campaign. **Required when
sms_message_source=flow**, and must belong to this workspace. - sms_carrierstringnullableoptionalSending carrier. Required (with
sms_from_number) for the campaign to be startable.twilioatmictouchsms - sms_from_numberstringnullableoptionalSending number. Required (with
sms_carrier) for the campaign to be startable. - sms_rate_per_minuteinteger1–600optionalSend throttle, messages per minute.Default
60 - recipientsobject[]requiredContacts to message. At least one is required.
6 fields
- phone_numberstring1–∞ charsrequired
- first_namestringnullableoptional
- last_namestringnullableoptional
- emailstringnullableoptional
- companystringnullableoptional
- custom_variablesobjectoptionalDefault
{}
- csv_column_headersstring[]optionalDefault
[] - schedule_typestringoptionalDefault
"immediate"immediatescheduled - scheduled_start_atstringnullableoptional
- scheduled_expires_atstringnullableoptional
- business_hours_configobjectnullableoptional
- holidays_configobjectnullableoptional
Response 201 Created
Created. Includes sms_opted_out_excluded.
- idstringoptionalStable UUID of the campaign.
- workspace_idstringoptionalUUID of the owning workspace.
- agent_idstringnullableoptionalUUID of the agent that places calls for this campaign.
- namestringoptionalHuman-readable campaign name. 1-255 chars.
- descriptionstringnullableoptionalOptional free-form notes.
- statusstringnullableoptionalRaw DB status. One of
draft,ready,scheduled,active,paused,completed,cancelled,expired. Prefereffective_statusfor UI display. - effective_statusstringnullableoptionalUser-visible status. Equals
statusexcept when the campaign has a non-terminal status andscheduled_expires_athas passed — thenexpiredis returned. Possible values:draft,ready,scheduled,active,paused,completed,cancelled,expired. - schedule_typestringnullableoptionalOne of
immediate(start when activated) orscheduled(wait forscheduled_start_at). - scheduled_start_atstringnullableoptionalISO 8601 UTC timestamp the campaign is scheduled to start. Null for immediate campaigns.
- scheduled_expires_atstringnullableoptionalISO 8601 UTC timestamp after which the campaign is considered
expired. Null = no expiry. - business_hours_onlybooleannullableoptionalWhen true, calls only place within
business_hours_config. See CampaignCreate for the config shape. - timezonestringnullableoptionalIANA Time Zone for business-hours evaluation (e.g.
America/New_York,Australia/Melbourne). - total_recipientsintegernullableoptionalCount of recipients loaded into the campaign.
- pending_callsintegernullableoptionalRecipients not yet called.
- completed_callsintegernullableoptionalRecipients whose call lifecycle finished (any outcome).
- successful_callsintegernullableoptionalCalls where the recipient answered and the analyser marked a positive outcome.
- failed_callsintegernullableoptionalCalls that exhausted retries without a positive outcome (busy, no-answer, declined, etc.).
- created_atstringnullableoptionalISO 8601 UTC timestamp when the campaign was created.
- updated_atstringnullableoptionalISO 8601 UTC timestamp of the last update.
- started_atstringnullableoptionalISO 8601 UTC timestamp the campaign first transitioned to
active. - completed_atstringnullableoptionalISO 8601 UTC timestamp the campaign reached a terminal state. Null while in progress.
- channelstringnullableoptional
call(default) orsms. Determines which engine runs the campaign; SMS campaigns carry thesms_*fields below. - business_hours_configobjectnullableoptionalResolved business-hours config as stored — always in the
{enabled, timezone, schedule, batchConcurrency}form, withschedulekeyed by full day names holding arrays of windows. Adays-shaped request body is normalised into this on write. - holidays_configobjectnullableoptionalHoliday calendar (
{country, holidays[]}) — dialling is skipped on enabled dates. - batch_concurrencyintegernullableoptionalRecipients dispatched per batch wave (1-40).
- sip_trunk_idstringnullableoptionalUUID of the SIP trunk this campaign dials over. Null = provider default routing.
- cli_modestringnullableoptional
default(single agent-derived caller ID) orgroup(rotate across the numbers incli_group_config). - cli_group_configobject[]nullableoptionalCaller-ID rotation spec used when
cli_mode=group. Each entry allocatescountrecipients to one number on the trunk.3 fields
- phoneNumberIdstringoptional
- phoneE164stringoptional
- countintegeroptional
- ivr_enabledbooleannullableoptionalWhen true, outbound calls carry IVR-navigation metadata to the provider.
- call_screen_enabledbooleannullableoptionalWhen true, outbound calls are sent with call-screening handling enabled.
- double_dialbooleannullableoptionalWhen true, an unanswered number is dialled a second time immediately.
- csv_column_headersstring[]nullableoptionalColumn headers of the source import, retained for display and mapping.
- sms_modestringnullableoptionalSMS campaigns only.
one_wayorconversational. - sms_message_sourcestringnullableoptionalSMS campaigns only.
custom(usessms_message_body) orflow(usessms_flow_id). - sms_message_bodystringnullableoptionalSMS campaigns only. The composed message template.
- sms_flow_idstringnullableoptionalSMS campaigns only. UUID of the Automations flow that drives the campaign.
- sms_carrierstringnullableoptionalSMS campaigns only.
twilio,atmicortouchsms. - sms_from_numberstringnullableoptionalSMS campaigns only. Sending number.
- sms_rate_per_minuteintegernullableoptionalSMS campaigns only. Send throttle, 1-600 messages per minute.
- agentobjectoptionalCompact snapshot of the assigned agent (id, name, provider, is_active). Read-only.
4 fields
- idstringoptional
- namestringoptional
- providerstringoptional
- is_activebooleanoptional
- sms_opted_out_excludedintegeroptionalNumber of supplied contacts dropped because they are on the workspace's unsubscribe register. Those contacts were never written as recipients.
Errors
- 400Bad RequestValidation failed / malformed request.
- 401UnauthorizedMissing, malformed, or invalid API key.
- 403ForbiddenWorkspace unavailable, suspended, or paywalled.
- 429Too Many RequestsWorkspace request limit exceeded; shared across all its API keys.