List SMS messages
GET/api/v1/sms
GET /sms
curl -X GET 'https://www.unitpost.com/api/v1/sms' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'User-Agent: my-app/1.0'Response · 200
{
"object": "list",
"has_more": false,
"data": [
{
"object": "sms",
"id": "id_123",
"to": "customer@example.com",
"from": "you@yourdomain.com",
"direction": "outbound",
"status": "queued",
"type": "transactional",
"body": "string",
"segments": 0,
"in_reply_to": "string",
"received_at": "2026-01-01T00:00:00.000Z",
"looks_like_opt_out": false,
"country": "string",
"scheduled_at": "2026-01-01T00:00:00.000Z",
"last_error": "string",
"error": {
"code": "out_of_reach",
"message": "string"
},
"failure_code": "quota_exceeded",
"created_at": "2026-01-01T00:00:00.000Z",
"contact_id": "contact_123",
"participant_opted_out": false,
"tags": [
{
"name": "Example",
"value": "string"
}
]
}
]
}Retrieve your workspace's SMS messages (outbound and inbound), newest-first and cursor-paginated. Narrow the list with direction, status, from, to, participant, contact_id, campaign_id, created_after/created_before, sender_id, and tag (the texts you sent with that tag). For a conversation with one person, pass participant with their number: it returns the texts you sent them and the replies they sent you. Use a message's id with Retrieve an SMS message to read its delivery state. Requires the sms:read capability.
Parameters16 fields
| Field | Type | Description |
|---|---|---|
limit | integer · query | Max rows to return (default 20, max 100). |
after | string · query | Return rows after this id (forward paging). |
before | string · query | Return rows before this id (backward paging). |
direction | string · query | `inbound` for replies people sent you, `outbound` for texts you sent. |
status | string · query | Filter by status. Inbound messages are `received`. |
from | string · query | Sender: the person's number on inbound, your number or Sender ID on outbound (recorded once the text is sent). URL-encode the `+` as `%2B`; a value starting with a digit is read as E.164. |
to | string · query | Recipient: the person's number on outbound, your number on inbound. |
participant | string · query | The other party's E.164 number: matches `to` on texts you sent and `from` on replies you received, so one call returns the whole conversation. |
contact_id | string · query | Only messages with this contact (`con_…`), both directions. |
campaign_id | string · query | Only messages produced by this SMS campaign. |
created_after | string · query | Only messages created at/after this ISO 8601 time. |
created_before | string · query | Only messages created at/before this ISO 8601 time. |
sender_id | string · query | One of your numbers or Sender IDs (`snum_…`, from List SMS numbers): every text it sent or received, as its dashboard page lists them. Ignored with a warning when it can't apply (refused under `Unitpost-Strict: true`). |
q | string · query | Search the message text; with 3 or more digits it also matches either number, as the dashboard's Messages log searches. At most 200 characters. Ignored with a warning when it can't apply (refused under `Unitpost-Strict: true`). |
type | string · query | `transactional` or `marketing`. Ignored with a warning when it can't apply (refused under `Unitpost-Strict: true`). |
tag | string · query | Only texts sent with this tag, written `name:value` (e.g. `customer:acme`), each half 1–256 ASCII letters, digits, `_` or `-`. Several, comma-separated (`customer:acme,flow:reminders`) or with `tag` repeated: only texts that carry every one of them. Received texts carry no tags. A value that isn't `name:value` is ignored with a warning (refused under `Unitpost-Strict: true`). |
Response · 200 fields21 fields
| Field | Type | Description |
|---|---|---|
objectrequired | string | — |
idrequired | string | — |
torequired | string | — |
fromrequired | string | null | — |
directionrequired | enumoutbound | inbound | — |
statusrequired | enumqueued | scheduled | sending | sent | delivered | failed | suppressed | canceled | received | — |
typerequired | enumtransactional | marketing | — |
bodyrequired | string | null | — |
segmentsrequired | integer | Billed units. Outbound: segments. Inbound: the received text's segments when it was charged ($0.008 a segment in the US and $0.004 in Canada; a text charged before per-segment pricing was 1¢ flat and shows 1), else 0. |
in_reply_torequired | string | null | Inbound only: your text this reply answers (`sms_…`), when the carrier says which. Null otherwise. |
received_atrequired | string | null | Inbound only: when the reply reached Unitpost. Order a conversation by this; carriers don't guarantee order. Null on outbound. |
looks_like_opt_outrequired | boolean | Inbound only: the text reads like a request to stop texting ("please stop texting me") but was not an opt-out keyword, so no opt-out was recorded. Decide whether to record one (POST /v1/contacts/{id}/sms-consent, action opt_out). False for an exact keyword such as STOP (already recorded) and on outbound. |
countryrequired | string | null | The other party's country (ISO 3166-1 alpha-2): the recipient's on a send, the sender's on a received text. Null when the number's country isn't known. |
scheduled_atrequired | string | null | — |
last_errorrequired | string | null | The sentence for why the text failed or was skipped. Match on `failure_code` (failed) or `error.code` (suppressed), not on this text. |
errorrequired | object | null | Set on `suppressed` messages: the stable skip reason and its sentence. Null otherwise. |
failure_code | enum | null | Set on `failed` messages: why it failed, as a stable code (the sentence is `last_error`). Null otherwise. Only `carrier_undelivered` (the carrier accepted the text, then could not deliver it) is billed; every other failure is not charged. Billing when a scheduled text was due: `quota_exceeded`, `overage_cap_exceeded`, `subscription_inactive`, `sms_not_in_plan` (the paid plan ended and its grace is over, or it is 100% discounted); `unsupported_country`: SMS to the country was paused; workspace holds: `workspace_suspended`, `sms_brand_blocked`; the sender: `sender_not_active`, `sender_registration_incomplete`, `sender_action_required`, `sender_use_case_mismatch`; `quiet_hours_unsatisfiable`: marketing that could not go out inside the recipient's window; ours: `channel_unavailable`, `delivery_exhausted`; `provider_rejected`: refused before any carrier; `suspected_pumping`: stopped before the carrier as suspected SMS pumping. The same code is `failed.code` on the `sms.failed` webhook. |
created_atrequired | string | — |
contact_id | string | null | The contact this text is filed under (`con_…`), or null: an inbound text from a number that isn't a contact. Make one with POST /sms/{id}/contact. |
participant_opted_out | boolean | The other party (the sender of an inbound text, the recipient of an outbound one) can't be texted by this workspace now: they texted STOP or the number is suppressed. A reply to them is refused (`opted_out`) until they text START or UNSTOP. As of this read. |
tags | object[] | The tags the text was sent with (`tags` on `POST /sms`), in the order given. Empty for a text sent without tags and for received texts. |
200401403422503