# Messages | Signal House API Docs

> Send SMS, MMS, group MMS and P2P messages with the Signal House API, and query message logs.

Source: https://docs.signalhouse.io/messages

---

## Messages

## Overview

Signal House supports three message types:

- **SMS** -- Text-only messages sent via JSON
- **MMS** -- Messages with media attachments (images, videos) sent via multipart form data
- **Group MMS** -- MMS messages sent to multiple recipients as a group conversation thread

All messages are sent from phone numbers that must be in `READY` status on an `ACTIVE` campaign.

## Prerequisites

Before sending messages, ensure:

1. **A registered brand** with `VERIFIED` or `VETTED_VERIFIED` status
2. **An active campaign** linked to that brand
3. **Phone numbers assigned** to the campaign in `READY` status
4. **Sufficient wallet balance** to cover message costs

## Date ranges

Every message read that takes a `startDate` / `endDate` range accepts a `dateBounds` parameter with two values.**day** widens each bound to its whole UTC day and buckets by UTC date — the behaviour these endpoints have always had.**exact** binds a timestamp as the instant it names (a bare date is still its whole UTC day) and aligns day buckets to the UTC offset the end bound carries, so a client that sends its own midnights gets its own calendar dates back.

A request that omits `dateBounds` runs as `day`. Bare-date callers get the same rows in either mode. If you send timestamps and want them honoured — an end of `T00:00:00Z` meaning that instant rather than the whole day, or day buckets keyed by your own calendar dates — pass `dateBounds=exact`.

## Phone Number Format

**All numbers must be digits only, without the `+` prefix.** Use a 5-6 digit code for Short Code senders or 11-digit E.164 format for US long numbers (country code + 10-digit number).

Examples: `12345` for a Short Code sender or `12025551234` for a long number (not `+12025551234`). Recipients must be 10+ digits. The API strips any `+` prefix automatically.

## Partial phone-number search on Message Logs

`senderPhoneNumber` and `recipientPhoneNumber` on `GET /message` accept `%` as a wildcard for a partial match. A plain digits value is an exact match, unchanged. A value containing `%` matches anywhere `%` is placed — `%1234` matches numbers ending in 1234, `1234%` matches numbers starting with 1234, and `%1234%` matches 1234 anywhere in the number. 3-15 digits are required alongside the `%`.

A message sent moments ago may not be immediately findable by a `%` search — allow a few seconds before it appears.

If a `%` search matches more than 500 distinct numbers, the request fails with a `MessageQueryError` asking for more digits to narrow the search, rather than silently truncating the match list.

**URL-encode the literal `%` as `%25`.** In a URL, `%` itself starts a percent-encoded byte — `%55` decodes to the character `U`, not the two characters `%5`. To send the wildcard value `%5551`, the query string must read `%255551`.

Example: `GET /message?groupId=G0000001&startDate=2026-09-01&endDate=2026-09-30&senderPhoneNumber=%255551`

### GET /message

Retrieve message logs with advanced filtering. When fetching a single message by id, the response includes a cost field representing the net cost in microdollars (1,000,000 = $1.00). An RCS message carries ratedCostMicros, what its RCS leg was rated at when queued, and, once it settles, carrierFeeMicros: the carrier pass-through and media surcharge charged for it, written when an outbound RCS message is delivered or read and when an inbound RCS message is charged. A message that never settles over RCS has no carrierFeeMicros, and a later RCS session adjustment does not change it. An inbound message carries inReplyToMessageId, the message it answers. A reply chip or button names its message, so that link is exact; any other reply links to the newest message your number or agent sent that handset in the 7 days before it, while that message was sent, delivered or read and was not a STOP or HELP auto-reply. It is absent when there is no such message, on P2P replies, and on replies stored before the link was switched on. If that message has a parentMessageId, it was an RCS fallback, and the parent is the RCS message you sent.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | Query Param | Optional | Specific Message ID. |
| `campaignId` | Query Param | Optional | Filter by Campaign ID. |
| `registrationId` | Query Param | Optional | Filter to messages attributed to these registrations. Accepts a single value, a repeated key, or a comma-separated list. Cannot be combined with campaignId (400); a phoneNumber filter narrows further. An unknown registration is a 404 and one outside the group a 403. |
| `brandId` | Query Param | Optional | Filter by Brand ID. |
| `subgroupId` | Query Param | Optional | Filter by Subgroup ID. |
| `groupId` | Query Param | Required | Filter by Group ID. (Required when id is not provided.) |
| `phoneNumber` | Query Param | Optional | Filter by phone number. Repeat the parameter for multiple values (e.g. phoneNumber=12025551234&phoneNumber=12025555678). |
| `senderPhoneNumber` | Query Param | Optional | Filter by sender phone number. A plain value is an exact match; repeat the parameter for multiple exact values (e.g. senderPhoneNumber=12025551234&senderPhoneNumber=12025555678). A value containing % is a partial-match wildcard (e.g. %5551 matches numbers ending in 5551); 3-15 digits are required alongside the %. In the URL itself, encode the literal % as %25 (e.g. %255551). |
| `recipientPhoneNumber` | Query Param | Optional | Filter by recipient phone number. A plain value is an exact match; repeat the parameter for multiple exact values (e.g. recipientPhoneNumber=12025551234&recipientPhoneNumber=12025555678). A value containing % is a partial-match wildcard (e.g. %5551 matches numbers ending in 5551); 3-15 digits are required alongside the %. In the URL itself, encode the literal % as %25 (e.g. %255551). |
| `status` | Query Param | Optional | Filter by message status (ENQUEUED, DEQUEUED, SENT, FAILED, DELIVERED, and for RCS messages READ, EXPIRED, FALLBACK, BLOCKED). Repeat the parameter for multiple values (e.g. status=DELIVERED&status=SENT). Without status, a group that has ever had an RCS agent gets every status. Any other group gets ENQUEUED, DEQUEUED, SENT, FAILED and DELIVERED. |
| `direction` | Query Param | Optional | Filter by direction (INBOUND or OUTBOUND). |
| `messageType` | Query Param | Optional | Filter by message type. Accepts a single value or an array (repeat the param for multiple values, e.g. messageType=SMS&messageType=MMS, or pass a comma-separated list). Allowed values: SMS, MMS, RCS, WHATSAPP, VIBER, P2P. When omitted, defaults to all non-P2P types. |
| `channel` | Query Param | Optional | Filter by messaging channel. Accepts a single value or an array (cumulative — repeat the param, e.g. channel=tenDLC&channel=p2p, or pass a comma-separated list). Allowed values: tenDLC, virtualLongCode, alphanumeric, tollFree, shortCode, p2p, rcs. Channel is stored on the message at write time and filtered directly on read; legacy (pre-stamp) messages fold into tenDLC. Ignored when matchAny is true (matchAny takes precedence). |
| `matchAny` | Query Param | Optional | When true, the provided campaignId/brandId/phoneNumber filters are combined with OR (a message matches ANY of them) instead of the default most-specific-single behavior. subgroupId stays an AND scope. Opt-in; default behavior is unchanged when omitted. |
| `carrier` | Query Param | Optional | Filter by carrier. |
| `region` | Query Param | Optional | ISO-2 country of the message's sending number: US, GB or CA (UK is accepted for GB). One value, repeated, or comma-separated. Omitted = every region. Legacy records with no region count as US. |
| `regionScopes` | Query Param | Optional | JSON-encoded array of OR-ed branches { region, channels, brandId?, campaignId?, phoneNumber? }, channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p; entity arrays apply within their branch; \[\] matches nothing. |
| `sentimentLabel` | Query Param | Optional | Filter by sentiment. Accepts a single value or an array (cumulative — repeat the param, e.g. sentimentLabel=positive&sentimentLabel=negative, or pass a comma-separated list). Allowed values: positive, neutral, negative. The label is derived from the message's sentimentScore using inclusive ±25 thresholds, so this filter selects the matching score range: positive is >= 25, negative is <= -25, and neutral is everything between. Unscored messages (sentimentScore null) match no value, and outbound messages are never scored. |
| `errorCode` | Query Param | Optional | Filter FAILED messages by Signal House error code (single value, comma-separated list or repeated param). OUT is the campaign opt-out, shown as RECIPIENT\_OPTED\_OUT. Carrier codes are not filterable here; they live inside successOrFailureReason. |
| `startDate` | Query Param | Required | ISO-8601 date or timestamp. Bound per dateBounds: a bare date is always that whole UTC day (the full start day is included); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names, in whatever offset it was written ('2026-09-14T00:00:00-04:00' is 04:00Z), in 'exact' mode. (Required when id is not provided.) |
| `endDate` | Query Param | Required | ISO-8601 date or timestamp. Bound per dateBounds: a bare date is always that whole UTC day (the full end day is included); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names in 'exact' mode, where any byDate buckets also align to the UTC offset this bound carries so a client that sends its own midnights gets its own calendar dates back. (Required when id is not provided.) |
| `dateBounds` | Query Param | Optional | Which contract binds startDate and endDate. day: each bound is widened to its whole UTC day and day buckets are UTC dates. exact: a timestamp is bound as the instant it names, a bare date is its whole UTC day, and day buckets align to the UTC offset the end bound carries. Omitted: day. |
| `templateId` | Query Param | Optional | Filter by the template an RCS message was sent from. This filter, templateVersion, bulkId, fallbackReason, billingClass, deliveredChannel and isTest=true read RCS messages only unless messageType names another type. |
| `templateVersion` | Query Param | Optional | Filter by the template version an RCS message was sent from. A positive whole number; any other value answers 400. |
| `bulkId` | Query Param | Optional | Filter by the bulkId that POST /message/rcs or POST /message/rcs/batch returned: the messages of one send. |
| `fallbackReason` | Query Param | Optional | Filter by why an RCS message ran its fallback: NOT\_CAPABLE, CARRIER\_NOT\_LAUNCHED, TTL\_EXPIRED, RCS\_ERROR, PROVIDER\_ERROR or SMS\_ONLY. |
| `billingClass` | Query Param | Optional | Filter by RCS billing class: RICH or RICH\_MEDIA. |
| `deliveredChannel` | Query Param | Optional | Filter by the channel that delivered an RCS message: rcs, sms or mms. |
| `isTest` | Query Param | Optional | true returns RCS test messages only; false leaves them out. |
| `sortField` | Query Param | Optional | Field to sort by: createdAt, segmentCount, status, or sentimentScore. |
| `sortOrder` | Query Param | Optional | Sort order (asc/desc). |
| `page` | Query Param | Optional | Page number for pagination. |
| `limit` | Query Param | Optional | Results per page. |
| `includeTotal` | Query Param | Optional | true returns { data, total, page, limit, totalPages, totalExact, partial, countError } instead of the array, where data is the page. total is the number of messages the filters match, counted on the analytics mirror, which can trail the list by seconds, so totalExact is false, except with id, where it is true (total 1, or 0 when no message matches). It is null, never 0, when there is no count: countError is FILTER\_NOT\_COUNTABLE when senderPhoneNumber or recipientPhoneNumber is set, and COUNT\_UNAVAILABLE when the count could not run; data is still returned. partial is true when startDate is before 2026-01-12, the first day the count covers, so total counts only from that day. Omitted or false: the bare array, unchanged. |

#### Example Response 200

Response

```json
[
  {
    "_id": "60f7b2a1c9e77c001a2b3c58",
    "groupId": "G1234567",
    "subgroupId": "S1234567",
    "brandId": "B1234567",
    "campaignId": "C1234567",
    "phoneNumber": "12246431042",
    "carrier": "T-Mobile",
    "messageType": "SMS",
    "direction": "OUTBOUND",
    "recipientPhoneNumber": "14175551234",
    "messageBody": "Hello from Signal House API!",
    "segmentCount": 1,
    "sentimentScore": null,
    "sentimentLabel": null,
    "sentimentScoredAt": null,
    "status": "DELIVERED",
    "statusHistory": [
      {
        "timestamp": "2024-01-15T14:30:00.000Z",
        "status": "ENQUEUED"
      },
      {
        "timestamp": "2024-01-15T14:30:01.000Z",
        "status": "DEQUEUED"
      },
      {
        "timestamp": "2024-01-15T14:30:02.000Z",
        "status": "SENT"
      },
      {
        "timestamp": "2024-01-15T14:30:05.000Z",
        "status": "DELIVERED"
      }
    ],
    "cost": 23000,
    "createdAt": "2024-01-15T14:30:00.000Z",
    "updatedAt": "2024-01-15T14:30:05.000Z"
  }
]
```

### POST /message/carrier-id

Look up the carrier for a phone number. Always performs a fresh lookup (not cached). Billed per request. An Australian number on ACMA's list of numbers reserved for TV, film and creative works is refused with a 400 as an invalid number, without a lookup or a charge. Other countries' fiction ranges are looked up and billed as usual.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `phoneNumber` | String | Required | Phone number to look up (10+ digits, no + prefix). |

#### Example Request

Request

```json
{
  "phoneNumber": "14175551234"
}
```

#### Example Response 200

Response

```json
{
  "phoneNumber": "14175551234",
  "carrier": "T-Mobile US",
  "carrierFamily": "TMobile",
  "carrierRegion": null,
  "ported": false,
  "type": "MOBILE",
  "degradedConfidence": false,
  "cost": 3000
}
```

### POST /message/delivery-report

Fetch the latest upstream carrier delivery report for an array of message IDs. Useful for reconciling messages stuck in a non-terminal state (e.g. still SENT). Outbound SMS and MMS messages sent from numbers on the carrier whose delivery logs we read are looked up there (retained for ~48 hours); every other message, including P2P messages and messages sent from numbers on other carriers, returns its stored status with upstreamReportAvailable=false. The request fails with a 500 when the sending numbers can't be read. This is a read-only lookup and does not change message state.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `messageIds` | Array\[String\] | Required | Message IDs to fetch carrier delivery reports for (1-100 per request). |

#### Example Request

Request

```json
{
  "messageIds": [
    "60f7b2a1c9e77c001a2b3c58",
    "60f7b2a1c9e77c001a2b3c59"
  ]
}
```

#### Example Response 200

Response

```json
[
  {
    "messageId": "60f7b2a1c9e77c001a2b3c58",
    "messageType": "SMS",
    "storedStatus": "SENT",
    "upstreamStatus": "DELIVERED",
    "upstreamReportAvailable": true,
    "carrier": "T-Mobile",
    "mccMnc": "310260",
    "successOrFailureReason": "Delivered to handset",
    "sentAt": "2024-01-15T14:30:02.000Z",
    "doneAt": "2024-01-15T14:30:05.000Z"
  }
]
```

### POST /message/estimate

Price an SMS or MMS from a Canadian or UK sender before sending it. The sender must be a Ready Canadian number (recipients in Canada or the US and its territories) or a Ready UK sender — a Virtual Long Code or an Alphanumeric Sender ID — with an approved sender registration (United Kingdom mobile recipients only, SMS only; refused with a 400 while UK sending is not enabled for the environment). For an Alphanumeric Sender ID, segments are counted with the 29-character opt-out link (a newline and 'Opt out: sihou.io/o/…') that is appended to every message, so the estimate matches what is sent and billed. Every recipient is priced on its own rail from the cached carrier identity — the estimate never performs a paid lookup — and every amount is in microdollars (1,000,000 = $1.00). A recipient whose carrier is unresolved is priced at the rail's Default ceiling and flagged with fallback: true. Read-only: nothing is queued, reserved or charged.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `senderPhoneNumber` | String | Required | Your Ready sender: a Canadian number or a UK Virtual Long Code (44…), digits only, or a UK Alphanumeric Sender ID as granted (e.g. ACME), whose sender registration is APPROVED. |
| `recipientPhoneNumbers` | Array\[String\] | Required | 1–100 destination numbers, 10–15 digits each with an optional leading +. A Canadian sender accepts Canada and US/territory numbers; a UK sender accepts United Kingdom mobile numbers only — a landline, a Crown dependency or any other country is refused with a 400. |
| `messageBody` | String | Required | The message text (up to 10,000 characters); segments are counted from it. Must not be empty for SMS; may be empty for MMS. |
| `messageType` | String | Optional | SMS or MMS. Default: SMS. A UK sender is SMS only; MMS is refused with a 400. |

#### Example Request

Request

```json
{
  "senderPhoneNumber": "447700900123",
  "recipientPhoneNumbers": [
    "+447911123456",
    "447911123457"
  ],
  "messageBody": "Your order has shipped. Reply STOP to opt out.",
  "messageType": "SMS"
}
```

#### Example Response 200

Response

```json
{
  "region": "GB",
  "currency": "USD",
  "messageType": "SMS",
  "segments": 1,
  "recipients": [
    {
      "phoneNumber": "447911123456",
      "rate": 45000,
      "amount": 45000,
      "fallback": false
    },
    {
      "phoneNumber": "447911123457",
      "rate": 60000,
      "amount": 60000,
      "fallback": true
    }
  ],
  "total": 105000
}
```

### POST /message/sms

Queue an outbound SMS message. Content blocked by the moderation filter is returned in insertedMessages with status "FAILED" and a reason naming the policy (not a 4xx error); no delivery callback fires for those messages. Recipients who have opted out of the sending campaign are handled the same way: they are returned in insertedMessages with status "FAILED" and the reason "Message failed due to recipient number opting out of the sending campaign", and the request still returns 201 even when every recipient has opted out. Recipients removed by the global Do Not Contact list are reported in dncBlockedNumbers instead and receive no message record. Every response carries requestedRecipientCount, enqueuedCount and failedCount so the outcome can be read without inspecting insertedMessages: enqueuedCount is the number actually accepted for delivery and is 0 when the send was fully blocked, and requestedRecipientCount always equals enqueuedCount + failedCount + dncBlockedNumbers.length + filteredNumbers.length. Because a partially blocked send must still return 201, callers should treat enqueuedCount, not the HTTP status, as the signal that a message was accepted. Each FAILED message carries errorCode, a stable machine-readable cause to branch on instead of string-matching successOrFailureReason: a campaign opt-out is errorCode \\"OUT\\". errorCode is null on success and on failures that have no assigned code, and it is also included on the FAILED status-callback payload. If the request is made with an API key limited to destination countries and any recipient is in another country, the whole request is rejected with 403 and details.code DESTINATION\_COUNTRY\_NOT\_ALLOWED; nothing is queued or charged. For an OAuth connector token, or a request with the X-SignalHouse-Origin: mcp header, per-connection caps apply: at most 10 recipients per call, 50 messages per hour and an estimated $25 a day, to US and Canada recipients only. A breach is refused with 429 and details.code CONNECTOR\_CAP\_EXCEEDED, nothing is queued or charged, and a Retry-After header says when the window resets. See Error Handling.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `senderPhoneNumber` | String | Required | Your active Signal House 5-6 digit Short Code or 10+ digit phone number, or a READY UK Alphanumeric Sender ID exactly as granted (e.g. ACME). A UK Virtual Long Code (44…) or Alphanumeric Sender ID may send only while its sender registration is in a sending status and only while UK sending is enabled for the environment; otherwise the request is refused with a 400. An Alphanumeric Sender ID sends SMS only, to United Kingdom mobiles only, and recipients cannot reply: Signal House appends a newline and a unique opt-out link ("Opt out: sihou.io/o/…", 29 characters) to every message, which counts toward its segments and price, and a recipient who follows it is added to your Do Not Contact list. |
| `recipientPhoneNumber` | Array\[String\] | Required | Array of destination phone numbers. When senderPhoneNumber is a Short Code, exactly one recipient is allowed and it must be a +1 (US/Canada) number; a bare 10-digit number is treated as +1. Any other country code is rejected with a 400 before the message is queued. When senderPhoneNumber is a UK Virtual Long Code or Alphanumeric Sender ID, every recipient must be a United Kingdom mobile number (+44 7…); recipients are normalised to digits-only E.164, and a landline, a Crown dependency (Jersey, Guernsey, the Isle of Man) or any other country is refused with a 400 before the message is queued. |
| `messageBody` | String | Required | The text content of the message. |
| `statusCallbackUrl` | String | Optional | A valid URL to receive delivery receipts. |
| `enableShortlink` | Boolean | Optional | Automatically shorten URLs. |
| `filterLandlinesAndInactiveNumbers` | Boolean | Optional | Filter out landline and inactive numbers before sending. When enabled, the carrier ID lookup fee is charged per number: filtered numbers are charged the lookup fee only, delivered numbers are charged the lookup fee plus the message fee. Default: false. |

#### Example Request

Request

```json
{
  "senderPhoneNumber": "12025551234",
  "recipientPhoneNumber": [
    "14175551234"
  ],
  "messageBody": "Hello from Signal House API! Visit https://signalhouse.io",
  "statusCallbackUrl": "https://example.com/webhooks/message-status",
  "enableShortlink": true,
  "filterLandlinesAndInactiveNumbers": false
}
```

#### Example Response 201

Response

```json
{
  "insertedMessages": [
    {
      "_id": "60f7b2a1c9e77c001a2b3c58",
      "senderPhoneNumber": "12025551234",
      "messageType": "SMS",
      "direction": "OUTBOUND",
      "recipientPhoneNumber": "14175551234",
      "messageBody": "Hello from Signal House API! Visit https://signalhouse.io",
      "segmentCount": 1,
      "status": "ENQUEUED",
      "enableShortlink": true,
      "createdAt": "2024-01-15T14:30:00.000Z"
    }
  ]
}
```

### POST /message/mms

Queue an outbound MMS message. Accepts binary file uploads and external media URLs. Content blocked by the moderation filter is returned in insertedMessages with status "FAILED" and a reason naming the policy (not a 4xx error); no delivery callback fires for those messages. Recipients who have opted out of the sending campaign are handled the same way: they are returned in insertedMessages with status "FAILED" and the reason "Message failed due to recipient number opting out of the sending campaign", and the request still returns 201 even when every recipient has opted out. Recipients removed by the global Do Not Contact list are reported in dncBlockedNumbers instead and receive no message record. Every response carries requestedRecipientCount, enqueuedCount and failedCount so the outcome can be read without inspecting insertedMessages: enqueuedCount is the number actually accepted for delivery and is 0 when the send was fully blocked, and requestedRecipientCount always equals enqueuedCount + failedCount + dncBlockedNumbers.length + filteredNumbers.length. Because a partially blocked send must still return 201, callers should treat enqueuedCount, not the HTTP status, as the signal that a message was accepted. Each FAILED message carries errorCode, a stable machine-readable cause to branch on instead of string-matching successOrFailureReason: a campaign opt-out is errorCode \\"OUT\\". errorCode is null on success and on failures that have no assigned code, and it is also included on the FAILED status-callback payload. If the request is made with an API key limited to destination countries and any recipient is in another country, the whole request is rejected with 403 and details.code DESTINATION\_COUNTRY\_NOT\_ALLOWED; nothing is queued or charged. Some toll-free carriers don't support MMS; a send from such a number is refused (400). The sender's brand reports it as \`tollFree.supportsMms\`. For an OAuth connector token, or a request with the X-SignalHouse-Origin: mcp header, per-connection caps apply: at most 10 recipients per call, 50 messages per hour and an estimated $25 a day, to US and Canada recipients only. A breach is refused with 429 and details.code CONNECTOR\_CAP\_EXCEEDED, nothing is queued or charged, and a Retry-After header says when the window resets. See Error Handling.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `senderPhoneNumber` | String | Required | Your active Signal House 5-6 digit Short Code or 10+ digit phone number. A UK Virtual Long Code cannot send MMS: the request is refused with a 400. |
| `recipientPhoneNumber` | Array\[String\] or String | Required | Destination phone number(s). When senderPhoneNumber is a Short Code, exactly one recipient is allowed and it must be a +1 (US/Canada) number; a bare 10-digit number is treated as +1. Any other country code is rejected with a 400 before the message is queued. |
| `messageBody` | String | Optional | Text content. Defaults to an empty string when omitted. |
| `statusCallbackUrl` | String | Optional | A valid URL to receive delivery receipts. |
| `mediaUrls` | Array\[String\] | Optional | Array of up to 5 valid URLs for media. |
| `images` | File | Optional | Up to 5 file attachments (Max 10MB total). Requires multipart/form-data. |
| `enableCompression` | Boolean | Optional | Auto-compress images to fit carrier limits. Default: false. |
| `enableShortlink` | Boolean | Optional | Automatically shorten URLs. Default: false. |
| `filterLandlinesAndInactiveNumbers` | Boolean | Optional | Filter out landline and inactive numbers before sending. When enabled, the carrier ID lookup fee is charged per number: filtered numbers are charged the lookup fee only, delivered numbers are charged the lookup fee plus the message fee. Default: false. |

#### Example Request

Request

```json
{
  "senderPhoneNumber": "12025551234",
  "recipientPhoneNumber": [
    "14175551234"
  ],
  "messageBody": "Check out this image!",
  "statusCallbackUrl": "https://example.com/webhooks/message-status",
  "mediaUrls": [
    "https://example.com/photo.jpg"
  ],
  "enableCompression": true,
  "enableShortlink": false,
  "filterLandlinesAndInactiveNumbers": false
}
```

#### Example Response 201

Response

```json
{
  "insertedMessages": [
    {
      "_id": "60f7b2a1c9e77c001a2b3c59",
      "senderPhoneNumber": "12025551234",
      "messageType": "MMS",
      "direction": "OUTBOUND",
      "recipientPhoneNumber": "14175551234",
      "messageBody": "Check out this image!",
      "segmentCount": 1,
      "status": "ENQUEUED",
      "createdAt": "2024-01-15T14:30:00.000Z"
    }
  ]
}
```

### POST /message/groupMessage

Queue an outbound Group Message to multiple recipients. Accepts binary file uploads and external media URLs. Content blocked by the moderation filter is returned in insertedMessages with status "FAILED" and a reason naming the policy (not a 4xx error); no delivery callback fires for those messages. Recipients who have opted out of the sending campaign are handled the same way: they are returned in insertedMessages with status "FAILED" and the reason "Message failed due to recipient number opting out of the sending campaign", and the request still returns 201 even when every recipient has opted out. Recipients removed by the global Do Not Contact list are reported in dncBlockedNumbers instead and receive no message record. Every response carries requestedRecipientCount, enqueuedCount and failedCount so the outcome can be read without inspecting insertedMessages: enqueuedCount is the number actually accepted for delivery and is 0 when the send was fully blocked, and requestedRecipientCount always equals enqueuedCount + failedCount + dncBlockedNumbers.length + filteredNumbers.length. Because a partially blocked send must still return 201, callers should treat enqueuedCount, not the HTTP status, as the signal that a message was accepted. Each FAILED message carries errorCode, a stable machine-readable cause to branch on instead of string-matching successOrFailureReason: a campaign opt-out is errorCode \\"OUT\\". errorCode is null on success and on failures that have no assigned code, and it is also included on the FAILED status-callback payload. If the request is made with an API key limited to destination countries and any recipient is in another country, the whole request is rejected with 403 and details.code DESTINATION\_COUNTRY\_NOT\_ALLOWED; nothing is queued or charged. Some toll-free carriers don't support MMS; a send from such a number is refused (400). The sender's brand reports it as \`tollFree.supportsMms\`. For an OAuth connector token, or a request with the X-SignalHouse-Origin: mcp header, per-connection caps apply: at most 10 recipients per call, 50 messages per hour and an estimated $25 a day, to US and Canada recipients only. A breach is refused with 429 and details.code CONNECTOR\_CAP\_EXCEEDED, nothing is queued or charged, and a Retry-After header says when the window resets. See Error Handling.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `senderPhoneNumber` | String | Required | Your active Signal House 10DLC number. A UK Virtual Long Code cannot send MMS: the request is refused with a 400. |
| `recipientPhoneNumber` | Array\[String\] | Required | Array of destination phone numbers. |
| `messageBody` | String | Optional | Text content. Defaults to an empty string when omitted. |
| `statusCallbackUrl` | String | Optional | A valid URL to receive delivery receipts. |
| `mediaUrls` | Array\[String\] | Optional | Array of up to 5 valid URLs for media. |
| `images` | File | Optional | Up to 5 file attachments (Max 10MB total). Requires multipart/form-data. |
| `enableCompression` | Boolean | Optional | Auto-compress images to fit carrier limits. |
| `enableShortlink` | Boolean | Optional | Automatically shorten URLs. |
| `filterLandlinesAndInactiveNumbers` | Boolean | Optional | Filter out landline and inactive numbers before sending. When enabled, the carrier ID lookup fee is charged per number: filtered numbers are charged the lookup fee only, delivered numbers are charged the lookup fee plus the message fee. Default: false. |

#### Example Request

Request

```json
{
  "senderPhoneNumber": "12025551234",
  "recipientPhoneNumber": [
    "14175551234",
    "14175551235"
  ],
  "messageBody": "Team update: meeting at 3pm.",
  "statusCallbackUrl": "https://example.com/webhooks/message-status",
  "mediaUrls": [
    "https://example.com/agenda.pdf"
  ],
  "enableCompression": true,
  "enableShortlink": false,
  "filterLandlinesAndInactiveNumbers": false
}
```

#### Example Response 201

Response

```json
{
  "insertedMessages": [
    {
      "_id": "60f7b2a1c9e77c001a2b3c5a",
      "senderPhoneNumber": "12025551234",
      "messageType": "MMS",
      "direction": "OUTBOUND",
      "recipientPhoneNumber": "14175551234",
      "status": "ENQUEUED",
      "isGroupMessage": true,
      "createdAt": "2024-01-15T14:30:00.000Z"
    }
  ]
}
```

### POST /message/rcs

Queue an RCS message from an agent, with inline content or a published template. A check that stops one recipient returns it as BLOCKED, with blockReason, and sends to the rest; only a request-level problem fails the call. Nothing is charged until delivery. A recipient who cannot take RCS gets the SMS or MMS fallback, billed as an ordinary message. For an OAuth connector token, or a request with the X-SignalHouse-Origin: mcp header, per-connection caps apply: at most 10 recipients per call, 50 messages per hour and an estimated $25 a day, to US and Canada recipients only. A breach is refused with 429 and details.code CONNECTOR\_CAP\_EXCEEDED, nothing is queued or charged, and a Retry-After header says when the window resets. See Error Handling.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentId` | Body Param | Required | The sending agent (RCSA…). It must be in testing or launched. Before any carrier launches, the agent reaches its approved testers only. |
| `recipients` | Body Param | Required | 1 to 100 recipients, each { phoneNumber, variables?, clientMessageId?, metadata? }. variables holds the template values for that recipient. clientMessageId is your own id: it returns on every event, and a repeat sends again. To retry a request safely, send an Idempotency-Key header. metadata (up to 20 string values of up to 500 characters) returns on every event. A reply, a tap, an opt-out and an SMS reply to the fallback number carry both from the message they answer. A simulated delivery error number (19999990000 to 19999990359) makes the whole request a simulation, as on SMS: the response is { simulated: true, webhooks } and nothing is stored, sent or charged. |
| `content` | Body Param | Optional | Inline content.v1 blocks. Send exactly one of content or templateId. Inline content declares no variables, so a placeholder other than {{sender\_name}} is refused. |
| `contentFormat` | Body Param | Optional | content.v1 (the default) or google.rcs, which the API converts to content.v1. |
| `templateId` | Body Param | Optional | A published template. Templates belong to the group, so any of its agents can send one. An archived template answers 409 TEMPLATE\_ARCHIVED. |
| `templateVersion` | Body Param | Optional | A published version; defaults to the current one. The version is pinned at enqueue. |
| `trafficType` | Body Param | Optional | AUTHENTICATION, TRANSACTION, SERVICEREQUEST, ACKNOWLEDGEMENT or PROMOTION. Required on a MULTI\_USE agent, unless a template sets it, and must suit the agent's use case. |
| `ttlSeconds` | Body Param | Optional | Time to live, inside the traffic type's range. Send at most one of ttlSeconds or expireTime. Defaults: AUTHENTICATION 30 (15 to 300), TRANSACTION and SERVICEREQUEST 900 (60 to 86400), ACKNOWLEDGEMENT 300 (60 to 3600), PROMOTION 14400 (600 to 172800). |
| `expireTime` | Body Param | Optional | ISO 8601 instant the message expires, inside the same range. |
| `fallback` | Body Param | Optional | { mode?, channel?, from?, content?, validitySeconds? }. mode: auto (the default), rcs\_only or sms\_only. channel: auto, sms or mms. from: a Ready number on the agent's linked Active campaign, of any registration type; defaults to the template's, then the agent's defaultFallback. content: { text, mediaUrls? }; omitted, the template's fallback is used, otherwise one is generated from the RCS content. A recipient whose fallback has no text to send is blocked with CONTENT\_INVALID. validitySeconds: how long the provider tries the fallback; it applies to an SMS leg sent through Infobip, and MMS, Twilio and Sinch legs ignore it. |
| `statusCallbackUrl` | Body Param | Optional | A URL that receives this message's events, each as one flat object: { event, timestamp, ...metaData }. Each post is signed with your group's oldest Global webhook's secret, and is unsigned when the group has no Global webhook. See Webhook Signing. |
| `enableShortlink` | Body Param | Optional | Shorten links on the fallback leg. RCS links are not shortened; a tap reports through SUGGESTION\_RESPONSE. |
| `isTest` | Body Param | Optional | Mark the send as a test. Every recipient must be an approved tester of the agent. |
| `simulate` | Body Param | Optional | not\_capable, ttl\_expired, delivered or read: fake the RCS outcome with no carrier call, for approved testers only. A fallback it triggers is a real, billed SMS. See Simulated Delivery Errors. |

#### Example Request

Request

```json
{
  "agentId": "RCSA7K2M1QZ8RP",
  "trafficType": "TRANSACTION",
  "recipients": [
    {
      "phoneNumber": "12025550187",
      "clientMessageId": "ord-48213",
      "metadata": {
        "orderId": "A-48213"
      }
    },
    {
      "phoneNumber": "12025550189"
    }
  ],
  "content": {
    "blocks": [
      {
        "id": "b1",
        "kind": "text",
        "text": "Your order from {{sender_name}} is ready for pickup."
      },
      {
        "id": "b2",
        "kind": "suggestions",
        "suggestions": [
          {
            "type": "REPLY",
            "label": "Thanks",
            "postbackData": "order_ack"
          },
          {
            "type": "OPEN_URL",
            "label": "Track package",
            "postbackData": "track_pkg",
            "url": "https://www.acme.example/track/A-48213",
            "application": "BROWSER"
          }
        ]
      }
    ]
  },
  "fallback": {
    "mode": "auto",
    "channel": "sms",
    "from": "12025550143",
    "content": {
      "text": "Your order is ready for pickup: https://www.acme.example/track/A-48213"
    }
  }
}
```

#### Example Response 201

Response

```json
{
  "requested": 2,
  "enqueued": 1,
  "failed": 1,
  "bulkId": "6f1d2c4e-1b7a-4f6e-9c1d-2f7a4e0b8a11",
  "messages": [
    {
      "phoneNumber": "12025550187",
      "messageId": "6912f0a1c4e8a73d9b2e4f10",
      "clientMessageId": "ord-48213",
      "status": "QUEUED",
      "blockReason": null,
      "reason": null,
      "issues": [],
      "predictedChannel": "rcs",
      "billingClass": "RICH",
      "segments": 1,
      "estimatedCostMicros": 10800,
      "carrier": "T-Mobile"
    },
    {
      "phoneNumber": "12025550189",
      "messageId": "6912f0a1c4e8a73d9b2e4f13",
      "status": "BLOCKED",
      "blockReason": "OPTED_OUT",
      "reason": "The recipient has opted out",
      "issues": [],
      "predictedChannel": null,
      "billingClass": null,
      "segments": 0,
      "estimatedCostMicros": 0,
      "carrier": null
    }
  ]
}
```

### POST /message/rcs

The same endpoint with a template: name templateId and give each recipient its variables. The sending agent is chosen on each send, not on the template. A recipient with no value for a variable, where an empty value or only spaces counts as none, gets what the variable's missingPolicy says (see Templates). It is BLOCKED with VARIABLE\_MISSING when the policy is block, when the variable is required with no default and no policy, or when a drop leaves nothing to send. For an OAuth connector token, or a request with the X-SignalHouse-Origin: mcp header, per-connection caps apply: at most 10 recipients per call, 50 messages per hour and an estimated $25 a day, to US and Canada recipients only. A breach is refused with 429 and details.code CONNECTOR\_CAP\_EXCEEDED, nothing is queued or charged, and a Retry-After header says when the window resets. See Error Handling.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentId` | Body Param | Required | The sending agent (RCSA…). It must be in testing or launched. Before any carrier launches, the agent reaches its approved testers only. |
| `recipients` | Body Param | Required | 1 to 100 recipients, each { phoneNumber, variables?, clientMessageId?, metadata? }. variables holds the template values for that recipient. clientMessageId is your own id: it returns on every event, and a repeat sends again. To retry a request safely, send an Idempotency-Key header. metadata (up to 20 string values of up to 500 characters) returns on every event. A reply, a tap, an opt-out and an SMS reply to the fallback number carry both from the message they answer. A simulated delivery error number (19999990000 to 19999990359) makes the whole request a simulation, as on SMS: the response is { simulated: true, webhooks } and nothing is stored, sent or charged. |
| `content` | Body Param | Optional | Inline content.v1 blocks. Send exactly one of content or templateId. Inline content declares no variables, so a placeholder other than {{sender\_name}} is refused. |
| `contentFormat` | Body Param | Optional | content.v1 (the default) or google.rcs, which the API converts to content.v1. |
| `templateId` | Body Param | Optional | A published template. Templates belong to the group, so any of its agents can send one. An archived template answers 409 TEMPLATE\_ARCHIVED. |
| `templateVersion` | Body Param | Optional | A published version; defaults to the current one. The version is pinned at enqueue. |
| `trafficType` | Body Param | Optional | AUTHENTICATION, TRANSACTION, SERVICEREQUEST, ACKNOWLEDGEMENT or PROMOTION. Required on a MULTI\_USE agent, unless a template sets it, and must suit the agent's use case. |
| `ttlSeconds` | Body Param | Optional | Time to live, inside the traffic type's range. Send at most one of ttlSeconds or expireTime. Defaults: AUTHENTICATION 30 (15 to 300), TRANSACTION and SERVICEREQUEST 900 (60 to 86400), ACKNOWLEDGEMENT 300 (60 to 3600), PROMOTION 14400 (600 to 172800). |
| `expireTime` | Body Param | Optional | ISO 8601 instant the message expires, inside the same range. |
| `fallback` | Body Param | Optional | { mode?, channel?, from?, content?, validitySeconds? }. mode: auto (the default), rcs\_only or sms\_only. channel: auto, sms or mms. from: a Ready number on the agent's linked Active campaign, of any registration type; defaults to the template's, then the agent's defaultFallback. content: { text, mediaUrls? }; omitted, the template's fallback is used, otherwise one is generated from the RCS content. A recipient whose fallback has no text to send is blocked with CONTENT\_INVALID. validitySeconds: how long the provider tries the fallback; it applies to an SMS leg sent through Infobip, and MMS, Twilio and Sinch legs ignore it. |
| `statusCallbackUrl` | Body Param | Optional | A URL that receives this message's events, each as one flat object: { event, timestamp, ...metaData }. Each post is signed with your group's oldest Global webhook's secret, and is unsigned when the group has no Global webhook. See Webhook Signing. |
| `enableShortlink` | Body Param | Optional | Shorten links on the fallback leg. RCS links are not shortened; a tap reports through SUGGESTION\_RESPONSE. |
| `isTest` | Body Param | Optional | Mark the send as a test. Every recipient must be an approved tester of the agent. |
| `simulate` | Body Param | Optional | not\_capable, ttl\_expired, delivered or read: fake the RCS outcome with no carrier call, for approved testers only. A fallback it triggers is a real, billed SMS. See Simulated Delivery Errors. |

#### Example Request

Request

```json
{
  "agentId": "RCSA7K2M1QZ8RP",
  "templateId": "TPL0000123",
  "templateVersion": 3,
  "recipients": [
    {
      "phoneNumber": "12025550187",
      "variables": {
        "order_number": "A-48213"
      }
    },
    {
      "phoneNumber": "12025550188",
      "variables": {
        "order_number": "A-48214"
      }
    }
  ]
}
```

#### Example Response 201

Response

```json
{
  "requested": 2,
  "enqueued": 1,
  "failed": 1,
  "bulkId": "6f1d2c4e-1b7a-4f6e-9c1d-2f7a4e0b8a11",
  "messages": [
    {
      "phoneNumber": "12025550187",
      "messageId": "6912f0a1c4e8a73d9b2e4f10",
      "clientMessageId": "ord-48213",
      "status": "QUEUED",
      "blockReason": null,
      "reason": null,
      "issues": [],
      "predictedChannel": "rcs",
      "billingClass": "RICH",
      "segments": 1,
      "estimatedCostMicros": 10800,
      "carrier": "T-Mobile"
    },
    {
      "phoneNumber": "12025550189",
      "messageId": "6912f0a1c4e8a73d9b2e4f13",
      "status": "BLOCKED",
      "blockReason": "OPTED_OUT",
      "reason": "The recipient has opted out",
      "issues": [],
      "predictedChannel": null,
      "billingClass": null,
      "segments": 0,
      "estimatedCostMicros": 0,
      "carrier": null
    }
  ]
}
```

### POST /message/rcs/batch

Send to up to 10,000 recipients in the background, with the body of POST /message/rcs. The request runs that route's request checks at once, so a bad template, traffic type, time to live or fallback sender answers 400 and nothing is queued, then answers 202 with the batch's bulkId. The recipients are queued in chunks of 100, and each chunk goes through every check of POST /message/rcs, so each recipient is checked, blocked and charged as on that route. Each chunk holds its own funds: the recipients of a chunk the wallet cannot cover are BLOCKED with INSUFFICIENT\_FUNDS, and the other chunks still send. A chunk refused after the batch was accepted blocks its recipients with SEND\_REFUSED, and one that keeps failing blocks them with SEND\_FAILED. Every message carries the bulkId: follow the batch with GET /message?bulkId= and the per-message webhooks. Send an Idempotency-Key header so a retried request sends no recipient twice. A template send uses the version current when the batch is accepted. ttlSeconds counts from when each chunk is sent. The request body is capped at 5 MB, about 500 bytes per recipient at 10,000 recipients, and each chunk of 100 recipients with the request must fit in 254 KB, or the request answers 400 with BATCH\_CHUNK\_TOO\_LARGE. For an OAuth connector token, or a request with the X-SignalHouse-Origin: mcp header, per-connection caps apply: at most 10 recipients per call, 50 messages per hour and an estimated $25 a day, to US and Canada recipients only. A breach is refused with 429 and details.code CONNECTOR\_CAP\_EXCEEDED, nothing is queued or charged, and a Retry-After header says when the window resets. See Error Handling.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentId` | Body Param | Required | The sending agent (RCSA…). It must be in testing or launched. Before any carrier launches, the agent reaches its approved testers only. |
| `recipients` | Body Param | Required | 1 to 10,000 recipients, each { phoneNumber, variables?, clientMessageId?, metadata? }. variables holds the template values for that recipient. clientMessageId is your own id: it returns on every event, and a repeat sends again. To retry a request safely, send an Idempotency-Key header. metadata (up to 20 string values of up to 500 characters) returns on every event. A reply, a tap, an opt-out and an SMS reply to the fallback number carry both from the message they answer. A simulated delivery error number (19999990000 to 19999990359) makes the whole request a simulation, as on SMS: the response is { simulated: true, webhooks } and nothing is stored, sent or charged. |
| `content` | Body Param | Optional | Inline content.v1 blocks. Send exactly one of content or templateId. Inline content declares no variables, so a placeholder other than {{sender\_name}} is refused. |
| `contentFormat` | Body Param | Optional | content.v1 (the default) or google.rcs, which the API converts to content.v1. |
| `templateId` | Body Param | Optional | A published template. Templates belong to the group, so any of its agents can send one. An archived template answers 409 TEMPLATE\_ARCHIVED. |
| `templateVersion` | Body Param | Optional | A published version; defaults to the current one. The version is pinned at enqueue. |
| `trafficType` | Body Param | Optional | AUTHENTICATION, TRANSACTION, SERVICEREQUEST, ACKNOWLEDGEMENT or PROMOTION. Required on a MULTI\_USE agent, unless a template sets it, and must suit the agent's use case. |
| `ttlSeconds` | Body Param | Optional | Time to live, inside the traffic type's range. Send at most one of ttlSeconds or expireTime. Defaults: AUTHENTICATION 30 (15 to 300), TRANSACTION and SERVICEREQUEST 900 (60 to 86400), ACKNOWLEDGEMENT 300 (60 to 3600), PROMOTION 14400 (600 to 172800). |
| `expireTime` | Body Param | Optional | ISO 8601 instant the message expires, inside the same range. |
| `fallback` | Body Param | Optional | { mode?, channel?, from?, content?, validitySeconds? }. mode: auto (the default), rcs\_only or sms\_only. channel: auto, sms or mms. from: a Ready number on the agent's linked Active campaign, of any registration type; defaults to the template's, then the agent's defaultFallback. content: { text, mediaUrls? }; omitted, the template's fallback is used, otherwise one is generated from the RCS content. A recipient whose fallback has no text to send is blocked with CONTENT\_INVALID. validitySeconds: how long the provider tries the fallback; it applies to an SMS leg sent through Infobip, and MMS, Twilio and Sinch legs ignore it. |
| `statusCallbackUrl` | Body Param | Optional | A URL that receives this message's events, each as one flat object: { event, timestamp, ...metaData }. Each post is signed with your group's oldest Global webhook's secret, and is unsigned when the group has no Global webhook. See Webhook Signing. |
| `enableShortlink` | Body Param | Optional | Shorten links on the fallback leg. RCS links are not shortened; a tap reports through SUGGESTION\_RESPONSE. |
| `isTest` | Body Param | Optional | Mark the send as a test. Every recipient must be an approved tester of the agent. |
| `simulate` | Body Param | Optional | not\_capable, ttl\_expired, delivered or read: fake the RCS outcome with no carrier call, for approved testers only. A fallback it triggers is a real, billed SMS. See Simulated Delivery Errors. |

#### Example Request

Request

```json
{
  "agentId": "RCSA7K2M1QZ8RP",
  "templateId": "TPL0000123",
  "trafficType": "TRANSACTION",
  "recipients": [
    {
      "phoneNumber": "12025550187",
      "variables": {
        "order_number": "A-48213"
      }
    },
    {
      "phoneNumber": "12025550188",
      "variables": {
        "order_number": "A-48214"
      }
    }
  ],
  "statusCallbackUrl": "https://www.acme.example/rcs-status"
}
```

#### Example Response 202

Response

```json
{
  "bulkId": "b8f2c3d4-0e1f-4a5b-9c6d-7e8f9a0b1c2d",
  "status": "ACCEPTED",
  "recipientCount": 2
}
```

### POST /message/rcs/validate

Run the checks of POST /message/rcs on the same body, and stop before funds are held. Nothing is written. valid is true only with no errors: each blocked recipient adds one, and INSUFFICIENT\_FUNDS reports a wallet that cannot cover the send. warnings lists what looks different on an iPhone, and never blocks. segments is null for Rich Media, and a leg the fallback policy forbids costs null. unsupportedFiles lists the media of a message over the 100 MB limit. An external media URL that answers with a redirect adds a MEDIA\_REDIRECT error. A destination the API key may not reach answers 403, as on the send.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentId` | Body Param | Required | The sending agent (RCSA…). It must be in testing or launched. Before any carrier launches, the agent reaches its approved testers only. |
| `recipients` | Body Param | Required | 1 to 100 recipients, each { phoneNumber, variables?, clientMessageId?, metadata? }. variables holds the template values for that recipient. clientMessageId is your own id: it returns on every event, and a repeat sends again. To retry a request safely, send an Idempotency-Key header. metadata (up to 20 string values of up to 500 characters) returns on every event. A reply, a tap, an opt-out and an SMS reply to the fallback number carry both from the message they answer. A simulated delivery error number (19999990000 to 19999990359) makes the whole request a simulation, as on SMS: the response is { simulated: true, webhooks } and nothing is stored, sent or charged. |
| `content` | Body Param | Optional | Inline content.v1 blocks. Send exactly one of content or templateId. Inline content declares no variables, so a placeholder other than {{sender\_name}} is refused. |
| `contentFormat` | Body Param | Optional | content.v1 (the default) or google.rcs, which the API converts to content.v1. |
| `templateId` | Body Param | Optional | A published template. Templates belong to the group, so any of its agents can send one. An archived template answers 409 TEMPLATE\_ARCHIVED. |
| `templateVersion` | Body Param | Optional | A published version; defaults to the current one. The version is pinned at enqueue. |
| `trafficType` | Body Param | Optional | AUTHENTICATION, TRANSACTION, SERVICEREQUEST, ACKNOWLEDGEMENT or PROMOTION. Required on a MULTI\_USE agent, unless a template sets it, and must suit the agent's use case. |
| `ttlSeconds` | Body Param | Optional | Time to live, inside the traffic type's range. Send at most one of ttlSeconds or expireTime. Defaults: AUTHENTICATION 30 (15 to 300), TRANSACTION and SERVICEREQUEST 900 (60 to 86400), ACKNOWLEDGEMENT 300 (60 to 3600), PROMOTION 14400 (600 to 172800). |
| `expireTime` | Body Param | Optional | ISO 8601 instant the message expires, inside the same range. |
| `fallback` | Body Param | Optional | { mode?, channel?, from?, content?, validitySeconds? }. mode: auto (the default), rcs\_only or sms\_only. channel: auto, sms or mms. from: a Ready number on the agent's linked Active campaign, of any registration type; defaults to the template's, then the agent's defaultFallback. content: { text, mediaUrls? }; omitted, the template's fallback is used, otherwise one is generated from the RCS content. A recipient whose fallback has no text to send is blocked with CONTENT\_INVALID. validitySeconds: how long the provider tries the fallback; it applies to an SMS leg sent through Infobip, and MMS, Twilio and Sinch legs ignore it. |
| `statusCallbackUrl` | Body Param | Optional | A URL that receives this message's events, each as one flat object: { event, timestamp, ...metaData }. Each post is signed with your group's oldest Global webhook's secret, and is unsigned when the group has no Global webhook. See Webhook Signing. |
| `enableShortlink` | Body Param | Optional | Shorten links on the fallback leg. RCS links are not shortened; a tap reports through SUGGESTION\_RESPONSE. |
| `isTest` | Body Param | Optional | Mark the send as a test. Every recipient must be an approved tester of the agent. |
| `simulate` | Body Param | Optional | not\_capable, ttl\_expired, delivered or read: fake the RCS outcome with no carrier call, for approved testers only. A fallback it triggers is a real, billed SMS. See Simulated Delivery Errors. |

#### Example Request

Request

```json
{
  "agentId": "RCSA7K2M1QZ8RP",
  "trafficType": "TRANSACTION",
  "recipients": [
    {
      "phoneNumber": "12025550187",
      "clientMessageId": "ord-48213",
      "metadata": {
        "orderId": "A-48213"
      }
    },
    {
      "phoneNumber": "12025550189"
    }
  ],
  "content": {
    "blocks": [
      {
        "id": "b1",
        "kind": "text",
        "text": "Your order from {{sender_name}} is ready for pickup."
      },
      {
        "id": "b2",
        "kind": "suggestions",
        "suggestions": [
          {
            "type": "REPLY",
            "label": "Thanks",
            "postbackData": "order_ack"
          },
          {
            "type": "OPEN_URL",
            "label": "Track package",
            "postbackData": "track_pkg",
            "url": "https://www.acme.example/track/A-48213",
            "application": "BROWSER"
          }
        ]
      }
    ]
  },
  "fallback": {
    "mode": "auto",
    "channel": "sms",
    "from": "12025550143",
    "content": {
      "text": "Your order is ready for pickup: https://www.acme.example/track/A-48213"
    }
  }
}
```

#### Example Response

Response

```json
{
  "valid": true,
  "errors": [],
  "warnings": [
    {
      "severity": "warning",
      "code": "IOS_CHIPS_COLLAPSE",
      "path": "content.blocks",
      "message": "More than two suggested actions collapse into an Options menu on iPhone.",
      "blockId": "s1"
    }
  ],
  "billingClass": "RICH",
  "segments": 1,
  "estimatedCostMicros": {
    "rcs": 10800,
    "fallback": 10500
  },
  "unsupportedFiles": [],
  "recipients": [
    {
      "phoneNumber": "12025550187",
      "status": "OK",
      "blockReason": null,
      "reason": null,
      "issues": [],
      "predictedChannel": "rcs",
      "billingClass": "RICH",
      "segments": 1,
      "estimatedCostMicros": 10800,
      "carrier": "T-Mobile"
    }
  ]
}
```

### POST /message/estimate

The RCS form of the estimate: each leg's cost, and the range from every recipient falling back to every one delivering over RCS. issues lists what would block the send, and warnings what an iPhone draws differently. While the agent has no launched carrier, its traffic is test traffic and the RCS leg costs 0; the fallback leg is still priced. rcsLeg.mediaSurcharge is the carrier's surcharge on media over 5 MB for one recipient, and rcsLeg.cost already holds it for every recipient; rcsLeg.cost is null with the fallback mode sms\_only, and issues names a message over the carrier's 100 MB limit (MEDIA\_TOO\_LARGE) and an external media URL that redirects (MEDIA\_REDIRECT). A send blocks that recipient with CONTENT\_INVALID. With no carrier to look up, the estimate prices the dearest carrier.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `channel` | Body Param | Required | rcs selects this form of the estimate. Without it, the endpoint takes its SMS and MMS form. |
| `agentId` | Body Param | Required | The sending agent. |
| `recipients` | Body Param | Optional | Named recipients, as on POST /message/rcs. Send exactly one of recipients or recipientCount. |
| `recipientCount` | Body Param | Optional | How many recipients to price. Their carriers are unknown, so default carrier fees apply. balance.insufficient in the response is true when the wallet cannot fund the dearer leg, counting auto recharge and net pricing. |
| `content / templateId` | Body Param | Required | Exactly one, as on POST /message/rcs. |
| `templateVersion` | Body Param | Optional | As on POST /message/rcs. |
| `contentFormat` | Body Param | Optional | As on POST /message/rcs. |
| `trafficType` | Body Param | Optional | As on POST /message/rcs: required on a MULTI\_USE agent, unless a template sets it. |
| `ttlSeconds / expireTime` | Body Param | Optional | At most one, as on POST /message/rcs. |
| `fallback` | Body Param | Optional | As on POST /message/rcs, but the sender is optional here: with no fallback.from, the fallback leg is priced on the channel of the agent's linked campaign. |

#### Example Request

Request

```json
{
  "channel": "rcs",
  "agentId": "RCSA7K2M1QZ8RP",
  "recipientCount": 1000,
  "content": {
    "blocks": [
      {
        "id": "b1",
        "kind": "text",
        "text": "Your order from {{sender_name}} is ready for pickup."
      },
      {
        "id": "b2",
        "kind": "suggestions",
        "suggestions": [
          {
            "type": "REPLY",
            "label": "Thanks",
            "postbackData": "order_ack"
          },
          {
            "type": "OPEN_URL",
            "label": "Track package",
            "postbackData": "track_pkg",
            "url": "https://www.acme.example/track/A-48213",
            "application": "BROWSER"
          }
        ]
      }
    ]
  },
  "fallback": {
    "from": "12025550143"
  }
}
```

#### Example Response

Response

```json
{
  "billingClass": "RICH",
  "segments": 1,
  "recipientCount": 1000,
  "rcsLeg": {
    "cost": 6500000,
    "rate": 6500,
    "mediaSurcharge": 0
  },
  "fallbackLeg": {
    "cost": 10500000,
    "channel": "sms",
    "from": "12025550143"
  },
  "totals": {
    "min": 6500000,
    "max": 10500000
  },
  "balance": {
    "available": 25000000,
    "after": 14500000,
    "insufficient": false
  },
  "issues": [],
  "warnings": []
}
```

### POST /rcs/capabilities

Report which numbers can receive RCS from an agent, and why. An agent of another group is refused. Answers are cached for 24 hours per agent and number.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentId` | Body Param | Required | The agent to check against. |
| `phoneNumbers` | Body Param | Required | 1 to 500 numbers. |
| `results[].capability` | Response | Optional | What the carrier partner answered: ENABLED, UNREACHABLE or UNKNOWN. An agent with no launched carrier is not asked, so it reads UNKNOWN. |
| `results[].reason` | Response | Optional | CAPABLE, NOT\_CAPABLE, NOT\_LAUNCHED\_ON\_CARRIER or UNKNOWN. Before any carrier launches, an approved tester is CAPABLE and any other number NOT\_LAUNCHED\_ON\_CARRIER. |
| `results[].rcsEnabled` | Response | Optional | true only when reason is CAPABLE. A send to an UNKNOWN number still tries RCS. |
| `results[].features` | Response | Optional | Always empty today: the carrier partner's answer names no handset features. |
| `results[].carrier` | Response | Optional | The number's carrier, or null when the lookup has no answer or carrier lookup is off for the group. |
| `results[].checkedAt` | Response | Optional | When the carrier partner gave this answer, or null when it was not asked. |
| `results[].cached` | Response | Optional | Whether the answer came from the 24-hour cache, which is kept per agent and number. |

#### Example Request

Request

```json
{
  "agentId": "RCSA7K2M1QZ8RP",
  "phoneNumbers": [
    "12025550187",
    "12025550188"
  ]
}
```

#### Example Response

Response

```json
{
  "results": [
    {
      "phoneNumber": "12025550187",
      "capability": "ENABLED",
      "rcsEnabled": true,
      "reason": "CAPABLE",
      "features": [],
      "carrier": "Verizon Wireless",
      "checkedAt": "2026-11-10T14:58:02.000Z",
      "cached": true
    },
    {
      "phoneNumber": "12025550188",
      "capability": "UNREACHABLE",
      "rcsEnabled": false,
      "reason": "NOT_CAPABLE",
      "features": [],
      "carrier": "AT&T",
      "checkedAt": "2026-11-10T15:03:09.000Z",
      "cached": false
    }
  ]
}
```

### POST /message/rcs/simulate-inbound

Fake a reply or tap from an approved tester, with no handset or carrier. The event runs the real inbound handlers and fires the real webhooks, so a test exercises your handler end to end. Rows are marked isTest, nothing is charged, and any automatic reply is simulated too. The effects are real otherwise: a simulated STOP opts the tester out of this agent until a simulated START.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `agentId` | Body Param | Required | The agent the event reaches. It must be in testing or launched. |
| `from` | Body Param | Required | The tester's number. Anyone but an approved tester of this agent gets a 403 with code NOT\_TESTER, and nothing is queued. |
| `type` | Body Param | Required | TEXT, SUGGESTION, LOCATION, FILE or UNSUBSCRIBE. UNSUBSCRIBE arrives as the text STOP. |
| `text` | Body Param | Optional | Required for TEXT. On a SUGGESTION, the label; the tapped suggestion's label by default. |
| `postbackData` | Body Param | Optional | The tapped suggestion's postback. A SUGGESTION needs this or buttonId. |
| `messageId` | Body Param | Optional | The message a tap answers. By default, the latest message delivered to the tester in the last 24 hours. An unknown ID answers 404. |
| `buttonId` | Body Param | Optional | The suggestion's position, as SUGGESTION\_RESPONSE reports it. Found from postbackData when left out. |
| `latitude` | Body Param | Optional | Required for LOCATION. |
| `longitude` | Body Param | Optional | Required for LOCATION. |
| `fileName` | Body Param | Optional | The file's name, for FILE. |

#### Example Request

Request

```json
{
  "agentId": "RCSA7K2M1QZ8RP",
  "from": "12025550187",
  "type": "SUGGESTION",
  "postbackData": "track_pkg"
}
```

#### Example Response 202

Response

```json
{
  "status": "QUEUED",
  "messageId": "sim-3f1c9a52-7b1e-4c1a-9f7e-2f9d6b1c0a11"
}
```

### GET /message/:id

Read one message of any type. On an RCS message, phoneNumber and senderPhoneNumber hold the agent's ID, and the fallback leg links through fallbackMessageId and parentMessageId. An outbound RCS message and its fallback leg also carry costBreakdown, with one entry in legs per leg; either message's read returns both. billed is true once the ledger holds a net charge, and baseMicros and carrierMicros then say what was charged, a carrier media surcharge included in carrierMicros. Until then they say what the leg was rated at. rated is true on an RCS leg, which is rated when queued, and false on a fallback leg, which is priced as an ordinary SMS or MMS. A tap is charged on its own and is not in the leg. costBreakdown is null if it could not be read. A settled RCS message also carries carrierFeeMicros, the carrier pass-through and media surcharge it was charged, as GET /message returns it. An inbound message carries inReplyToMessageId, the message it answers. A reply chip or button names its message, so that link is exact; any other reply links to the newest message your number or agent sent that handset in the 7 days before it, while that message was sent, delivered or read and was not a STOP or HELP auto-reply. It is absent when there is no such message, on P2P replies, and on replies stored before the link was switched on. If that message has a parentMessageId, it was an RCS fallback, and the parent is the RCS message you sent.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | Path Param | Required | The message's ID. Works for every message type. An unknown ID answers 404. |

#### Example Response

Response

```json
{
  "_id": "6912f0a1c4e8a73d9b2e4f10",
  "groupId": "G0000001",
  "subgroupId": "S0000001",
  "phoneNumber": "RCSA7K2M1QZ8RP",
  "senderPhoneNumber": "RCSA7K2M1QZ8RP",
  "recipientPhoneNumber": "12025550187",
  "messageType": "RCS",
  "channel": "rcs",
  "direction": "OUTBOUND",
  "status": "READ",
  "deliveredChannel": "rcs",
  "billingClass": "RICH",
  "segmentCount": 1,
  "trafficType": "TRANSACTION",
  "isTest": false,
  "ratedCostMicros": 11500,
  "carrierFeeMicros": 5000,
  "costBreakdown": {
    "legs": [
      {
        "messageId": "6912f0a1c4e8a73d9b2e4f10",
        "channel": "rcs",
        "billed": true,
        "billingClass": "RICH",
        "segments": 1,
        "baseMicros": 6500,
        "carrierMicros": 5000,
        "rated": true
      }
    ]
  },
  "statusHistory": [
    {
      "status": "ENQUEUED",
      "timestamp": "2026-11-10T15:00:00.120Z"
    },
    {
      "status": "SENT",
      "timestamp": "2026-11-10T15:00:00.940Z"
    },
    {
      "status": "DELIVERED",
      "timestamp": "2026-11-10T15:00:03.300Z",
      "occurredAt": "2026-11-10T15:00:02.800Z"
    },
    {
      "status": "READ",
      "timestamp": "2026-11-10T15:02:11.000Z",
      "occurredAt": "2026-11-10T15:02:10.000Z"
    }
  ]
}
```

### GET /message/:id/interactions

List the taps on one RCS message, oldest first: reply chips and action buttons. A message nobody tapped answers an empty list. Reachable only where RCS is enabled.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | Path Param | Required | The message's ID. An unknown ID answers 404. |

#### Example Response

Response

```json
{
  "results": [
    {
      "actionType": "OPEN_URL",
      "buttonId": "1.m.1",
      "label": "Track package",
      "postbackData": "track_pkg",
      "occurredAt": "2026-11-10T15:03:05.000Z",
      "ratedCostMicros": 2500
    }
  ]
}
```

### POST /message/p2p

Retired: P2P messaging is no longer available. Every call now answers 410 Gone with the error P2P messaging is no longer available, and nothing is sent or charged. Use POST /message/sms instead. Before it was retired, this accepted an outbound P2P send and queued it for asynchronous fan-out. The request validates, authorizes, drops recipients who previously replied STOP, reserves funds for the remaining recipients, and persists a batch record, then returns immediately. Recipient messages are created and sent by a background worker. Poll GET /message/p2p/batches/:batchId for status. The response includes skippedOptOutCount (recipients dropped because they had opted out); if every recipient was opted out, no batch is created and batchId is null. Requires the p2pEnabled feature flag on the group. If the request is made with an API key limited to destination countries and any recipient is in another country, the whole request is rejected with 403 and details.code DESTINATION\_COUNTRY\_NOT\_ALLOWED; nothing is queued or charged.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `recipientPhoneNumber` | Array\[String\] | Required | Array of destination phone numbers. |
| `messageBody` | String | Required | The text content of the message. |
| `statusCallbackUrl` | String | Optional | A valid URL to receive delivery receipts for each recipient message. |
| `groupId` | String | Optional | Explicit group to send from. Defaults to the group in your auth context. |
| `subgroupId` | String | Optional | Explicit subgroup to attribute the send to. P2P has no dedicated sender number, so pass this to record the send — and its later inbound reply — against a specific subgroup; it also resolves the group. Defaults to the group's oldest subgroup. |
| `useSignalHouseShortlinks` | Boolean | Optional | When false, SignalHouse applies no link-shortening or text-spin and your pre-spun links/content are sent verbatim (bring-your-own spinner). Defaults to true. |

#### Example Request

Request

```json
{
  "recipientPhoneNumber": [
    "14175551234"
  ],
  "messageBody": "Hello via P2P!"
}
```

#### Example Response 202

Response

```json
{
  "batchId": "60f7b2a1c9e77c001a2b3c5b",
  "status": "ACCEPTED",
  "recipientCount": 1,
  "insertedMessages": [],
  "insertedMessageCount": 1,
  "skippedOptOutCount": 0
}
```

### GET /message/p2p/batches/:batchId

Retired: P2P messaging is no longer available. Every call now answers 410 Gone. Before it was retired, this returned the status of an asynchronous P2P batch created by POST /message/p2p. The recipient phone number list is omitted from the response. Status values: ACCEPTED, EXPANDING, ENQUEUING, EXPANDED, EXPANSION\_FAILED. Returns an empty array if the batch is not found.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `batchId` | Path Param | Required | The P2P batch ID returned by POST /message/p2p. |

#### Example Response 200

Response

```json
[
  {
    "_id": "60f7b2a1c9e77c001a2b3c5b",
    "batchId": "60f7b2a1c9e77c001a2b3c5b",
    "groupId": "G1234567",
    "subgroupId": "S1234567",
    "recipientCount": 1,
    "status": "EXPANDED",
    "statusHistory": [
      {
        "status": "ACCEPTED",
        "timestamp": "2024-01-15T14:30:00.000Z"
      },
      {
        "status": "EXPANDING",
        "timestamp": "2024-01-15T14:30:01.000Z"
      },
      {
        "status": "ENQUEUING",
        "timestamp": "2024-01-15T14:30:01.000Z"
      },
      {
        "status": "EXPANDED",
        "timestamp": "2024-01-15T14:30:02.000Z"
      }
    ],
    "insertedCount": 1,
    "enqueuedCount": 1,
    "error": null,
    "createdAt": "2024-01-15T14:30:00.000Z",
    "updatedAt": "2024-01-15T14:30:02.000Z"
  }
]
```

## Status Callback Payloads

When you provide a `statusCallbackUrl` on an SMS or MMS request, Signal House will POST status updates to that URL as the message progresses through its lifecycle. These posts are not signed; see [Webhook Signing](https://docs.signalhouse.io/webhook-signing).

#### When Sent Successfully

Posted immediately after the message is accepted by the carrier.

SENT Callback

```json
{
  "messageId": "60f7b2a1c9e77c001a2b3c58",
  "status": "SENT",
  "timestamp": "2024-01-15T14:30:01.000Z",
  "carrier": "T-Mobile",
  "carrierFamily": "TMobile",
  "carrierRegion": null
}
```

#### When Send Fails

Posted if the message could not be sent to the carrier.

FAILED Callback

```json
{
  "messageId": "60f7b2a1c9e77c001a2b3c58",
  "status": "FAILED",
  "timestamp": "2024-01-15T14:30:01.000Z"
}
```

#### Delivery Receipt (DELIVERED or FAILED)

Posted when the carrier returns a final delivery receipt. Contains the full message object.

Delivery Receipt Callback

```json
{
  "_id": "60f7b2a1c9e77c001a2b3c58",
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "brandId": "B1234567",
  "campaignId": "C1234567",
  "phoneNumber": "12246431042",
  "messageType": "SMS",
  "direction": "OUTBOUND",
  "senderPhoneNumber": "12246431042",
  "recipientPhoneNumber": "14175551234",
  "messageBody": "Hello from Signal House!",
  "segmentCount": 1,
  "status": "DELIVERED",
  "carrier": "T-Mobile",
  "carrierFamily": "TMobile",
  "carrierRegion": null,
  "statusCallbackUrl": "https://your-server.com/callback",
  "statusHistory": [
    { "status": "ENQUEUED", "timestamp": "2024-01-15T14:30:00.000Z" },
    { "status": "SENT", "timestamp": "2024-01-15T14:30:01.000Z" },
    { "status": "DELIVERED", "timestamp": "2024-01-15T14:30:05.000Z" }
  ],
  "createdAt": "2024-01-15T14:30:00.000Z",
  "updatedAt": "2024-01-15T14:30:05.000Z"
}
```

**Important:** Your endpoint must return a `2xx` status code quickly. Process the payload asynchronously to avoid timeouts. Use the `messageId` field as an idempotency key -- callbacks may be delivered more than once.

### GET /message/analytics

Retrieve aggregated message analytics. Sentiment arrives already weighted server-side (sum score / scored count) over inbound scored messages in range — never a mean of per-message scores — with a per-message-type breakdown alongside it. Clients never need to compute an average. The response also carries derived health figures — healthScore (1–10), healthDeliveryRate, healthOptOutRate, healthDeliveryScore and healthOptOutScore, each null when nothing was sent — computed from the response's own counters by the same formula GET /number/health uses; elsewhere these fields are absent.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | The Group ID. |
| `messageType` | Query Param | Optional | Scopes the sentiment figures to SMS, MMS and/or P2P (single value, array, or comma-separated). Omit for all scored types. It does NOT narrow the message counts, which are always returned split per type. |
| `subgroupId` | Query Param | Optional | Filter by Subgroup ID. Repeat the parameter for multiple values (e.g. subgroupId=id1&subgroupId=id2). |
| `brandId` | Query Param | Optional | Filter by Brand ID. Repeat the parameter for multiple values (e.g. brandId=BABC123&brandId=BDEF456). |
| `campaignId` | Query Param | Optional | Filter by Campaign ID. Repeat the parameter for multiple values (e.g. campaignId=CABC123&campaignId=CDEF456). |
| `registrationId` | Query Param | Optional | Filter to traffic attributed to these registrations. Accepts a single value, a repeated key, or a comma-separated list. Hourly analytics only (a 400 in environments without it). Cannot be combined with campaignId (400); a phoneNumber filter takes precedence. An unknown registration is a 404 and one outside the group a 403. |
| `phoneNumber` | Query Param | Optional | Filter by phone number. Repeat the parameter for multiple values (e.g. phoneNumber=12025551234&phoneNumber=12025555678). |
| `carrier` | Query Param | Optional | Filter by carrier. Repeat the parameter for multiple values (e.g. carrier=att&carrier=verizon). |
| `carrierFamily` | Query Param | Optional | Filter by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics, the Canada rails' families for Canadian handsets; Standard and IceWireless also appear on Canadian messages sent before those families). Repeat the parameter or pass a comma-separated list for multiple values. |
| `region` | Query Param | Optional | ISO-2 country of the message's sending number: US, GB or CA (UK is accepted for GB). One value, repeated, or comma-separated. Omitted = every region. Legacy records with no region count as US. |
| `regionScopes` | Query Param | Optional | JSON-encoded array of OR-ed branches { region, channels, brandId?, campaignId?, phoneNumber? }, channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p; entity arrays apply within their branch; \[\] matches nothing. |
| `matchAny` | Query Param | Optional | When true, the provided campaignId/brandId/phoneNumber filters are combined with OR (match ANY) instead of the default most-specific-single behavior. subgroupId stays an AND scope. Opt-in; default behavior is unchanged when omitted. |
| `channel` | Query Param | Optional | Filter by messaging channel. Accepts a single value or an array (cumulative — repeat the param, e.g. channel=tenDLC&channel=tollFree, or pass a comma-separated list). Allowed values: tenDLC, virtualLongCode, alphanumeric, tollFree, shortCode, p2p. Channel is filtered on the stored channel column; tenDLC folds the legacy channel-absent bucket in, and p2p is a first-class channel. Ignored when matchAny is true (matchAny takes precedence). |
| `startDate` | Query Param | Required | ISO-8601 date or timestamp. Bound per dateBounds: a bare date is always that whole UTC day (the full start day is included); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names, in whatever offset it was written ('2026-09-14T00:00:00-04:00' is 04:00Z), in 'exact' mode. |
| `endDate` | Query Param | Required | ISO-8601 date or timestamp. Bound per dateBounds: a bare date is always that whole UTC day (the full end day is included); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names in 'exact' mode, where any byDate buckets also align to the UTC offset this bound carries so a client that sends its own midnights gets its own calendar dates back. |
| `dateBounds` | Query Param | Optional | Which contract binds startDate and endDate. day: each bound is widened to its whole UTC day and day buckets are UTC dates. exact: a timestamp is bound as the instant it names, a bare date is its whole UTC day, and day buckets align to the UTC offset the end bound carries. Omitted: day. |

#### Example Response 200

Response

```json
{
  "smsQueued": 100,
  "smsDequeued": 100,
  "smsSent": 98,
  "smsDelivered": 95,
  "smsFailed": 3,
  "smsInbound": 42,
  "smsOutboundSegments": 105,
  "smsInboundSegments": 42,
  "smsOptOuts": 2,
  "smsShortlinksSent": 98,
  "smsUniqueShortlinksClicked": 12,
  "mmsQueued": 25,
  "mmsDequeued": 25,
  "mmsSent": 24,
  "mmsDelivered": 23,
  "mmsFailed": 1,
  "mmsInbound": 10,
  "mmsOutboundSegments": 25,
  "mmsInboundSegments": 10,
  "mmsOptOuts": 0,
  "mmsShortlinksSent": 0,
  "mmsUniqueShortlinksClicked": 0,
  "p2pQueued": 50,
  "p2pDequeued": 50,
  "p2pSent": 49,
  "p2pDelivered": 48,
  "p2pFailed": 1,
  "p2pInbound": 0,
  "p2pOutboundSegments": 50,
  "p2pInboundSegments": 0,
  "sentimentScore": 34,
  "sentimentLabel": "positive",
  "sentimentScoredCount": 42,
  "sentimentPositive": 25,
  "sentimentNeutral": 14,
  "sentimentNegative": 3,
  "smsSentimentScore": 30,
  "smsSentimentLabel": "positive",
  "smsSentimentScoredCount": 35,
  "smsSentimentPositive": 20,
  "smsSentimentNeutral": 12,
  "smsSentimentNegative": 3,
  "mmsSentimentScore": 62,
  "mmsSentimentLabel": "positive",
  "mmsSentimentScoredCount": 7,
  "mmsSentimentPositive": 5,
  "mmsSentimentNeutral": 2,
  "mmsSentimentNegative": 0,
  "p2pSentimentScore": null,
  "p2pSentimentLabel": null,
  "p2pSentimentScoredCount": 0,
  "p2pSentimentPositive": 0,
  "p2pSentimentNeutral": 0,
  "p2pSentimentNegative": 0,
  "healthScore": 9.5,
  "healthDeliveryRate": 96.9,
  "healthOptOutRate": 1.6,
  "healthDeliveryScore": 10,
  "healthOptOutScore": 9
}
```

### GET /message/analytics/detail

Retrieve aggregated analytics data for charting and widgets. Returns card totals plus data grouped by date, phone number (top 50 by volume, excluding P2P), and carrier (top 50 by volume, excluding P2P). cardTotals and every row also carry sentiment, already weighted server-side (sum score / scored count) for that row's scope, plus a per-message-type breakdown. A high-volume number/date/carrier always outweighs a low-volume one. These fields are always present on every row — sentimentScore and sentimentLabel are null (and the counts 0) when nothing in that row's scope has been scored. cardTotals and every row additionally carry the five derived health figures (healthScore, healthDeliveryRate, healthOptOutRate, healthDeliveryScore, healthOptOutScore — each row scored from its own counters, never assembled from sub-rows), and the optional byBreakdown series is available; elsewhere those fields are absent and breakdown is rejected.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | The Group ID. |
| `messageType` | Query Param | Optional | Scopes the sentiment figures to SMS, MMS and/or P2P (single value, array, or comma-separated). Omit for all scored types. It does NOT narrow the message counts, which are always returned split per type. |
| `subgroupId` | Query Param | Optional | Filter by Subgroup ID. Repeat the parameter for multiple values (e.g. subgroupId=id1&subgroupId=id2). |
| `brandId` | Query Param | Optional | Filter by Brand ID. Repeat the parameter for multiple values (e.g. brandId=BABC123&brandId=BDEF456). |
| `campaignId` | Query Param | Optional | Filter by Campaign ID. Repeat the parameter for multiple values (e.g. campaignId=CABC123&campaignId=CDEF456). |
| `registrationId` | Query Param | Optional | Filter to traffic attributed to these registrations. Accepts a single value, a repeated key, or a comma-separated list. Hourly analytics only (a 400 in environments without it). Cannot be combined with campaignId (400); a phoneNumber filter takes precedence. An unknown registration is a 404 and one outside the group a 403. |
| `phoneNumber` | Query Param | Optional | Filter by phone number. Repeat the parameter for multiple values (e.g. phoneNumber=12025551234&phoneNumber=12025555678). |
| `carrier` | Query Param | Optional | Filter by carrier. Repeat the parameter for multiple values (e.g. carrier=att&carrier=verizon). |
| `carrierFamily` | Query Param | Optional | Filter by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics, the Canada rails' families for Canadian handsets; Standard and IceWireless also appear on Canadian messages sent before those families). Repeat the parameter or pass a comma-separated list for multiple values. |
| `region` | Query Param | Optional | ISO-2 country of the message's sending number: US, GB or CA (UK is accepted for GB). One value, repeated, or comma-separated. Omitted = every region. Legacy records with no region count as US. |
| `regionScopes` | Query Param | Optional | JSON-encoded array of OR-ed branches { region, channels, brandId?, campaignId?, phoneNumber? }, channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p; entity arrays apply within their branch; \[\] matches nothing. |
| `startDate` | Query Param | Required | ISO-8601 date or timestamp. Bound per dateBounds: a bare date is always that whole UTC day (the full start day is included); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names, in whatever offset it was written, in 'exact' mode. At either granularity it is then floored to the start of its hour, because the hourly cube is keyed by hour and a mid-hour start would drop that hour's bucket. |
| `endDate` | Query Param | Required | ISO-8601 date or timestamp. At day granularity, bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names, in whatever offset it was written, in 'exact' mode. In 'exact' mode day buckets align to the UTC offset this bound carries, so a client that sends its own midnights gets its own calendar dates back — the full end day is included. At hour granularity, honoured as given. |
| `dateBounds` | Query Param | Optional | Which contract binds startDate and endDate. day: each bound is widened to its whole UTC day and day buckets are UTC dates. exact: a timestamp is bound as the instant it names, a bare date is its whole UTC day, and day buckets align to the UTC offset the end bound carries. Omitted: day. |
| `granularity` | Query Param | Optional | Time-bucket grain of the byDate rows: day or hour. Omit for day (each byDate row's \_id is a YYYY-MM-DD date). hour buckets by hour (each \_id is a YYYY-MM-DD HH:MM:SS UTC hour) and is capped to a 7-day span. |
| `breakdown` | Query Param | Optional | carrier or carrierFamily. Adds a byBreakdown time × dimension series to the response: { dimension, rows }, where each row is one byDate bucket (\_id, at the requested granularity) for one carrier or carrier family (key) and carries the same counters, sentiment and health fields as a byDate row. Covers the top 50 keys by volume, excluding P2P, and caps the span at 31 days. |
| `channel` | Query Param | Optional | Filter by messaging channel. Allowed values: tenDLC, virtualLongCode, alphanumeric, tollFree, shortCode, p2p (single or comma/array). Filtered on the stored channel column; tenDLC folds the legacy channel-absent bucket in, and p2p is a first-class channel. |

#### Example Response 200

Response

```json
{
  "cardTotals": {
    "smsQueued": 500,
    "smsDequeued": 500,
    "smsSent": 480,
    "smsDelivered": 450,
    "smsFailed": 20,
    "smsInbound": 200,
    "smsOutboundSegments": 550,
    "smsInboundSegments": 200,
    "smsOptOuts": 10,
    "smsShortlinksSent": 480,
    "smsUniqueShortlinksClicked": 50,
    "mmsQueued": 100,
    "mmsDequeued": 100,
    "mmsSent": 90,
    "mmsDelivered": 80,
    "mmsFailed": 10,
    "mmsInbound": 30,
    "mmsOutboundSegments": 200,
    "mmsInboundSegments": 60,
    "mmsOptOuts": 2,
    "mmsShortlinksSent": 0,
    "mmsUniqueShortlinksClicked": 0,
    "p2pQueued": 200,
    "p2pDequeued": 200,
    "p2pSent": 198,
    "p2pDelivered": 195,
    "p2pFailed": 3,
    "p2pInbound": 5,
    "p2pOutboundSegments": 200,
    "p2pInboundSegments": 5,
    "sentimentScore": 18,
    "sentimentLabel": "neutral",
    "sentimentScoredCount": 160,
    "sentimentPositive": 70,
    "sentimentNeutral": 80,
    "sentimentNegative": 10,
    "smsSentimentScore": 15,
    "smsSentimentLabel": "neutral",
    "smsSentimentScoredCount": 140,
    "smsSentimentPositive": 60,
    "smsSentimentNeutral": 70,
    "smsSentimentNegative": 10,
    "mmsSentimentScore": 39,
    "mmsSentimentLabel": "positive",
    "mmsSentimentScoredCount": 20,
    "mmsSentimentPositive": 10,
    "mmsSentimentNeutral": 10,
    "mmsSentimentNegative": 0,
    "p2pSentimentScore": null,
    "p2pSentimentLabel": null,
    "p2pSentimentScoredCount": 0,
    "p2pSentimentPositive": 0,
    "p2pSentimentNeutral": 0,
    "p2pSentimentNegative": 0,
    "healthScore": 9,
    "healthDeliveryRate": 93,
    "healthOptOutRate": 2.1,
    "healthDeliveryScore": 10,
    "healthOptOutScore": 8
  },
  "byDate": [
    {
      "_id": "2024-01-15T00:00:00.000Z",
      "smsDelivered": 45,
      "smsSent": 48,
      "smsFailed": 2,
      "smsInbound": 20,
      "p2pSent": 30,
      "p2pDelivered": 28,
      "sentimentScore": 22,
      "sentimentLabel": "neutral",
      "sentimentScoredCount": 70,
      "...": "..."
    },
    {
      "_id": "2024-01-16T00:00:00.000Z",
      "smsDelivered": 50,
      "smsSent": 52,
      "smsFailed": 1,
      "smsInbound": 18,
      "p2pSent": 35,
      "p2pDelivered": 34,
      "sentimentScore": 15,
      "sentimentLabel": "neutral",
      "sentimentScoredCount": 90,
      "...": "..."
    }
  ],
  "byPhoneNumber": [
    {
      "_id": "12025551234",
      "smsDelivered": 200,
      "smsSent": 210,
      "smsFailed": 8,
      "smsInbound": 90,
      "sentimentScore": 28,
      "sentimentLabel": "positive",
      "sentimentScoredCount": 55,
      "...": "..."
    }
  ],
  "byCarrier": [
    {
      "_id": "T-Mobile",
      "smsDelivered": 300,
      "smsSent": 320,
      "smsFailed": 12,
      "smsInbound": 150,
      "sentimentScore": 12,
      "sentimentLabel": "neutral",
      "sentimentScoredCount": 95,
      "...": "..."
    }
  ],
  "byBreakdown": {
    "dimension": "carrierFamily",
    "rows": [
      {
        "_id": "2024-01-15",
        "key": "TMobile",
        "smsDelivered": 140,
        "smsSent": 150,
        "smsFailed": 6,
        "sentimentScore": 10,
        "healthScore": 9,
        "...": "..."
      },
      {
        "_id": "2024-01-15",
        "key": "Verizon",
        "smsDelivered": 120,
        "smsSent": 124,
        "smsFailed": 2,
        "sentimentScore": 18,
        "healthScore": 9.5,
        "...": "..."
      }
    ]
  }
}
```

### GET /message/analytics/by-subgroup

Retrieve a paginated breakdown of message metrics grouped by subgroup. Each row carries the full set of sms/mms/p2p metric columns plus sms/mms opt-out counts so callers can apply channel toggles client-side without refetching. Opt-outs are sourced from the DNC analytics MV and merged in by subgroupId. Each row also carries that subgroup's inbound-message sentiment — sentimentScore is the volume-weighted average of every scored inbound message in that subgroup (-100..100, null when nothing was scored), alongside its label, the scored count and the positive/neutral/negative counts, plus the same six per message type under smsSentiment\*, mmsSentiment\* and p2pSentiment\* prefixes. Scores are derived server-side and must never be re-averaged across rows: combine the counts, not the scores. Limit is capped server-side at 50 per page.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | The Group ID. |
| `subgroupId` | Query Param | Optional | Filter by Subgroup ID. Repeat for multiple values. |
| `brandId` | Query Param | Optional | Filter by Brand ID. Repeat for multiple values. |
| `campaignId` | Query Param | Optional | Filter by Campaign ID. Repeat for multiple values. |
| `registrationId` | Query Param | Optional | Filter to traffic attributed to these registrations. Accepts a single value, a repeated key, or a comma-separated list. Hourly analytics only (a 400 in environments without it). Cannot be combined with campaignId (400); a phoneNumber filter takes precedence. An unknown registration is a 404 and one outside the group a 403. |
| `phoneNumber` | Query Param | Optional | Filter by phone number. Repeat for multiple values. |
| `carrier` | Query Param | Optional | Filter by carrier. Repeat for multiple values. |
| `carrierFamily` | Query Param | Optional | Filter by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics, the Canada rails' families for Canadian handsets; Standard and IceWireless also appear on Canadian messages sent before those families). Repeat for multiple values. |
| `region` | Query Param | Optional | ISO-2 country of the message's sending number: US, GB or CA (UK is accepted for GB). One value, repeated, or comma-separated. Omitted = every region. Legacy records with no region count as US. |
| `regionScopes` | Query Param | Optional | JSON-encoded array of OR-ed branches { region, channels, brandId?, campaignId?, phoneNumber? }, channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p; entity arrays apply within their branch; \[\] matches nothing. |
| `startDate` | Query Param | Required | ISO-8601 date or timestamp. Bound per dateBounds: a bare date is always that whole UTC day (the full start day is included); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names, in whatever offset it was written ('2026-09-14T00:00:00-04:00' is 04:00Z), in 'exact' mode. |
| `endDate` | Query Param | Required | ISO-8601 date or timestamp. Bound per dateBounds: a bare date is always that whole UTC day (the full end day is included); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names in 'exact' mode, where any byDate buckets also align to the UTC offset this bound carries so a client that sends its own midnights gets its own calendar dates back. |
| `dateBounds` | Query Param | Optional | Which contract binds startDate and endDate. day: each bound is widened to its whole UTC day and day buckets are UTC dates. exact: a timestamp is bound as the instant it names, a bare date is its whole UTC day, and day buckets align to the UTC offset the end bound carries. Omitted: day. |
| `page` | Query Param | Optional | 1-based page number. Defaults to 1. |
| `limit` | Query Param | Optional | Rows per page. Defaults to 50, capped at 50. |
| `channel` | Query Param | Optional | Scope rows + ranking by the stored channel column. Allowed values: tenDLC, virtualLongCode, alphanumeric, tollFree, shortCode, p2p (single or comma/array), or "both" (default) for all activity. Pagination's totalCount also reflects this scoping. |
| `messageType` | Query Param | Optional | Scopes the sentiment figures to SMS, MMS and/or P2P (single value, array, or comma-separated). Omit for all scored types. It does NOT narrow the message counts, which are always returned split per type. |

#### Example Response 200

Response

```json
{
  "rows": [
    {
      "subgroupId": "S1234567",
      "subgroupName": "Coastal Dental Group",
      "smsQueued": 0,
      "smsDequeued": 0,
      "smsSent": 4172,
      "smsDelivered": 4126,
      "smsFailed": 46,
      "smsInbound": 88,
      "smsOutboundSegments": 4218,
      "smsInboundSegments": 88,
      "smsOptOuts": 7,
      "smsShortlinksSent": 1240,
      "mmsQueued": 0,
      "mmsDequeued": 0,
      "mmsSent": 0,
      "mmsDelivered": 0,
      "mmsFailed": 0,
      "mmsInbound": 0,
      "mmsOutboundSegments": 0,
      "mmsInboundSegments": 0,
      "mmsOptOuts": 0,
      "mmsShortlinksSent": 0,
      "p2pQueued": 0,
      "p2pDequeued": 0,
      "p2pSent": 0,
      "p2pDelivered": 0,
      "p2pFailed": 0,
      "p2pInbound": 0,
      "p2pOutboundSegments": 0,
      "p2pInboundSegments": 0,
      "sentimentScore": 42,
      "sentimentLabel": "positive",
      "sentimentScoredCount": 120,
      "sentimentPositive": 85,
      "sentimentNeutral": 23,
      "sentimentNegative": 12,
      "smsSentimentScore": 40,
      "smsSentimentLabel": "positive",
      "smsSentimentScoredCount": 100,
      "...": "mmsSentiment* and p2pSentiment* follow the same shape"
    }
  ],
  "totalCount": 8,
  "page": 1,
  "limit": 50
}
```

### GET /message/analytics/by-error-code

Retrieve a paginated breakdown of failed messages grouped by error code. Each row contains per-channel (sms/mms/p2p) error counts plus an enriched description sourced from the local Infobip error code lookup. Failures with no \`\[NNN\]\` error code are grouped by cause into their own null-code rows: content-moderation blocks (errorCategory 'CONTENT\_MODERATION'), AT&T per-minute-limit rejects ('CARRIER\_RATE\_LIMIT'), P2P-STOP opt-outs, campaign opt-outs and Do Not Contact blocks (all 'RECIPIENT\_OPTED\_OUT', each on its own row with its own description), and P2P messages never offered to the carrier because the SMPP bind stayed down past the hold window ('PROVIDER\_UNAVAILABLE'); any remaining code-less failure buckets into the null-code landline/carrier-incapable row. Counts come from an hourly rollup refreshed every 10 minutes. Limit is capped server-side at 50 per page.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | The Group ID. |
| `subgroupId` | Query Param | Optional | Filter by Subgroup ID. Repeat for multiple values. |
| `brandId` | Query Param | Optional | Filter by Brand ID. Repeat for multiple values. |
| `campaignId` | Query Param | Optional | Filter by Campaign ID. Repeat for multiple values. |
| `registrationId` | Query Param | Optional | Filter to traffic attributed to these registrations. Accepts a single value, a repeated key, or a comma-separated list. Hourly analytics only (a 400 in environments without it). Cannot be combined with campaignId (400); a phoneNumber filter takes precedence. An unknown registration is a 404 and one outside the group a 403. |
| `phoneNumber` | Query Param | Optional | Filter by phone number. Repeat for multiple values. |
| `carrier` | Query Param | Optional | Filter by carrier. Repeat for multiple values. |
| `carrierFamily` | Query Param | Optional | Filter by the recipient's resolved carrier family (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, P2P, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics, the Canada rails' families for Canadian handsets; Standard and IceWireless also appear on Canadian messages sent before those families). Repeat for multiple values. |
| `region` | Query Param | Optional | ISO-2 country of the message's sending number: US, GB or CA (UK is accepted for GB). One value, repeated, or comma-separated. Omitted = every region. Legacy records with no region count as US. |
| `regionScopes` | Query Param | Optional | JSON-encoded array of OR-ed branches { region, channels, brandId?, campaignId?, phoneNumber? }, channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p; entity arrays apply within their branch; \[\] matches nothing. |
| `startDate` | Query Param | Required | ISO-8601 date or timestamp. Bound per dateBounds: a bare date is always that whole UTC day (the full start day is included); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names, in whatever offset it was written ('2026-09-14T00:00:00-04:00' is 04:00Z), in 'exact' mode. It is then floored to the start of its hour, because the counts come from an hourly rollup: a start of 18:30 includes failures from 18:00. |
| `endDate` | Query Param | Required | ISO-8601 date or timestamp. Bound per dateBounds: a bare date is always that whole UTC day (the full end day is included); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names in 'exact' mode, where any byDate buckets also align to the UTC offset this bound carries so a client that sends its own midnights gets its own calendar dates back. The hour containing the end bound is included whole, because the counts come from an hourly rollup. |
| `dateBounds` | Query Param | Optional | Which contract binds startDate and endDate. day: each bound is widened to its whole UTC day and day buckets are UTC dates. exact: a timestamp is bound as the instant it names, a bare date is its whole UTC day, and day buckets align to the UTC offset the end bound carries. Omitted: day. |
| `page` | Query Param | Optional | 1-based page number. Defaults to 1. |
| `limit` | Query Param | Optional | Rows per page. Defaults to 50, capped at 50. |
| `channel` | Query Param | Optional | Scope rows + ranking by the stored channel column. Allowed values: tenDLC, virtualLongCode, alphanumeric, tollFree, shortCode, p2p (single or comma/array), or "both" (default) for every code. When a specific channel is selected, totalErrors reflects that channel. |
| `errorCode` | Query Param | Optional | Narrow the breakdown to a single failure reason: a numeric Infobip carrier code as a string (e.g. "607"), the Signal House campaign-opt-out code "OUT", or a no-code failure class (other, moderation, att\_limit, p2p\_stop, campaign\_opt\_out, dnc\_blocked, bind\_hold\_expired). totalErrors still reflects every reason — it is the rate denominator, not the filtered count. An unrecognized value is a 400. Omitted: every reason. |

#### Example Response 200

Response

```json
{
  "rows": [
    {
      "errorCode": 351,
      "errorDescription": "The message was rejected by the carrier. The mobile number may be deactivated, unable to receive messages, or rejected for spam.",
      "errorCategory": "DELIVERY_ERRORS",
      "smsErrorCount": 80,
      "mmsErrorCount": 10,
      "p2pErrorCount": 0,
      "totalErrorCount": 90
    },
    {
      "errorCode": null,
      "errorDescription": "Message sent to landline or carrier incapable of receiving text messages.",
      "errorCategory": null,
      "smsErrorCount": 5,
      "mmsErrorCount": 0,
      "p2pErrorCount": 0,
      "totalErrorCount": 5
    }
  ],
  "totalCount": 2,
  "totalErrors": {
    "sms": 85,
    "mms": 10,
    "p2p": 0,
    "all": 95
  },
  "page": 1,
  "limit": 50
}
```

### GET /message/analytics/filter-options

Retrieve dropdown filter options (subgroups, brands, campaigns, phone numbers, carriers) for the Analytics page, scoped to a single group. Sourced entirely from ClickHouse — each list returns only items that have at least one message in the group's history. Useful for analytics-style UIs where the filter list should reflect data the customer actually has. Each phone number carries its type (TOLL\_FREE, SHORT\_CODE, ALPHANUMERIC, VIRTUAL\_LONG\_NUMBER, and older local-number spellings) and country (ISO-2); both are null when unknown. Group numbers by channel with both: TOLL\_FREE, SHORT\_CODE and ALPHANUMERIC are channels by type, while a US number of any other type is 10DLC and a non-US one is a Virtual Long Code. carriers is a plain array of carrier name strings.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | The Group ID whose filter options to load. |
| `region` | Query Param | Optional | ISO-2 country of the message's sending number: US, GB or CA (UK is accepted for GB). One value, repeated, or comma-separated. Omitted = every region. Legacy records with no region count as US. |

#### Example Response 200

Response

```json
{
  "subgroups": [
    {
      "subgroupId": "SG123456",
      "subgroupName": "Marketing"
    }
  ],
  "brands": [
    {
      "brandId": "BABC1234",
      "displayName": "Acme Corp",
      "subgroupId": "SG123456"
    }
  ],
  "campaigns": [
    {
      "campaignId": "CABC1234",
      "brandId": "BABC1234",
      "subgroupId": "SG123456"
    }
  ],
  "phoneNumbers": [
    {
      "phoneNumber": "12025551234",
      "campaignId": "CABC1234",
      "brandId": "BABC1234",
      "subgroupId": "SG123456",
      "type": "VIRTUAL_LONG_NUMBER",
      "country": "US"
    },
    {
      "phoneNumber": "447860059129",
      "campaignId": null,
      "brandId": null,
      "subgroupId": "SG123456",
      "type": "VIRTUAL_LONG_NUMBER",
      "country": "GB"
    }
  ],
  "carriers": [
    "AT&T",
    "T-Mobile",
    "Verizon"
  ]
}
```

### GET /message/analytics/throughput

Per-minute send throughput for a campaign, brand, or group: peak segments and messages per minute, sending minutes (minutes with at least one SENT), the average over those minutes, and — when a ceiling is given — minutes at or above it; as totals, per time bucket (byDate), per carrier family (byCarrierFamily), and per bucket × carrier family (byBreakdown). Measured from SENT transitions at campaign × carrier-family grain, the grain carrier ceilings are enforced at, so a peak here is the figure a ceiling is compared against. The per-minute data is retained for 35 days. A failed sub-query renders as an empty series rather than failing the request.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | Group ID to scope the read to. |
| `brandId` | Query Param | Optional | Brand scope. Accepts a single value, a repeated key, or a comma-separated list; ignored when campaignId is given. A single ID is verified to exist — an unknown ID returns the empty shape. |
| `campaignId` | Query Param | Optional | Campaign scope; wins over brandId. Accepts a single value, a repeated key, or a comma-separated list. A single ID is verified to exist — an unknown ID returns the empty shape. |
| `registrationId` | Query Param | Optional | Throughput attributed to these registrations. Accepts a single value, a repeated key, or a comma-separated list. Cannot be combined with campaignId (400). An unknown registration is a 404 and one outside the group a 403. |
| `carrierFamily` | Query Param | Optional | Carrier-family filter (ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile, Bell, Rogers, Telus, Videotron, SaskTel, Eastlink, Fibernetics, the Canada rails' families for Canadian handsets; Standard and IceWireless also appear on Canadian messages sent before those families). Accepts a single value, a repeated key, or a comma-separated list. |
| `startDate` | Query Param | Required | ISO-8601 date or timestamp. It is bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names, in whatever offset it was written, in 'exact' mode, then floored to the start of its hour at either granularity (the hourly cube is keyed by hour). |
| `endDate` | Query Param | Required | ISO-8601 date or timestamp. At hour granularity, honoured as given; at day granularity, bound per dateBounds: a bare date is always that whole UTC day (inclusive); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names, in whatever offset it was written, in 'exact' mode. In 'exact' mode day buckets align to the UTC offset this bound carries, so a client that sends its own midnights gets its own calendar dates back. The span is capped at 35 days. |
| `dateBounds` | Query Param | Optional | Which contract binds startDate and endDate. day: each bound is widened to its whole UTC day and day buckets are UTC dates. exact: a timestamp is bound as the instant it names, a bare date is its whole UTC day, and day buckets align to the UTC offset the end bound carries. Omitted: day. |
| `granularity` | Query Param | Optional | Bucket grain of the byDate and byBreakdown rows: hour (default; each \_id is a YYYY-MM-DD HH:MM:SS UTC hour; span capped at 7 days) or day (each \_id is a YYYY-MM-DD date). |
| `ceiling` | Query Param | Optional | Positive integer, segments per minute. When given, every row also reports minutesAtCeiling (sending minutes at or above it); otherwise minutesAtCeiling is null. A ceiling belongs to one carrier, so read it against a carrierFamily filter or the matching byCarrierFamily row. The enforced ceilings come from GET /campaign/throughput-limits. |

#### Example Response 200

Response

```json
{
  "totals": {
    "segments": 41280,
    "messages": 34690,
    "peakSegmentsPerMinute": 2310,
    "peakMessagesPerMinute": 1941,
    "peakMinute": "2026-09-10 14:07:00",
    "sendingMinutes": 46,
    "averageSegmentsPerSendingMinute": 897.39,
    "minutesAtCeiling": 3
  },
  "byDate": [
    {
      "_id": "2026-09-10 14:00:00",
      "segments": 9840,
      "messages": 8268,
      "peakSegmentsPerMinute": 2310,
      "peakMessagesPerMinute": 1941,
      "peakMinute": "2026-09-10 14:07:00",
      "sendingMinutes": 12,
      "averageSegmentsPerSendingMinute": 820,
      "minutesAtCeiling": 3
    }
  ],
  "byCarrierFamily": [
    {
      "_id": "ATT",
      "segments": 14030,
      "messages": 11790,
      "peakSegmentsPerMinute": 2160,
      "peakMessagesPerMinute": 1815,
      "peakMinute": "2026-09-10 14:07:00",
      "sendingMinutes": 46,
      "averageSegmentsPerSendingMinute": 305,
      "minutesAtCeiling": 3
    },
    {
      "_id": "TMobile",
      "segments": 12360,
      "messages": 10390,
      "peakSegmentsPerMinute": 2940,
      "peakMessagesPerMinute": 2471,
      "peakMinute": "2026-09-10 14:05:00",
      "sendingMinutes": 31,
      "averageSegmentsPerSendingMinute": 398.71,
      "minutesAtCeiling": 0
    }
  ],
  "byBreakdown": {
    "dimension": "carrierFamily",
    "rows": [
      {
        "_id": "2026-09-10 14:00:00",
        "key": "ATT",
        "segments": 3340,
        "messages": 2807,
        "peakSegmentsPerMinute": 2160,
        "peakMessagesPerMinute": 1815,
        "peakMinute": "2026-09-10 14:07:00",
        "sendingMinutes": 12,
        "averageSegmentsPerSendingMinute": 278.33,
        "minutesAtCeiling": 3
      },
      {
        "_id": "2026-09-10 14:00:00",
        "key": "TMobile",
        "segments": 2950,
        "messages": 2479,
        "peakSegmentsPerMinute": 2940,
        "peakMessagesPerMinute": 2471,
        "peakMinute": "2026-09-10 14:05:00",
        "sendingMinutes": 8,
        "averageSegmentsPerSendingMinute": 368.75,
        "minutesAtCeiling": 0
      }
    ]
  }
}
```

### GET /message/dnc

Retrieve paginated Do Not Contact (opt-out) records. Sourced from the ClickHouse CDC mirror of the donotcontacts collection — eventually consistent with the write path (typically seconds of CDC lag). Each record carries senderPhoneNumber, the first business number that received the opt-out (set once and never changed by a later STOP or a campaign move; the same value as phoneNumber), campaignId (null on subgroup-scoped records, which are how non-US recipients opt out; an RCS opt-out holds the agent ID here), optOutKeyword, the normalized keyword that revoked consent (e.g. 'stop', 'opt out'; a repeat opt-out records the most recent word) — null for opt-outs recorded before keyword capture shipped, since history is not reconstructed — and carrierFamily, the resolved carrier family of the recipient number (Default, ATT, TMobile, Verizon, USCellular, GoogleVoice, ClearSky, Interop, RogueMobile), copied from the inbound message that triggered the opt-out.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | The Group ID. |
| `subgroupId` | Query Param | Optional | Filter by Subgroup ID. |
| `brandId` | Query Param | Optional | Filter by Brand ID. |
| `campaignId` | Query Param | Optional | Filter by Campaign ID. |
| `registrationId` | Query Param | Optional | Filter to traffic attributed to these registrations. Accepts a single value, a repeated key, or a comma-separated list. Hourly analytics only (a 400 in environments without it). Cannot be combined with campaignId (400); a phoneNumber filter takes precedence. An unknown registration is a 404 and one outside the group a 403. |
| `phoneNumber` | Query Param | Optional | Filter by business phone number. |
| `carrier` | Query Param | Optional | Filter by carrier. |
| `region` | Query Param | Optional | ISO-2 country of the message's sending number: US, GB or CA (UK is accepted for GB). One value, repeated, or comma-separated. Omitted = every region. Legacy records with no region count as US. |
| `regionScopes` | Query Param | Optional | JSON-encoded array of OR-ed branches { region, channels, brandId?, campaignId?, phoneNumber? }, channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p; entity arrays apply within their branch; \[\] matches nothing. |
| `startDate` | Query Param | Required | ISO-8601 date or timestamp. Bound per dateBounds: a bare date is always that whole UTC day (the full start day is included); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names, in whatever offset it was written ('2026-09-14T00:00:00-04:00' is 04:00Z), in 'exact' mode. |
| `endDate` | Query Param | Required | ISO-8601 date or timestamp. Bound per dateBounds: a bare date is always that whole UTC day (the full end day is included); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names in 'exact' mode, where any byDate buckets also align to the UTC offset this bound carries so a client that sends its own midnights gets its own calendar dates back. |
| `dateBounds` | Query Param | Optional | Which contract binds startDate and endDate. day: each bound is widened to its whole UTC day and day buckets are UTC dates. exact: a timestamp is bound as the instant it names, a bare date is its whole UTC day, and day buckets align to the UTC offset the end bound carries. Omitted: day. |
| `page` | Query Param | Optional | Page number for pagination (default: 1). |
| `limit` | Query Param | Optional | Records per page, max 100 (default: 100). |
| `sortField` | Query Param | Optional | Field to sort by: createdAt, recipientPhoneNumber, phoneNumber, carrier, messageType (default: createdAt). |
| `sortOrder` | Query Param | Optional | Sort direction: asc or desc (default: desc). |
| `channel` | Query Param | Optional | Filter by messaging channel. Allowed values: tenDLC, virtualLongCode, alphanumeric, tollFree, shortCode (single or comma/array). DNC is A2P-only — p2p resolves to no scope. Filtered on the stored channel column; tenDLC folds the legacy channel-absent bucket in. |
| `includeTotal` | Query Param | Optional | true returns { data, total, page, limit, totalPages, totalExact, partial, countError } instead of the array, where data is the page. total is the number of records (counted in a separate read, so totalExact is false; keep paging while a page is full) the filters match, counted from the same source as the page. It is null, never 0, with countError COUNT\_UNAVAILABLE when the count could not run; data is still returned. Omitted or false: the bare array, unchanged. |

#### Example Response 200

Response

```json
[
  {
    "_id": "60f7b2a1c9e77c001a2b3c5b",
    "recipientPhoneNumber": "12174129840",
    "groupId": "G1234567",
    "subgroupId": "SG123456",
    "brandId": "B1234567",
    "campaignId": "C1234567",
    "phoneNumber": "14173738106",
    "senderPhoneNumber": "14173738106",
    "carrier": "Verizon Wireless",
    "carrierFamily": "Verizon",
    "messageType": "SMS",
    "optOutKeyword": "stop",
    "createdAt": "2024-01-15T14:30:00.000Z",
    "updatedAt": "2024-01-15T14:30:00.000Z"
  }
]
```

### GET /message/dnc/analytics

Retrieve aggregated Do Not Contact (DNC) opt-out analytics: totals, byDate, byPhoneNumber, bySenderNumber, byCampaign, bySubgroup, byType, byCarrier and byKeyword. bySenderNumber attributes each opt-out to the first business number that received it, so a number's count is unchanged by later campaign moves and START replies. byCampaign counts campaign-scoped opt-outs only, by the campaign at the time of the STOP; subgroup-scoped opt-outs (non-US recipients) are never attributed to a campaign and appear under bySubgroup instead. byType splits SMS/MMS. Includes a byKeyword breakdown of opt-outs by the normalized keyword that revoked consent. Opt-outs recorded before keyword capture shipped appear as a single optOutKeyword: null bucket ('not recorded'), so byKeyword totals reconcile with totals.total. The distinct keyword set is open-ended (campaigns can register their own opt-out keywords beyond the mandatory floor) — render top-N plus Other, never a fixed list.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | The Group ID. |
| `subgroupId` | Query Param | Optional | Filter by Subgroup ID. |
| `brandId` | Query Param | Optional | Filter by Brand ID. |
| `campaignId` | Query Param | Optional | Filter by Campaign ID. |
| `registrationId` | Query Param | Optional | Filter to traffic attributed to these registrations. Accepts a single value, a repeated key, or a comma-separated list. Hourly analytics only (a 400 in environments without it). Cannot be combined with campaignId (400); a phoneNumber filter takes precedence. An unknown registration is a 404 and one outside the group a 403. |
| `phoneNumber` | Query Param | Optional | Filter by phone number. |
| `carrier` | Query Param | Optional | Filter by carrier. |
| `region` | Query Param | Optional | ISO-2 country of the message's sending number: US, GB or CA (UK is accepted for GB). One value, repeated, or comma-separated. Omitted = every region. Legacy records with no region count as US. |
| `regionScopes` | Query Param | Optional | JSON-encoded array of OR-ed branches { region, channels, brandId?, campaignId?, phoneNumber? }, channels among tenDLC, virtualLongCode, tollFree, shortCode, p2p; entity arrays apply within their branch; \[\] matches nothing. |
| `startDate` | Query Param | Required | ISO-8601 date or timestamp. Bound per dateBounds: a bare date is always that whole UTC day (the full start day is included); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names, in whatever offset it was written ('2026-09-14T00:00:00-04:00' is 04:00Z), in 'exact' mode. |
| `endDate` | Query Param | Required | ISO-8601 date or timestamp. Bound per dateBounds: a bare date is always that whole UTC day (the full end day is included); a timestamp is widened to its whole UTC day in 'day' mode and bound as the instant it names in 'exact' mode, where any byDate buckets also align to the UTC offset this bound carries so a client that sends its own midnights gets its own calendar dates back. |
| `dateBounds` | Query Param | Optional | Which contract binds startDate and endDate. day: each bound is widened to its whole UTC day and day buckets are UTC dates. exact: a timestamp is bound as the instant it names, a bare date is its whole UTC day, and day buckets align to the UTC offset the end bound carries. Omitted: day. |
| `channel` | Query Param | Optional | Filter by messaging channel. Allowed values: tenDLC, virtualLongCode, alphanumeric, tollFree, shortCode (single or comma/array). DNC is A2P-only — p2p resolves to no scope. Filtered on the stored channel column; tenDLC folds the legacy channel-absent bucket in. |

#### Example Response 200

Response

```json
{
  "totals": {
    "total": 5,
    "sms": 3,
    "mms": 2
  },
  "byDate": [
    {
      "date": "2024-01-15",
      "total": 3,
      "sms": 2,
      "mms": 1
    },
    {
      "date": "2024-01-16",
      "total": 2,
      "sms": 1,
      "mms": 1
    }
  ],
  "byPhoneNumber": [
    {
      "phoneNumber": "12025551234",
      "total": 3,
      "sms": 2,
      "mms": 1
    },
    {
      "phoneNumber": "18435559876",
      "total": 2,
      "sms": 1,
      "mms": 1
    }
  ],
  "bySenderNumber": [
    {
      "senderPhoneNumber": "12025551234",
      "total": 3,
      "sms": 2,
      "mms": 1
    },
    {
      "senderPhoneNumber": "18435559876",
      "total": 2,
      "sms": 1,
      "mms": 1
    }
  ],
  "byCampaign": [
    {
      "campaignId": "C1234567",
      "total": 4,
      "sms": 3,
      "mms": 1
    }
  ],
  "bySubgroup": [
    {
      "subgroupId": "SG123456",
      "total": 5,
      "sms": 3,
      "mms": 2
    }
  ],
  "byType": [
    {
      "messageType": "SMS",
      "total": 3
    },
    {
      "messageType": "MMS",
      "total": 2
    }
  ],
  "byCarrier": [
    {
      "carrier": "T-Mobile",
      "total": 3,
      "sms": 2,
      "mms": 1
    },
    {
      "carrier": "AT&T",
      "total": 2,
      "sms": 1,
      "mms": 1
    }
  ],
  "byKeyword": [
    {
      "optOutKeyword": "stop",
      "total": 3,
      "sms": 2,
      "mms": 1
    },
    {
      "optOutKeyword": "unsubscribe",
      "total": 1,
      "sms": 1,
      "mms": 0
    },
    {
      "optOutKeyword": null,
      "total": 1,
      "sms": 0,
      "mms": 1
    }
  ]
}
```

### GET /message/dnc/consent-records

Export the group's consent ledger, newest first: one append-only record for each opt-out or opt-in a recipient gave, from a STOP or START keyword (SMS, MMS or RCS) or the confirmation of an opt-out link. The ledger only records; sends are suppressed by the opt-out list, never by the ledger. Each record carries the handset (recipientPhoneNumber), the business number or RCS agent ID that received the instruction (phoneNumber), the scope it was written at (scope.type CAMPAIGN, AGENT or SUBGROUP, and scope.id, the campaign ID, agent ID or subgroup ID), clearedScopes (for an OPT\_IN, every { type, id } the START cleared, which includes the subgroup; empty for an OPT\_OUT), action (OPT\_OUT or OPT\_IN), source (KEYWORD or LINK), the normalized keyword ('LINK' for a link), messageType, messageId (the inbound message ID; for a link, the opt-out link's ID), actor.type RECIPIENT, and occurredAt, when the recipient gave the instruction. A redelivered inbound message adds no second record. Records start when RCS became available; earlier opt-outs are on GET /message/dnc only.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Required | The Group ID. |
| `recipientPhoneNumber` | Query Param | Optional | One handset, in any spelling (+1 512 555 0100 and 15125550100 match the same records). |
| `startDate` | Query Param | Optional | ISO-8601 date or timestamp; the earliest occurredAt. A bare date is the start of that UTC day; a timestamp is bound as sent. |
| `endDate` | Query Param | Optional | ISO-8601 date or timestamp; the latest occurredAt. A bare date includes that whole UTC day; a timestamp is bound as sent. |
| `page` | Query Param | Optional | Page number (default: 1). |
| `limit` | Query Param | Optional | Records per page, max 500 (default: 100). |

#### Example Response 200

Response

```json
{
  "data": [
    {
      "groupId": "G1234567",
      "subgroupId": "SG123456",
      "recipientPhoneNumber": "15555550100",
      "phoneNumber": "RCSA7K2M1QZ8RP",
      "scope": {
        "type": "AGENT",
        "id": "RCSA7K2M1QZ8RP"
      },
      "clearedScopes": [],
      "action": "OPT_OUT",
      "source": "KEYWORD",
      "keyword": "stop",
      "messageType": "RCS",
      "messageId": "6912f0a1c9e77c001a2b3c5b",
      "actor": {
        "type": "RECIPIENT"
      },
      "occurredAt": "2026-12-01T15:04:05.000Z",
      "createdAt": "2026-12-01T15:04:06.120Z"
    },
    {
      "groupId": "G1234567",
      "subgroupId": "SG123456",
      "recipientPhoneNumber": "12174129840",
      "phoneNumber": "14173738106",
      "scope": {
        "type": "CAMPAIGN",
        "id": "C1234567"
      },
      "clearedScopes": [
        {
          "type": "CAMPAIGN",
          "id": "C1234567"
        },
        {
          "type": "SUBGROUP",
          "id": "SG123456"
        }
      ],
      "action": "OPT_IN",
      "source": "KEYWORD",
      "keyword": "start",
      "messageType": "SMS",
      "messageId": "6912e7b4c9e77c001a2b3c4a",
      "actor": {
        "type": "RECIPIENT"
      },
      "occurredAt": "2026-11-30T18:22:10.000Z",
      "createdAt": "2026-11-30T18:22:10.940Z"
    }
  ],
  "total": 2,
  "page": 1,
  "limit": 100
}
```
