Skip to content

Messages

Edit a message

Replaces the text of a text message sent from the workspace’s number, on WhatsApp and in whatsappx.si, and returns the stored message with its new content and edited_at. Live listeners receive message.updated and conversation.updated events.

PATCH/api/conversations/{id}/messages/{messageId}
  • Bearer API key
  • Scope: write
  • or app session
  • Workspace: X-Tenant-ID (optional with a key)

Path parameters

  • iduuidrequired

    Conversation id.

    Example
    6a1f3c52-8e0b-4d7a-b1f2-93c4d5e6f708
  • messageIduuidrequired

    Message id in whatsappx.si: the id of a Message, not its whatsapp_message_id.

    Example
    7c8d9e0f-1a2b-4c3d-8e4f-5a6b7c8d9e0f

Headers

  • Authorizationstringrequired

    Your API key as Bearer <key>. The word Bearer and the space are case-sensitive. Browser clients signed in to the app use the session cookie instead.

    Constraints
    Keys start with pk_live_ and are 56 characters long.
    Example
    Bearer pk_live_…
  • X-Tenant-IDuuidoptional

    Workspace id. Optional with an API key (a key always acts in its own workspace); if you send it, it must match the key’s workspace. Required with a session cookie. You can pass ?tenant=<id> instead.

    Example
    8d0f6c2e-3b1a-4c55-9a7e-2f4b6d1e9c30

Body

application/json
  • bodystringrequired

    The new text. Leading and trailing spaces are trimmed.

    Constraints
    Not empty, different from the current text, at most 4096 bytes.
    Example
    Yes, it is ready. We are open until 7 pm.

Response

200 OKapplication/json

  • iduuid

    Message id in whatsappx.si.

  • whatsapp_message_idstring

    Message id assigned by WhatsApp.

  • conversation_iduuid

    Conversation the message belongs to.

  • sender_jidstring

    WhatsApp id (JID) of the sender. For your own messages, the connected number.

  • sender_namestring

    Sender display name, when WhatsApp provides one (may be empty).

  • contentstring

    Message text. On numbers linked by QR code, images and documents carry their caption here. On the Cloud API, non-text messages are stored as a placeholder such as [image message].

  • message_typestring

    text, image or document on numbers linked by QR code. Non-text messages received through the Cloud API keep the type name Meta sends (for example image or audio) and have no downloadable media.

  • media_urlstringmay be absent

    Path of the downloaded media file, for example /api/media/<workspace>/<file>. Prefix it with https://whatsappx.si and send your API key to download it.

  • mime_typestringmay be absent

    MIME type of the media file.

  • file_namestringmay be absent

    Original file name of a document.

  • file_sizeintegermay be absent

    Media size in bytes.

  • timestamptimestamp

    When the message was sent on WhatsApp (RFC 3339).

  • from_meboolean

    true for messages sent from the connected number (by your team, the API or an automation).

  • statusenum

    received for incoming messages, sent for outgoing ones. Delivered and read receipts are not tracked.

  • edited_attimestampnullable

    When the text was last edited: through the API or the app, or by its sender on WhatsApp. null if never edited.

  • deleted_attimestampnullable

    When the message was deleted for everyone. Its content and media fields are then empty. null if not deleted.

  • created_attimestamp

    When whatsappx.si stored the message (RFC 3339).

Status codes

  • 200OK. The message was edited.
  • 400Bad request. The message cannot be edited: Messages can only be edited within 15 minutes of being sent, Only text messages can be edited, Only messages sent from this workspace's number can be edited, a Cloud API number (see below), or conversation belongs to an inactive channel. Or the text is wrong: message body is required, The new text is the same as the current message, message body too long. Also invalid request body, invalid conversation id, invalid message id.
  • 401Unauthorized. The API key is unknown, revoked or expired (invalid or expired API key), or there is no key and no signed-in session (unauthorized).
  • 402Payment required. Only when subscriptions are enforced and the workspace has no active subscription. The body includes code: "payment_required".
  • 403Forbidden. The API key has the read scope, which only allows GET requests (API key is read-only). A key in another workspace gets API key belongs to a different workspace.
  • 404Not found. The conversation does not exist in this workspace, belongs to the inactive connection, or (for agents signed in to the app) is not assigned to you (conversation not found); or the message is not in this conversation (message not found).
  • 409Conflict. The message was already deleted (This message was already deleted), or the WhatsApp connection is not ready (whatsapp is not connected).
  • 502Bad gateway. WhatsApp did not accept the edit. The message is unchanged; try again in a moment.

Which messages can be changed?

EditDelete for everyone
Who sent itYour number (from_me: true): your team, the API, an automation, or the phone itselfSame
Message typetext onlyAny (text, image, document)
Time limit15 minutes after timestamp48 hours after timestamp

The limits follow WhatsApp’s apps: they offer Edit for 15 minutes, and “Delete for everyone” for about two and a half days, of which the API allows 48 hours. Outside them, and for messages a contact sent, the API answers 400 and nothing is sent to WhatsApp.

What do contacts see?

An edited message shows the new text, marked as edited. A deleted message shows “This message was deleted” on every device in the chat.

What happens to the stored message?

  • Edit: content is the new text and edited_at the time of the edit.
  • Delete: deleted_at is set; content and the media fields (media_url, mime_type, file_name, file_size) are cleared and the stored file is removed. The message stays in the list, in its place.

Edits and deletes made on WhatsApp itself (by the contact, or from your phone) update the stored message the same way. Each change, from the API or from WhatsApp, sends a message.updated event.