Retrieve an SMS message

Retrieve an SMS message

GET/api/v1/sms/{id}

GET /sms/{id}
curl -X GET 'https://www.unitpost.com/api/v1/sms/sms_123' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'
Response · 200
{
  "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 one SMS message's current status, delivery state, and segment count by id. Requires the sms:read capability.

Parameters1 field
FieldTypeDescription
idrequiredstring · pathThe SMS message id (`sms_…`).
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.
200401403404

Search docs and guides

Search the docs and product guides.