List SMS messages

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
FieldTypeDescription
limitinteger · queryMax rows to return (default 20, max 100).
afterstring · queryReturn rows after this id (forward paging).
beforestring · queryReturn rows before this id (backward paging).
directionstring · query`inbound` for replies people sent you, `outbound` for texts you sent.
statusstring · queryFilter by status. Inbound messages are `received`.
fromstring · querySender: 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.
tostring · queryRecipient: the person's number on outbound, your number on inbound.
participantstring · queryThe 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_idstring · queryOnly messages with this contact (`con_…`), both directions.
campaign_idstring · queryOnly messages produced by this SMS campaign.
created_afterstring · queryOnly messages created at/after this ISO 8601 time.
created_beforestring · queryOnly messages created at/before this ISO 8601 time.
sender_idstring · queryOne 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`).
qstring · querySearch 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`).
typestring · query`transactional` or `marketing`. Ignored with a warning when it can't apply (refused under `Unitpost-Strict: true`).
tagstring · queryOnly 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
FieldTypeDescription
objectrequiredstring—
idrequiredstring—
torequiredstring—
fromrequiredstring | null—
directionrequiredenumoutbound | inbound—
statusrequiredenumqueued | scheduled | sending | sent | delivered | failed | suppressed | canceled | received—
typerequiredenumtransactional | marketing—
bodyrequiredstring | null—
segmentsrequiredintegerBilled 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_torequiredstring | nullInbound only: your text this reply answers (`sms_…`), when the carrier says which. Null otherwise.
received_atrequiredstring | nullInbound only: when the reply reached Unitpost. Order a conversation by this; carriers don't guarantee order. Null on outbound.
looks_like_opt_outrequiredbooleanInbound 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.
countryrequiredstring | nullThe 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_atrequiredstring | null—
last_errorrequiredstring | nullThe sentence for why the text failed or was skipped. Match on `failure_code` (failed) or `error.code` (suppressed), not on this text.
errorrequiredobject | nullSet on `suppressed` messages: the stable skip reason and its sentence. Null otherwise.
failure_codeenum | nullSet 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_atrequiredstring—
contact_idstring | nullThe 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_outbooleanThe 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.
tagsobject[]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

Search docs and guides

Search the docs and product guides.