Unitpost Topics API
Subscription categories (e.g. Promotions) recipients can opt out of without leaving your list, independent of segment membership. Scope a campaign to a topic and opted-out contacts are skipped automatically.
Subscription categories (e.g. Promotions) recipients can opt out of without leaving your list, independent of segment membership. Scope a campaign to a topic and opted-out contacts are skipped automatically.
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-topics-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 Topics 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: Topics
description: Subscription categories (e.g. Promotions) recipients can opt out of without leaving your list, independent of segment membership. Scope a campaign to a topic and opted-out contacts are skipped automatically.
paths:
/email/topics:
get:
operationId: email_topics_list
tags:
- Topics
summary: List topics
description: Retrieve a list of your subscription topics, cursor-paginated. A topic is a category of email (e.g. Product updates, Promotions) that recipients can opt out of without leaving your list entirely. Pass `?archived=true` to list archived topics instead. Create one with Create a topic, or check a contact's preferences with List a contact's topic subscriptions. Requires the `topics: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
- name: archived
in: query
required: false
schema:
type: boolean
description: When true, list only archived topics instead of active ones.
responses:
'200':
description: A page of topics.
content:
application/json:
schema:
type: object
properties:
object:
type: string
enum:
- list
has_more:
type: boolean
data:
type: array
items:
$ref: '#/components/schemas/Topic'
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'
'422':
description: Invalid pagination params.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'503':
description: '`operation_timed_out`: counting the topic''s subscribers took too long; retry after `Retry-After`.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
operationId: email_topics_create
tags:
- Topics
summary: Create a topic
description: 'Create a subscription topic — a category recipients can opt out of on their own (e.g. Promotions) while staying on your list. `default_opt_in` decides whether contacts with no explicit preference are treated as subscribed. Scope a campaign to a topic so opted-out contacts are skipped automatically via Create a campaign, and set an individual contact''s preference with Set a contact''s topic preference. Topics differ from segments: a segment decides who a campaign targets, a topic lets recipients opt out. Requires the `topics:write` capability.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TopicCreate'
responses:
'201':
description: Created.
content:
application/json:
schema:
$ref: '#/components/schemas/Topic'
headers:
Unitpost-Warning:
$ref: '#/components/headers/UnitpostWarning'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: A topic with that name already exists.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Validation error.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/email/topics/{id}:
parameters:
- name: id
in: path
required: true
schema:
type: string
get:
operationId: email_topics_get
tags:
- Topics
summary: Retrieve a topic
description: Retrieve a single topic by `id`, including its name and `default_opt_in` setting. Change it with Update a topic, or list every topic with List topics. Requires the `topics:read` capability.
responses:
'200':
description: The topic.
content:
application/json:
schema:
$ref: '#/components/schemas/Topic'
headers:
Unitpost-Warning:
$ref: '#/components/headers/UnitpostWarning'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Topic not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'503':
description: '`operation_timed_out`: counting the topic''s subscribers took too long; retry after `Retry-After`.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
patch:
operationId: email_topics_update
tags:
- Topics
summary: Update a topic
description: 'Update a topic''s name or `default_opt_in` behavior, or pass `{ "archived": true | false }` to archive or restore it. Only explicit choices are stored, so changing `default_opt_in` subscribes (`true`) or unsubscribes (`false`) every contact with no explicit choice on the topic at once; `Unitpost-Warning` names how many. Archiving a topic hides it and stops it from being targeted, but is blocked with `409` while an active campaign still targets it. To manage a single contact''s preference, use Set a contact''s topic preference. Requires the `topics:write` capability.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TopicUpdate'
responses:
'200':
description: The updated topic.
content:
application/json:
schema:
$ref: '#/components/schemas/Topic'
headers:
Unitpost-Warning:
$ref: '#/components/headers/UnitpostWarning'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Topic not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: A topic with that name already exists, or it's referenced by an active campaign.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Validation error.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
delete:
operationId: email_topics_delete
tags:
- Topics
summary: Delete a topic
description: 'Archive a topic (a soft delete — existing subscription records are preserved so you can restore it later). It''s blocked with `409` while an active campaign still targets it. Restore an archived topic by sending `{ "archived": false }` to Update a topic. Requires the `topics:write` capability.'
responses:
'204':
description: Archived.
headers:
Unitpost-Warning:
$ref: '#/components/headers/UnitpostWarning'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Topic not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: Topic is referenced by an active campaign.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/email/topics/{id}/opt-out:
parameters:
- name: id
in: path
required: true
schema:
type: string
post:
operationId: email_topics_opt_out
tags:
- Topics
summary: Opt contacts out of a topic
description: 'Opt many contacts out of this topic in one call, as a background job: the contacts you list (`contact_ids` or `emails`, up to 1,000, each a contact of this workspace) or every member of a segment (`segment_id`, however many; also needs `segments:read`). Send exactly one. Each contact is opted out as Set a contact''s topic preference would: one that was subscribed gets a `topic.unsubscribed` webhook and an activity row naming your key; one already opted out is left as it is, with no webhook. Suppressions and other topics are untouched, and there is no bulk opt-in. Listed contacts are checked first: the first that isn''t one of yours is a `404` naming it (`details`), and nothing starts. The answer is the job (`202`, `Location`); follow it with Retrieve a job. Pass an `Idempotency-Key` so a retry answers the same job instead of starting another. Requires the `topics:write` 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/TopicOptOut'
responses:
'202':
description: The opt-out job (`Location` names it).
content:
application/json:
schema:
$ref: '#/components/schemas/Job'
'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'
'403':
description: Insufficient scope (`segment_id` also needs `segments:read`).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Topic not found; or a listed contact or the segment isn't in this workspace (`details` names it).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: 'Idempotency conflict: the same key with a different body or topic, or one still in flight; or `job_in_progress`: five opt-outs are already running in this workspace (follow them with `GET /jobs`).'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Not exactly one of `contact_ids`, `emails` and `segment_id`, more than 1,000 listed, or an unknown key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'429':
description: Too many opt-outs started this minute (`Retry-After`).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'502':
description: '`engine_unavailable`: the job couldn''t be started; nothing was opted out. Retry.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/contacts/{id}/topics:
parameters:
- name: id
in: path
required: true
schema:
type: string
get:
operationId: contact_topics_list
tags:
- Topics
summary: List a contact's topic subscriptions
description: Retrieve a contact's effective subscription state for every active topic, cursor-paginated. Each row resolves the contact's explicit preference against the topic's `default_opt_in`, so `subscribed` is always the answer to "would this contact receive a campaign scoped to this topic?". Change a preference with Set a contact's topic preference. Requires the `topics: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 the contact's topic subscriptions.
content:
application/json:
schema:
type: object
properties:
object:
type: string
enum:
- list
has_more:
type: boolean
data:
type: array
items:
$ref: '#/components/schemas/ContactTopic'
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'
'404':
description: Contact not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Invalid pagination params.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
operationId: contact_topics_set
tags:
- Topics
summary: Set a contact's topic preference
description: Subscribe or unsubscribe a contact for one topic. This records an explicit preference that overrides the topic's `default_opt_in`, and it's idempotent — setting the same preference twice succeeds. `PUT` behaves identically. Read the contact's current state with List a contact's topic subscriptions; change several at once with Update a contact's topic preferences. Requires the `topics:write` capability.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ContactTopicSet'
responses:
'201':
description: The resolved subscription.
content:
application/json:
schema:
$ref: '#/components/schemas/ContactTopic'
headers:
Unitpost-Warning:
$ref: '#/components/headers/UnitpostWarning'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Contact or topic not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Validation error.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
put:
operationId: contact_topics_set_put
x-alias-of: post
tags:
- Topics
summary: Set a contact's topic preference (alias of POST)
description: Identical to Set a contact's topic preference — provided so clients that prefer `PUT` semantics for an upsert can use it interchangeably. Requires the `topics:write` capability.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ContactTopicSet'
responses:
'201':
description: The resolved subscription.
content:
application/json:
schema:
$ref: '#/components/schemas/ContactTopic'
headers:
Unitpost-Warning:
$ref: '#/components/headers/UnitpostWarning'
'401':
description: Missing or invalid API key.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Contact or topic not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: Validation error.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
patch:
operationId: contact_topics_update
tags:
- Topics
summary: Update a contact's topic preferences
description: 'Subscribe or unsubscribe a contact for several topics in one call: `topics` lists up to 50 preferences, each topic once. Topics you leave out keep their current preference. The contact and every topic are checked before any preference is set, so an unknown topic is a `404` naming it and nothing changes. Each preference is then recorded as Set a contact''s topic preference records one (`topic.subscribed` / `topic.unsubscribed` only when it actually changes), and it''s idempotent. The answer lists the resolved subscriptions in the order sent. Any key other than `topics`, in the body or in an item, is a `422`. Requires the `topics:write` capability.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ContactTopicsUpdate'
responses:
'200':
description: The resolved subscriptions, in the order sent.
content:
application/json:
schema:
$ref: '#/components/schemas/ContactTopicList'
headers:
Unitpost-Warning:
$ref: '#/components/headers/UnitpostWarning'
'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.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Contact not found, or the first unknown topic (nothing is set).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'422':
description: 'Validation error: a topic listed twice, more than 50, or an unknown key.'
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
Job:
type: object
properties:
object:
type: string
const: job
id:
type: string
kind:
type: string
status:
type: string
enum:
- QUEUED
- RUNNING
- COMPLETED
- FAILED
- CANCELED
total:
anyOf:
- type: integer
minimum: -9007199254740991
maximum: 9007199254740991
- type: 'null'
processed:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
failed:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
error:
anyOf:
- type: string
- type: 'null'
created_at:
type: string
completed_at:
anyOf:
- type: string
- type: 'null'
required:
- object
- id
- kind
- status
- total
- processed
- failed
- error
- created_at
- completed_at
TopicUpdate:
type: object
properties:
name:
type: string
maxLength: 120
description:
anyOf:
- type: string
maxLength: 500
- type: 'null'
default_opt_in:
type: boolean
TopicOptOut:
type: object
properties:
contact_ids:
description: Contacts of this workspace (`con_…`), up to 1,000.
minItems: 1
maxItems: 1000
type: array
items:
type: string
minLength: 1
emails:
description: Contacts of this workspace by email address, up to 1,000.
minItems: 1
maxItems: 1000
type: array
items:
type: string
segment_id:
description: Every member of this segment (`seg_…`), however many. Also needs `segments:read`.
type: string
minLength: 1
description: 'Who to opt out: exactly one of `contact_ids`, `emails` or `segment_id`.'
ContactTopic:
type: object
properties:
object:
type: string
const: contact_topic
topic_id:
type: string
channel:
type: string
enum:
- email
- sms
description: 'The topic''s channel: manage it under `/email/topics` or `/sms/topics`.'
subscribed:
type: boolean
status:
type: string
enum:
- subscribed
- unsubscribed
source:
type: string
enum:
- user
- manual
- import
- api
required:
- object
- topic_id
- channel
- subscribed
- status
- source
TopicCreate:
type: object
properties:
name:
type: string
maxLength: 120
description:
type: string
maxLength: 500
default_opt_in:
type: boolean
required:
- name
ContactTopicList:
type: object
properties:
object:
type: string
const: list
has_more:
type: boolean
const: false
data:
type: array
items:
$ref: '#/components/schemas/ContactTopic'
required:
- object
- has_more
- data
Topic:
type: object
properties:
object:
type: string
const: topic
id:
type: string
name:
type: string
description:
anyOf:
- type: string
- type: 'null'
channel:
type: string
enum:
- email
- sms
description: Which channel the topic belongs to. Email topics are managed under `/email/topics`, SMS topics under `/sms/topics`.
default_opt_in:
type: boolean
subscriber_count:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
description: 'Contacts subscribed to this topic, among those the channel can reach (an email address, or an SMS number): for an opt-out topic everyone but those who opted out of it, for an opt-in topic those who opted in. A send also skips contacts unsubscribed from everything and suppressed addresses. The dashboard''s count.'
unsubscribed_count:
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
description: Reachable contacts who opted out of this topic.
created_at:
type: string
updated_at:
type: string
required:
- object
- id
- name
- description
- channel
- default_opt_in
- created_at
- updated_at
ContactTopicsUpdate:
type: object
properties:
topics:
minItems: 1
maxItems: 50
type: array
items:
type: object
properties:
topic_id:
type: string
minLength: 1
description: The topic (`top_…`).
subscribed:
type: boolean
description: '`true` to subscribe the contact, `false` to unsubscribe.'
required:
- topic_id
- subscribed
additionalProperties: false
description: The preferences to change, up to 50, each topic once. Topics left out keep theirs.
required:
- topics
additionalProperties: false
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
ContactTopicSet:
type: object
properties:
topic_id:
type: string
minLength: 1
topic:
type: string
minLength: 1
subscribed:
type: boolean
required:
- subscribed
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.