# Submit Outbound Message

Canonical: https://docs.bluehola.com/docs/messaging/post-v1-messages
OpenAPI: https://docs.bluehola.com/openapi.yaml

<div class="endpoint"><span class="endpoint-method endpoint-method--post">POST</span><code class="endpoint-path">/v1/messages</code></div>

Submit an outbound message, returning 202 with status accepted. Sending a business-unique Idempotency-Key (up to 200 characters) is recommended; a repeated key within the current authorization scope returns the same message; the default rate limit is 600 per minute.

:::note[Authentication]

Send `Authorization: Bearer <API_KEY>` in the request headers, with scope `messages:send`. Which resources an API Key can reach is determined by its current authorization scope.

:::

## Request

Base URL: `https://api.bluehola.com`

### Parameters

| Name | In | Required | Type / constraints | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | No | string · up to 200 | A business-unique key, up to 200 characters; a repeated key within the current authorization scope returns the same message rather than sending it again |

### Request body
A request body is required.
### Request body fields

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `phoneNumberId` | string | Yes | The platform's phone number ID, pn_...; get the numbers actually held in the current authorization scope from GET /v1/phone-numbers rather than reusing the placeholder from these examples |
| `to` | string | No | The recipient's number in E.164 form, without the +. At least one of this and `toUserId` **must be given** |
| `toUserId` | string | No | The recipient's BSUID (called `recipient` in Meta's request body), for example `US.13491208655302741918` |
| `type` | string | No | `text` / `template` / `image` / `video` / `audio` / `document` / `sticker` / `interactive` / `location` / `contacts` / `reaction`. **Treated as `text` when omitted** (for backwards compatibility); any other unrecognised value returns `400 VALIDATION_FAILED` |
| `<type>` | object \| object[] | Yes | The content object with the same name as `type`, required depending on the type (`contacts` is an array, the rest are objects). See "Request body shape by type" below for each type's fields |

Content-Type: `application/json`
Example:

```json
{
  "phoneNumberId": "<YOUR_PHONE_NUMBER_ID>",
  "to": "8613800138000",
  "type": "text",
  "text": {
    "body": "Hello",
    "preview_url": false
  }
}
```

For the complete request contract, see `MessageRequest` in [OpenAPI & Agent Access](../reference/openapi.md). It uses `oneOf` + `discriminator` to describe the 11 message shapes, rather than mis-describing the dynamic `<type>` as a plain string:

```yaml
MessageRequest:
  oneOf:
    - $ref: '#/components/schemas/TextMessageRequest'
    - $ref: '#/components/schemas/TemplateMessageRequest'
    - $ref: '#/components/schemas/ImageMessageRequest'
    - $ref: '#/components/schemas/VideoMessageRequest'
    # remaining types are in the OpenAPI document
  discriminator:
    propertyName: type
```

The schema also validates that at least one of `to` / `toUserId` is present, and that exactly one of the media `id` / `link` is given. Omitting `type` is backwards-compatibility behaviour for text only; new code should send `type` explicitly.

## Response

| Status | Description |
| --- | --- |
| `202` | Accepted, returns the full `MessageRecord`; does not mean it was delivered |
| `400` | Malformed request body, recipient, or idempotency key |
| `401` | API Key missing or invalid |
| `403` | Insufficient scope, or the recipient has opted out of marketing messages |
| `404` | The sending number does not exist, or is outside the current authorization scope |
| `409` | An idempotency conflict, or the 24-hour customer service window has closed |
| `429` | Rate limited, or Meta's per-person engagement cooldown |
| `500` | Internal platform error |

Example success response:

```json
{
  "id": "msg_01923abc",
  "tenantId": "tenant_01923abc",
  "phoneNumberId": "pn_01923abc",
  "metaPhoneNumberId": "1234567890",
  "toNumber": "8613800138000",
  "toUserId": null,
  "type": "text",
  "content": {"body": "Hello", "preview_url": false},
  "category": null,
  "status": "accepted",
  "wamid": null,
  "errorCode": null,
  "errorMessage": null,
  "metaError": null,
  "idempotencyKey": "order-8821-notify",
  "createdAt": "2026-09-22T10:00:00.000Z",
  "updatedAt": "2026-09-22T10:00:00.000Z"
}
```

Every error response carries an `X-Request-Id` response header, matching `error.requestId` in the body. For the complete field definitions, see `ErrorResponse` in [OpenAPI & Agent Access](../reference/openapi.md).

For the common error envelope and how to handle it, see [Error Codes](../guides/error-codes.md).

## Notes

#### Request body shape by type

`type` determines the shape of the content object with the same name; validation happens before anything is persisted — a malformed shape returns `400 VALIDATION_FAILED` and never enters the asynchronous send queue.

| type | Field of the same name | Required fields | Optional fields |
| --- | --- | --- | --- |
| `text` | `text` (object) | `body` | `preview_url` (boolean) |
| `template` | `template` (object) | `name`, `language.code` | `components` (object[]) |
| `image` | `image` (object) | `id` **or** `link` (**exactly one**) | `caption` |
| `video` | `video` (object) | `id` **or** `link` (exactly one) | `caption` |
| `audio` | `audio` (object) | `id` **or** `link` (exactly one) | — |
| `sticker` | `sticker` (object) | `id` **or** `link` (exactly one) | — |
| `document` | `document` (object) | `id` **or** `link` (exactly one) | `caption`, `filename` |
| `interactive` | `interactive` (object) | `type`; for `request_contact_info`, also a non-blank `body.text` and `action.name: "request_contact_info"` | Every other field is passed through to Meta as-is (`flow` / `button` / `list` / `cta_url` / `location_request_message` / `address_message` / `request_contact_info` are all supported, with no platform changes needed) |
| `location` | `location` (object) | `latitude` (-90..90), `longitude` (-180..180); either may be a number or a string | `name`, `address` |
| `contacts` | `contacts` (**array**, 1–257 entries) | `name.formatted_name` on each entry | `addresses`, `emails`, `org`, `phones`, `urls`, `birthday` (`YYYY-MM-DD`) |
| `reaction` | `reaction` (object) | `message_id` (must start with `wamid.`), `emoji` | — |

For media types, `id` and `link` **must have exactly one given** — supplying both or neither is a `400` (with the message `provide exactly one of \`id\` or \`link\``):

- `id` is a Meta media id obtained by uploading via `POST /v1/media` first — the upload endpoint checks size per media type (roughly 5 MB images, 16 MB audio/video/documents, 100 KB-500 KB WebP stickers; see [Media](../templates-flows-media/media.md));
- `link` is a URL Meta can reach publicly, which Meta fetches itself — **documents over 16 MB have to go this way** (Meta allows up to 100 MB only through `link`), as does anything else the upload endpoint rejects for size.

#### Requesting contact information

`interactive.type: "request_contact_info"` asks the user to share their phone number. Its shape is fixed — `body.text` plus `action: { name: "request_contact_info" }` — and the platform checks it locally: a missing `action.name` or blank `body.text` returns `400 VALIDATION_FAILED` instead of an unhelpful rejection from Meta.

```json title="Example interactive object"
{
  "type": "request_contact_info",
  "body": { "text": "Share your phone number so we can follow up on your order." },
  "action": { "name": "request_contact_info" }
}
```

A `202` only means the request was accepted, **not** that the user shared anything. If they share, it arrives as a `message` webhook of type `contacts` with `origin: contact_request`, plus a normalized `contact.info_shared` event — see [Webhook Integration](../guides/webhook-integration.md).

If the conversation so far only had the user's BSUID (`contactWaId` empty), the platform fills `contactWaId` on `GET /v1/conversations` with the shared `wa_id`, so you can send to that number from then on. Only a share with `origin: contact_request` is used, never a contact card the user sent directly (`origin: other`, which may be someone else's), and an existing `contactWaId` is never overwritten.

#### Marketing template delivery

Marketing-category templates are submitted through Meta’s Marketing Messages API. The platform sets `product_policy: CLOUD_API_FALLBACK`, so Meta falls back to Cloud API when the WABA has not signed the Marketing Messages terms. The caller still uses this same endpoint; the WABA’s stored `marketingMessagesStatus` does not select the route. Templates with Max Price use this same request endpoint and routing.

#### Binding parameters in template messages

The `parameters` inside `components` must match the placeholders declared when the template was created **exactly** in count and order, or Meta returns a parameter mismatch error. Template messages are not bound by the 24-hour customer service window and can be sent at any time.

#### Local pre-check for the 24-hour window

A free-form message (not a template) sent outside the window is determined locally **before anything is persisted** and returns `409 WHATSAPP_24H_WINDOW_EXPIRED` immediately, without reaching Meta and wasting a credit reservation. But this local check only catches the "definitely closed" case — a message the platform believes is inside the window when it has actually closed can still be rejected by Meta, which then falls through to the normal message failure code path (see the message failure code table on the "Error Codes" page).

An open window permits a non-template service reply but does not make it free: Meta charges for service replies and in-window utility templates sent on or after 2026-10-01. See [Billing & Credit Line](../guides/billing.md).

#### Media message limits

Format is never pre-checked by this endpoint — it is enforced by **Meta at delivery time** for both `id` and `link`, so a malformed message gets a 202 accepted first and only later fails via a status callback.

Size for `link` is likewise only checked by Meta at delivery (roughly 5 MB images, 16 MB audio and video, 100 MB documents). Size for `id` was already checked when the file was uploaded: `POST /v1/media` enforces a per-type limit (roughly 5 MB images, 16 MB audio/video/documents, 100 KB-500 KB WebP stickers) and returns `400` before the file ever reaches Meta — so an asset that was small enough to upload is small enough to send.

#### A recipient can be a phone number or a BSUID

At least one of `to` (phone number) and `toUserId` (BSUID) **must be given**; if both are given, the **phone number takes priority** (matching Meta's own precedence).

BSUID is a user identifier Meta has included on every inbound message since April 2026 (in the form `US.13491208655302741918`, unique per business combination), obtainable from `contactUserId` on `GET /v1/conversations`. **It is the only usable recipient identifier for some conversations** — once a user enables a WhatsApp username, Meta stops sending the phone number unless you've interacted with them in the last 30 days.

Three restrictions:

- **Templates with Max Price cannot be sent to a BSUID** (Meta error `131062`). Pass the recipient phone number in `to`; if both identifiers are present, the phone takes priority.
- **One-tap / zero-tap / copy-code authentication templates cannot be sent to a BSUID** (Meta requires a phone number for these). The platform rejects this locally before sending and explains why, rather than leaving you with an opaque `131062` — these templates are usually login codes, and a failure means the user cannot log in.
- BSUID is **unique per Business Portfolio**: using customer A's BSUID with customer B's number will fail.

Marketing opt-outs are checked against both identifiers: an opt-out Meta reported with only a BSUID also blocks sending to that user by phone number, and the reverse (see `MARKETING_OPT_OUT` in [Error Codes](../guides/error-codes.md)).
