Unitpost SMS templates API
Reusable plain-text SMS bodies with per-recipient `{{variables}}`. Draft → published like email templates; only published templates can be sent by an SMS campaign.
Reusable plain-text SMS bodies with per-recipient `{{variables}}`. Draft → published like email templates; only published templates can be sent by an SMS campaign.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/unitpost-com:unitpost-com-sms-templates-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Unitpost SMS templates API
version: v1
description: 'Public, versioned API for sending email and SMS and managing contacts, segments, campaigns, templates, domains, and webhooks. SMS is included on paid plans; on the free plan `POST /sms` returns `403` with `limit_reached`. Authenticate every request with an API key: `Authorization: Bearer `. A `User-Agent` header is required. Requests are scoped to the workspace that owns the key and are rate-limited per workspace. List endpoints are cursor-paginated via `limit`/`after`/`before` and return a `{ object: "list", has_more, data }` envelope. Register webhook endpoints to receive events: each create returns a `signing_secret` (`whsec_…`) exactly once. Every delivery is **svix-compatible**: it carries `svix-id`, `svix-timestamp`, and `svix-signature` (`v1,`) headers computed over `..` with your secret — verify them and reject deliveries whose signature doesn''t match (any Svix-compatible library works). Inbound email that lands on a receiving-enabled domain is readable under `/email/received`.'
servers:
- url: https://www.unitpost.com/api/v1
description: Base URL
security:
- apiKey: []
tags:
- name: SMS templates
description: Reusable plain-text SMS bodies with per-recipient `{{variables}}`. Draft → published like email templates; only published templates can be sent by an SMS campaign.
paths:
/sms/templates:
get:
operationId: sms_templates_list
tags:
- SMS templates
summary: List SMS templates
description: Retrieve your SMS templates, cursor-paginated. An SMS template is a plain-text `body` with the same `{{variable}}` placeholders email templates use, filled per recipient at send time. Only `published` templates can be used by an SMS campaign. Requires the `templates:read` capability.
parameters:
- name: limit
in: query
required: false
description: Max rows to return (default 20, max 100).
schema:
type: integer
minimum: 1
maximum: 100
- name: after
in: query
required: false
description: Return rows after this id (forward paging).
schema:
type: string
- name: before
in: query
required: false
description: Return rows before this id (backward paging).
schema:
type: string
responses:
'200':
description: A page of SMS templates.
content:
application/json:
schema:
type: object
properties:
object:
type: string
enum:
- list
has_more:
type: boolean
data:
type: array
items:
$ref: '#/components/schemas/SmsTemplate'
required:
- object
- has_more
- data
headers:
Unitpost-Warning:
$ref: '#/components/headers/UnitpostWarning'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Insufficient scope.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: SMS is not enabled for this workspace.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Invalid pagination params.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
operationId: sms_templates_create
tags:
- SMS templates
summary: Create an SMS template
description: 'Create an SMS template as a `draft`. `body` may be empty for a draft (it must be filled before publishing) and is capped at 10 SMS segments (1,530 GSM-7 characters). Publish it with `{ "status": "published" }` on Update an SMS template. Requires the `templates:write` capability.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SmsTemplateCreate'
responses:
'201':
description: Created.
content:
application/json:
schema:
$ref: '#/components/schemas/SmsTemplate'
headers:
Unitpost-Warning:
$ref: '#/components/headers/UnitpostWarning'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Insufficient scope.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: SMS is not enabled for this workspace.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Validation error.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/sms/templates/{id}:
parameters:
- name: id
in: path
required: true
schema:
type: string
get:
operationId: sms_templates_get
tags:
- SMS templates
summary: Retrieve an SMS template
description: Retrieve a single SMS template, including its `body`. An email template id returns `404` here. Requires the `templates:read` capability.
responses:
'200':
description: The SMS template.
content:
application/json:
schema:
$ref: '#/components/schemas/SmsTemplate'
headers:
Unitpost-Warning:
$ref: '#/components/headers/UnitpostWarning'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Insufficient scope.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: SMS template not found, or SMS is not enabled.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
patch:
operationId: sms_templates_update
tags:
- SMS templates
summary: Update an SMS template
description: 'Update an SMS template''s `name`, `body` or `status`. A `published` template must have a message: publishing a blank `body`, or clearing the `body` of a published template, is refused with `422`. While an active SMS campaign uses a published template, editing its `body` or moving it back to `draft` is refused with `409`; unpublishing is also refused while a live automation sends it. Requires the `templates:write` capability.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SmsTemplateUpdate'
responses:
'200':
description: The updated SMS template.
content:
application/json:
schema:
$ref: '#/components/schemas/SmsTemplate'
headers:
Unitpost-Warning:
$ref: '#/components/headers/UnitpostWarning'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Insufficient scope.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: SMS template not found, or SMS is not enabled.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: The template is in use by an active campaign or live automation.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Validation error, or a published template with a blank `body`.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
operationId: sms_templates_delete
tags:
- SMS templates
summary: Delete an SMS template
description: Permanently delete an SMS template. Refused with `409` while any campaign references it, and with `resource_in_use` while a live automation sends it. Requires the `templates:write` capability.
responses:
'204':
description: Deleted.
headers:
Unitpost-Warning:
$ref: '#/components/headers/UnitpostWarning'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Insufficient scope.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: SMS template not found, or SMS is not enabled.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: The template is referenced by a campaign or live automation.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/sms/templates/{id}/usage:
parameters:
- name: id
in: path
required: true
schema:
type: string
get:
operationId: sms_templates_usage
tags:
- SMS templates
summary: Get an SMS template's usage
description: 'What uses an SMS template, and whether a change would be accepted now: its live campaigns and automations, queued texts, and `can_edit_content` / `can_unpublish` with the reason when not. Read it before an edit or delete. Requires the `templates:read` capability.'
responses:
'200':
description: Its usage.
content:
application/json:
schema:
$ref: '#/components/schemas/SmsTemplateUsage'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Insufficient scope.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: SMS template not found, or SMS is not enabled.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: A query key (this operation takes none).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/sms/templates/{id}/test-send:
parameters:
- name: id
in: path
required: true
schema:
type: string
post:
operationId: sms_templates_test_send
tags:
- SMS templates
summary: Send a test of an SMS template
description: 'Fill the template''s `{{variables}}` and send ONE test text to `to`: the simulator or a number your workspace verified (`403` for any other number). A real text, billed like any; from `sender_id` or routed by the destination''s country. Every variable needs a value (`422`). Pass an `Idempotency-Key` so a retry never texts twice. Rate limited per workspace. Requires the `sms:send` capability.'
parameters:
- name: Idempotency-Key
in: header
required: false
description: Any unique string (1–256 characters, e.g. a UUID). Retrying with the same key and the same body within 24 hours returns the first result instead of sending again; the same key with a different body is `409 invalid_idempotent_request`, and one still in flight is `409 concurrent_idempotent_requests`.
schema:
type: string
minLength: 1
maxLength: 256
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SmsTemplateTestSend'
responses:
'200':
description: The test was sent.
content:
application/json:
schema:
$ref: '#/components/schemas/SmsTemplateTestSendResult'
'400':
description: The body isn't JSON, or the `Idempotency-Key` header is not 1–256 characters.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'402':
description: The SMS wallet can't cover the text.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Insufficient scope, SMS is not on this plan, or `to` isn't the simulator or a verified test number.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: SMS template not found, or SMS is not enabled.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: No live sender to send from, or the `Idempotency-Key` is in use by a request still running, or with another body.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: An empty message, an unfilled variable, a sender that isn't live, or an unknown key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'429':
description: Too many test texts; honor Retry-After.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'503':
description: '`operation_timed_out`: other sends of your workspace were charging the SMS wallet at the same moment. Nothing was sent or charged; retry after `Retry-After` with the same `Idempotency-Key`.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
SmsTemplateUpdate:
type: object
properties:
name:
type: string
maxLength: 120
body:
type: string
maxLength: 2000
status:
type: string
enum:
- draft
- published
SmsTemplateUsage:
type: object
properties:
object:
type: string
const: sms_template_usage
template_id:
type: string
live_campaigns:
type: array
items:
type: object
properties:
id:
type: string
name:
type: string
status:
type: string
required:
- id
- name
- status
live_automations:
type: array
items:
type: object
properties:
id:
type: string
name:
type: string
status:
type: string
required:
- id
- name
- status
pending_sends:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
system_locked:
type: boolean
can_edit_content:
type: boolean
content_blocked_reason:
anyOf:
- type: string
- type: 'null'
can_unpublish:
type: boolean
unpublish_blocked_reason:
anyOf:
- type: string
- type: 'null'
required:
- object
- template_id
- live_campaigns
- live_automations
- pending_sends
- system_locked
- can_edit_content
- content_blocked_reason
- can_unpublish
- unpublish_blocked_reason
Error:
type: object
properties:
error:
type: object
properties:
code:
type: string
description: Stable machine-readable error code (branch on this, not the message).
message:
type: string
description: 'Human-readable summary. For validation errors it''s path-prefixed (e.g. "template.variables.first_name: …").'
details:
type: array
description: 'Present on errors that carry per-field reasons: validation errors (422), a blocked campaign send (409), a plan that doesn''t include a feature (403 `limit_reached` with one entry whose `code` is `feature_not_in_plan` and whose `field` names the feature, e.g. `smsChannel`), and a send cap (429 `quota_exceeded` with one entry, `field` empty, whose `code` says which cap: `daily_quota_exceeded` or `monthly_quota_exceeded` (the free plan''s daily or monthly cap), `plan_required` (the workspace needs a paid plan to send this), `allowance_used` (a paid plan''s allowance is spent and it has no pay-as-you-go), `shared_plan_cap` (the organization''s shared plan, or this workspace''s cap on it, is used up) or `risk_throttled` (the account review''s daily cap, which an upgrade doesn''t lift)). One entry per offending field/blocker.'
items:
type: object
properties:
field:
type: string
description: Dotted path to the field, e.g. "template.variables.first_name" (empty for a whole-body problem).
code:
type: string
description: Machine-readable reason for this entry, when there is one (e.g. `template_not_published` on `template_id` for a blocked SMS campaign send, or `feature_not_in_plan` on `smsChannel` when the plan has no SMS). Absent on plain validation errors.
message:
type: string
required:
- field
- message
doc_url:
type: string
format: uri
description: 'A page that explains this error and what to do, when there is one: an absolute link on the API''s own host. Every 429 has one (a section of the rate-limits guide: the request limit, an operation''s limit, the plan''s send caps or the account review cap), as do `sending_paused`, the SMS access review''s `sms_review_pending` and `account_under_review`, and errors about domains, API keys, idempotency keys, plan limits, billing, SMS consent and suppression. A `details[].code` with a page of its own picks it. Additive; absent otherwise.'
required:
- code
- message
required:
- error
SmsTemplateTestSend:
type: object
properties:
to:
type: string
minLength: 4
maxLength: 20
description: A simulator number (`+14254147755` delivers, `+14254147167` fails) or one of GET /sms/test-destinations' verified numbers (E.164).
variables:
description: Values for the template's `{{variables}}`; every one must be filled.
type: object
propertyNames:
type: string
additionalProperties:
type: string
sender_id:
description: 'Send from this live sender (`snum_…`); default: routed like any text.'
type: string
maxLength: 80
required:
- to
SmsTemplate:
type: object
properties:
object:
type: string
const: sms_template
id:
type: string
name:
type: string
body:
type: string
status:
type: string
enum:
- draft
- published
created_at:
type: string
updated_at:
type: string
required:
- object
- id
- name
- body
- status
- created_at
- updated_at
SmsTemplateTestSendResult:
type: object
properties:
object:
type: string
const: sms_template_test_send
sms_id:
type: string
description: The test text (`sms_…`); read it with GET /sms/{id}.
required:
- object
- sms_id
SmsTemplateCreate:
type: object
properties:
name:
type: string
maxLength: 120
body:
type: string
maxLength: 2000
required:
- name
headers:
UnitpostWarning:
description: 'Present when the request carried something this operation ignored (an unknown body key, a filter value it can''t apply, a recipient on a reserved domain it left out, …): one sentence per item, at most 1 KB in all (notes past that are counted, and a long list of addresses names the first ones and how many in all). The answer is the one without it. Send `Unitpost-Strict: true` to have such a request refused with a `422` instead; on `POST /email/batch` a reserved recipient refuses only its item, which comes back in `failed` while the rest of the batch is sent.'
schema:
type: string
securitySchemes:
apiKey:
type: http
scheme: bearer
description: Your workspace API key.