WhatsApp Gateway
API referenceMessages

Edit a sent text message

Replaces the text body of a message you already sent, identified by `mid` in the path and located by `chat` in the body. **Constraints:** - Only **text** messages can be edited; editing media or other kinds is not supported. - The message must have been sent by this session. This is a synchronous send to WhatsApp and returns **200** with a `SendResult`. ### Preconditions & errors - Requires the **`send`** capability. - **400 `validation_error`** — missing/empty `text` or a non-text message. - **404 `not_found`** — the session or message does not exist or is not owned by your organization.

PATCH
/api/v1/sessions/{session}/messages/{mid}

Authorization

AuthorizationBearer <token>

Send Authorization: Bearer <token>. The router accepts two kinds of token and tries each in turn: a frontend-minted login JWT (verified against the frontend JWKS; the person's org + role are read from it), or an api-key for a script/service (carrying a fixed set of gateway permissions). The bearerFormat: JWT label describes the person-login case.

In: header

Path Parameters

session*string

The WhatsApp session id that originally sent the message. Must be a connected session your organization owns.

mid*string

The WhatsApp message id (the per-message stable id assigned by WhatsApp) of the message to edit. Must be a text message previously sent by this session.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

chat?string

The JID of the chat the message lives in (e.g. "123...@s.whatsapp.net" for a direct chat or "123...@g.us" for a group). Identifies which conversation the message id belongs to.

text?string

The new text body that replaces the message's current text. Required. Only text messages can be edited — editing media or other kinds is not supported.

Response Body

application/json

application/json

curl -X PATCH "https://example.com/api/v1/sessions/01HZX.../messages/3EB0C431C26A1916E07A" \  -H "Content-Type: application/json" \  -d '{}'
{  "mode": "string",  "outboxId": "string",  "replayed": true,  "status": "string",  "timestamp": 0,  "waMessageId": "string"}
{  "error": {    "code": "not_found",    "details": {      "property1": null,      "property2": null    },    "message": "session not found"  }}

Send a message POST

Sends one message from the given session. There is a **single** send endpoint for every kind of message; the discriminated `type` field in the request body chooses which one. **Supported in v1:** `text`, `poll`, `location`, and `contact`. **Not implemented yet:** the media types `image`, `video`, `audio`, `document`, and `sticker` return **501 `not_implemented`** before any WhatsApp call is made. ### Delivery mode (`?async`) - **Synchronous (default, `?async=false`):** the call blocks until WhatsApp acknowledges the send and returns **200** with the final `SendResult`. - **Asynchronous (`?async=true`):** the gateway persists the send to a queue and returns **202** immediately with a queued `SendResult`. The final delivery status arrives later as a `message.status` event on the event stream. ### Idempotency (`Idempotency-Key` header) Supply a stable key to make retries safe: replaying a send with a key already seen for your organization returns the **original** result and does not dispatch a second WhatsApp message. ### Preconditions & errors - Requires the **`send`** capability. - The session must exist, be owned by your organization, and be connected. - **400 `validation_error`** — malformed body or an unsupported/invalid field for the chosen `type`. - **404 `not_found`** — the session does not exist or is not owned by your organization. - **429 `rate_limited`** — over the per-session send rate limit. A synchronous send is rejected with 429; an async send stays queued instead of failing. - **501 `not_implemented`** — a media `type` that is not built yet.

Revoke a message (delete for everyone) DELETE

Deletes the message identified by `mid` in the path **for everyone** in the chat — not just on your own device. Located by `chat` (and `sender`) in the body. Use the `sender` body field to revoke another participant's message (e.g. as a group admin); leave it empty to revoke your own message. This is a synchronous operation and returns **200** with a `SendResult`. WhatsApp enforces its own time/role limits on who may revoke what. ### Preconditions & errors - Requires the **`send`** capability. - **404 `not_found`** — the session or message does not exist or is not owned by your organization.