Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Unitpost Usage 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: Usage
description: 'Your workspace''s current billing-period usage: emails sent, and on paid plans the dollar sending wallet (monthly allowance, spend, purchased credit, overage) in integer USD cents. Spend caps: the monthly limits on what API keys and apps may spend, today the cap on SMS purchases (`GET`/`PATCH /spend-caps`).'
paths:
/usage:
get:
operationId: usage_get
tags:
- Usage
summary: Retrieve usage
description: 'Retrieve your workspace''s current billing-period usage snapshot: the plan, the period window, and the email counter. On paid plans the response also carries the dollar sending `wallet`: the monthly allowance included with the plan, spend so far, any upgrade carryover, the non-expiring purchased-credit balance, and billable overage, all as integer USD cents. On the free plan `wallet` is null and the `emails` object carries the monthly quota and daily cap instead. `spend` itemizes the period from the wallet ledger (email, SMS, SMS carrier fees, refunds, and how it was paid), and `sms` breaks SMS down by destination country with segments, the price per segment, texts received by the receiving number''s country, monthly number and campaign fees, one-time registration fees, and refunds. Amounts are read from the same ledger and meters that gate sending, so this matches the dashboard statement exactly. Requires the `emails:read` or `sms:read` capability.'
responses:
'200':
description: The current-period usage snapshot.
content:
application/json:
schema:
$ref: '#/components/schemas/Usage'
'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'
/spend-caps:
get:
operationId: spend_caps_get
tags:
- Usage
summary: Retrieve spend caps
description: 'The workspace''s monthly spend caps and what each has counted this period. `sms_purchases` caps the SMS carrier purchases API keys and apps confirm (`POST /sms/quotes/{id}/confirm`): the fee due now plus the first month of a monthly fee, per UTC calendar month; dashboard purchases never count. `cap_cents` is the cap as set (null: none, so every API purchase is refused with `403 api_spend_cap_not_set`); the cap that applies is the lower of it and `max_cents` ($1,000 a month by default). A workspace that starts a paid plan on its own card starts with a $75 cap when it has none, unless a key or app of it already holds `sms:purchase` (a workspace its organization pays for follows the organization Owner''s rules instead; a key still needs `sms:purchase` to buy). `shared_plan` is the workspace''s cap on its organization''s shared plan and what it drew from it this period (null when it isn''t on one); its organization sets it. Requires the `sms:read` or `sms:purchase` or `spend_caps:write` capability.'
responses:
'200':
description: The spend caps.
content:
application/json:
schema:
$ref: '#/components/schemas/SpendCaps'
'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.
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'
patch:
operationId: spend_caps_update
tags:
- Usage
summary: Update spend caps
description: 'Set, raise, lower or clear a monthly spend cap; only the caps you send change. `sms_purchases.cap_cents` is whole cents from 0 (API purchases off) to the platform maximum ($1,000 a month by default), or null to clear it, after which every API purchase is refused (`403 api_spend_cap_not_set`) until a cap is set again. A purchase over the cap is refused with `403 api_spend_cap_exceeded` and nothing is charged; the dashboard buys past it. The capability is in no key preset, and only the workspace owner holds it and can give it to a key or an app; no other capability changes a cap. A workspace its organization pays for refuses it (`403 billed_by_organization`): its organization sets that cap with `sms_purchases_cap_cents` on `PATCH /organizations/{id}/workspaces/{workspace_id}`. `shared_plan` is read-only: a body naming it is `403 billed_by_organization` and changes nothing (the organization sets that cap with `PATCH /organizations/{id}/shared-plan/workspaces/{workspace_id}`). Requires the `spend_caps:write` capability.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SpendCapsUpdate'
responses:
'200':
description: The spend caps, after the change.
content:
application/json:
schema:
$ref: '#/components/schemas/SpendCaps'
'400':
description: The body isn't JSON.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: 'Insufficient scope (`spend_caps:write`), a workspace its organization pays for (`billed_by_organization`), or a body naming `shared_plan` (`billed_by_organization`: its organization sets it).'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: SMS is not enabled.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: A cap outside 0 to the platform maximum or not whole cents, no cap to change, or an unknown key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
SpendCaps:
type: object
properties:
object:
type: string
const: spend_caps
sms_purchases:
type: object
properties:
cap_cents:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: 'The monthly cap on SMS purchases made with an API key or an app, as set. Null: none, so every API purchase is refused. 0: API purchases off. The cap that applies is the lower of this and `max_cents`.'
max_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
description: The most a cap may be set to, and the most any cap counts as (Unitpost's limit, which staff can change).
spent_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
description: 'Counted this period: each API purchase''s fee due now plus the first month of a monthly fee, for orders placed, confirming or waiting on the carrier. Failed orders count nothing.'
period_start:
type: string
description: The start of the UTC calendar month being counted (inclusive).
period_end:
type: string
description: The start of the next UTC month (exclusive).
required:
- cap_cents
- max_cents
- spent_cents
- period_start
- period_end
description: SMS purchases by API (`POST /sms/quotes/{id}/confirm`). Purchases made in the dashboard never count.
shared_plan:
anyOf:
- type: object
properties:
cap_cents:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: 'What this workspace may draw from the shared plan each period (allowance and overage together), set by its organization. Null: no cap.'
spent_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
description: What this workspace drew this period (its own sending and SMS, never the other workspaces').
period_start:
description: The shared plan's current billing period start (inclusive).
anyOf:
- type: string
- type: 'null'
period_end:
description: The period end (exclusive).
anyOf:
- type: string
- type: 'null'
required:
- cap_cents
- spent_cents
- period_start
- period_end
- type: 'null'
description: 'The workspace''s cap on its organization''s shared plan, read-only: its organization sets it (`PATCH /organizations/{id}/shared-plan/workspaces/{workspace_id}`). Null when the workspace isn''t on a shared plan.'
required:
- object
- sms_purchases
SpendCapsUpdate:
type: object
properties:
sms_purchases:
type: object
properties:
cap_cents:
anyOf:
- type: integer
minimum: 0
maximum: 9007199254740991
- type: 'null'
required:
- cap_cents
additionalProperties: false
Usage:
type: object
properties:
object:
type: string
const: usage
plan:
type: string
period_start:
type: string
period_end:
type: string
emails:
type: object
properties:
sent:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
included:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
daily_cap:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
sent_today:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
required:
- sent
- included
- daily_cap
- sent_today
wallet:
anyOf:
- type: object
properties:
allowance_cents:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
used_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
reserved_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
fee_deficit_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
fee_deficit_settled_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
carryover_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
purchased_credit_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
overage_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
overage_cap_cents:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
email_rate_per_1k_cents:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
shared_plan:
anyOf:
- type: object
properties:
allowance_cents:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
cap_cents:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
paused:
type: boolean
required:
- allowance_cents
- cap_cents
- paused
- type: 'null'
required:
- allowance_cents
- used_cents
- reserved_cents
- fee_deficit_cents
- fee_deficit_settled_cents
- carryover_cents
- purchased_credit_cents
- overage_cents
- overage_cap_cents
- email_rate_per_1k_cents
- type: 'null'
spend:
type: object
properties:
total_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
email_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
sms_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
sms_carrier_fees_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
other_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
refunds_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
included_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
purchased_credit_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
overage_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
credits_added_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
required:
- total_cents
- email_cents
- sms_cents
- sms_carrier_fees_cents
- other_cents
- refunds_cents
- included_cents
- purchased_credit_cents
- overage_cents
- credits_added_cents
sms:
type: object
properties:
messages:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
segments:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
send_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
received:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
received_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
monthly_fees_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
one_time_fees_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
refunds_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
countries:
type: array
items:
type: object
properties:
country:
type: string
messages:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
segments:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
price_per_segment_cents:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
price_per_segment_cents_decimal:
anyOf:
- type: string
- type: 'null'
cost_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
required:
- country
- messages
- segments
- price_per_segment_cents
- cost_cents
received_countries:
type: array
items:
type: object
properties:
country:
type: string
received:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
segments:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
cost_cents:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
required:
- country
- received
- segments
- cost_cents
required:
- messages
- segments
- send_cents
- received
- received_cents
- monthly_fees_cents
- one_time_fees_cents
- refunds_cents
- countries
limits:
type: object
properties:
log_retention_days:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: Days sent and received email, events and activity stay readable; null when unlimited or custom.
domains:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: Sending domains; null when unlimited or custom.
team_members:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: Team members (seats); null when unlimited or custom.
api_keys:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: Live API keys; null when unlimited or custom.
webhook_endpoints:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: Webhook endpoints; null when unlimited or custom.
image_storage_mb:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: Hosted image storage, in MB; null when unlimited or custom.
contacts:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: Stored contacts; null when unlimited or custom.
advance_scheduling_days:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: How far ahead a send or campaign may be scheduled, in days; null means the platform's maximum, 90.
automation_runs_included:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: Automation runs included per period; null when unlimited or custom.
ai_credits:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: Ask Unit credits per period; null when unlimited or custom.
sms_toll_free_numbers:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: Toll-free numbers held at once; null when unlimited or custom.
sms_local_numbers_per_country:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
description: Instant local numbers held per country; null when unlimited or custom.
required:
- log_retention_days
- domains
- team_members
- api_keys
- webhook_endpoints
- image_storage_mb
- contacts
- advance_scheduling_days
- automation_runs_included
- ai_credits
- sms_toll_free_numbers
- sms_local_numbers_per_country
features:
type: object
properties:
sms:
type: boolean
description: 'The SMS channel: brands, senders and sends.'
sms_carrier_resources:
type: boolean
description: Phone numbers and carrier registrations billed from the wallet.
inbound_email:
type: boolean
description: Receiving email on your domains.
topics:
type: boolean
description: Subscription topics.
granular_permissions:
type: boolean
description: Read-only and custom API keys, fine-tuned teammate permissions.
remove_branding:
type: boolean
description: Removing the Unitpost mark from the footer and unsubscribe page.
required:
- sms
- sms_carrier_resources
- inbound_email
- topics
- granular_permissions
- remove_branding
sms_review:
anyOf:
- type: object
properties:
access:
type: string
enum:
- not_requested
- pending
- approved
- rejected
description: '`not_requested`: no carrier step yet. `pending`: in review; carrier orders answer `409 sms_review_pending` and charge nothing, except a first 10DLC brand registration, which is charged and held as `pending`. `approved`: carrier orders go through. `rejected`: carrier orders answer `403 account_under_review` with `details[].code` `sms_access_rejected`; senders the account already has keep working.'
requested_at:
description: When the review was requested (ISO 8601, UTC); null before that.
anyOf:
- type: string
- type: 'null'
decided_at:
description: When Unitpost approved or declined it (ISO 8601, UTC); null while pending, and for an account that never needed a review.
anyOf:
- type: string
- type: 'null'
rejection_reason:
description: Why it was declined, as the decision email said; null unless `access` is `rejected`.
anyOf:
- type: string
- type: 'null'
new_senders_held:
type: boolean
description: The account is under review, so new senders and carrier registrations answer `403 account_under_review` with `details[].code` `account_review_hold`; existing senders keep working.
send_cap:
anyOf:
- type: object
properties:
per_day:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
description: Texts allowed per UTC day while the cap applies.
sent_today:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
description: Texts sent so far today (UTC).
reason:
type: string
enum:
- first_send_review
- account_review
description: '`first_send_review`: a new SMS account''s first texts are being checked. `account_review`: the account is under review.'
required:
- per_day
- sent_today
- reason
- type: 'null'
description: The daily SMS cap, shown whenever one applies (used up or not); null when texts aren't capped. A send over it answers `429 quota_exceeded` with `details[].code` `risk_throttled`; upgrading doesn't raise it, and it resets at 00:00 UTC.
required:
- access
- requested_at
- decided_at
- rejection_reason
- new_senders_held
- send_cap
description: The SMS account review. Unitpost reviews every new SMS account before its first carrier order, usually within one business day.
- type: 'null'
required:
- object
- plan
- period_start
- period_end
- emails
- wallet
- spend
- sms
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
securitySchemes:
apiKey:
type: http
scheme: bearer
description: Your workspace API key.