Skip to content
Wbiztool

Messaging API

Cancel Message API

Cancel a WhatsApp message that hasn't been sent yet. Use it to stop a scheduled reminder after an appointment is cancelled, or to pull back a queued message sent by mistake.

POSThttps://wbiztool.com/api/v1/cancel_msg/

Body: JSON or form fields

You can cancel any message that's still waiting to be sent (status 0, Created): scheduled messages, and messages queued by Send message, Send to group or Send to multiple numbers. A message that has already been sent can't be recalled. If a bot is already sending the message at that moment, it may still go out, so for critical cancellations confirm with Message status.

Quick example#

curl -X POST https://wbiztool.com/api/v1/cancel_msg/ \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": 12345,
    "api_key": "YOUR_API_KEY",
    "msg_id": 9817263
  }'

Replace 12345 and YOUR_API_KEY with your own values, and 9817263 with the msg_id you got when you sent or scheduled the message.

Request parameters#

client_idintegerrequired

Your API Client ID from Settings → API keys.

api_keystringrequired

Your API key from the same page.

msg_idintegerrequired

The msg_id returned by the send or schedule request. It must belong to the workspace of your API key.

This endpoint doesn't need whatsapp_client.

Using the official clients#

The Python and Node.js clients call this endpoint for you.

from wbiztool_client import WbizToolClient

client = WbizToolClient(api_key="YOUR_API_KEY", client_id=12345)

result = client.cancel_message(msg_id=9817263)
print(result)

Both clients throw on authentication errors (HTTP 400/403): Python raises requests.HTTPError, and Node.js throws API error: 400 - {…}. A Msg has been … reply comes back as a normal result with status: 0.

Response#

A successful request returns HTTP 200:

{
  "message": "Cancelled",
  "status": 1
}
FieldTypeDescription
statusinteger1 if the message was cancelled, 0 if it wasn't.
messagestringCancelled on success, otherwise the reason.

After cancelling, Message status reports the message as 3 (Cancelled). A cancelled message isn't sent, doesn't trigger its webhook and no longer counts against your remaining credits.

Errors#

Most errors return HTTP 200 with status set to 0, so always check status in the body:

{ "message": "Msg has been Sent", "status": 0 }
MessageHow to fix it
Msg has been SentThe message was already sent. It can't be cancelled.
Msg has been FailedThe message already failed, so there's nothing to cancel.
Msg has been CancelledThe message was cancelled earlier.
Msg has been ExpiredThe message expired before it was sent, so there's nothing to cancel.
No msg found for given msg_idCheck the msg_id. It must be a number and belong to the same workspace as your API key.
Msg_id cant be nullAdd msg_id.
Auth ErrorSend both client_id and api_key.
Invalid Client IdSend client_id as a number. Returned with HTTP 403.
Auth Error: invalid api keyCheck the key exists, hasn't been deleted and belongs to this client_id. Returned with HTTP 400.
Invalid JSON format: …The JSON body isn't valid, often because of a trailing comma, or you sent form fields without client_id.
Empty object {}A JSON body was sent with a method other than POST.

Tips#

  • Save every msg_id: you need it to cancel. For Send to multiple numbers, cancel each msg_id in the response separately.
  • Cancel early: once a message has been sent it stays sent, so cancel scheduled messages as soon as you know they're no longer needed.
  • Rescheduling: there's no endpoint to change a scheduled time. Cancel the message and schedule a new one.
  • Treat already-final messages as done: a Msg has been … reply means the message is no longer in the queue, so you don't need to retry.