---
title: "PATCH /connections/{phoneNumber}/messages"
method: PATCH
path: "/connections/{phoneNumber}/messages"
tags: ["Connections"]
---

# PATCH /connections/{phoneNumber}/messages

`PATCH /connections/{phoneNumber}/messages`

Edits a previously sent message. Only text messages (including captions) can be edited. The message must have been sent by you and must be within the editable time window (approximately 15 minutes).

## Path parameters

- `phoneNumber` string, required

## Request body

- object
  - `jid` string, required — WhatsApp JID [Chat JID where the message exists]
  - `key` object, required
    - `id` string, required — Message ID
    - `remoteJid` string
    - `fromMe` boolean
    - `participant` string
  - `messageContent` object, required — Message content that can be edited. Only text messages can be edited on WhatsApp.
    - `text` string, required — New text content for the message
    - `mentions` string[]

## Response `200`

Message edited successfully

- object
  - `data` object, required
    - `key` object, required
      - `id` string
      - `remoteJid` string
      - `fromMe` boolean
      - `participant` string
    - `messageTimestamp` string, required

## Other responses

- `403` — Forbidden — the API key does not own this connection. Returned when a connection is bound to a different API key.
- `421` — Misdirected Request — in cluster mode, this instance does not own the connection. The owning instance id is in the x-baileys-owner header; a proxy re-routes the request there. Not returned for the explicit-takeover routes: POST /connections/{phoneNumber}, /import-session and /restart.
- `500` — Message not edited
- `503` — Connection is not accepting sends. Returned when the circuit breaker is open (send stall detected) and when a keystore transaction gives up waiting for its mutex; in the second case the message was definitively not sent. Carries `x-baileys-send-state: stalled`, which is what tells this apart from an ordinary 503 (outage, draining proxy): the connection is up and must NOT be marked down.
- `504` — Send timed out; outcome unknown. Carries `retry-after` only when a retry cannot duplicate the message — i.e. a `messageId` or a `chatwootMessageId` was supplied. Otherwise it carries `x-baileys-idempotency-state: unprotected` and no `retry-after`: nothing would stop a retry from sending a second message.

---

[API](https://skmtc.net/fazer-ai/apis/fazer-ai-baileys-api.md) · [All operations](https://skmtc.net/fazer-ai/apis/fazer-ai-baileys-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/fazer-ai/fazer-ai-baileys-api/revisions/5299037901a9/schema)
