Create a campaign
/campaignsCreates a draft campaign. Add recipients, then start it. Every recipient gets the same message, from the phone number you choose. It’s sent as the connected admin, or as the API key’s name.
Headers
Idempotency-KeyUUIDRequiredA UUID you generate for each write. Retrying with the same key returns the original result for 24 hours. Reusing a key with a different method, path, or body returns 409.
Body parameters
namestringRequiredA name for staff.
bodystringRequiredThe message, up to 1,600 characters. Every recipient gets the same text.
channelsecure, smssecure (the default) or sms, as in Send a message to a patient.
fromstringThe clinic phone number to send from, in E.164 format, like +15125550100. Defaults to the default number: the one set on the API key, or the admin’s own. See List phone numbers.
send_interval_secondsnumberSeconds between messages.
Returns
Returns 201 Created with the Campaign object.
Errors
Failed requests return application/problem+json problem details. The errors specific to this endpoint:
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | The request is malformed, such as invalid JSON. |
| 401 | invalid_token | The API key or access token is missing, expired, or revoked. |
| 403 | insufficient_scope | The credential doesn’t have the scope this endpoint needs. |
| 409 | idempotency_key_reused | The Idempotency-Key was already used with a different request. |
| 409 | idempotency_request_in_progress | A request with this Idempotency-Key is still running. Retry shortly. |
| 422 | validation_failed | A field failed validation. See field_errors. |
| 422 | from_required | There are several phone numbers and no default. Pass from. |
| 429 | rate_limited | Too many requests. Retry after Retry-After seconds. |