Returning.AIDocs
v1

API reference / Messaging

.md

Delete message

Permanently remove a channel message in your community by its message ID.

Last updated 21 Nov 2026API v1

Method
DELETE
Path
https://api.returning.ai/v1/messages/{messageId}
Permission
deleteMessage
Retries
After a timeout or 503, check the channel and retry with the same message ID if the message is still present.

When to use this

  • Remove a channel message after a moderation decision in your own system.
  • Remove an ordinary message your integration posted to a community channel.

Authentication#

Header
Authorization: Bearer <API_KEY>
Permission
deleteMessageShown in the dashboard as “Delete Messages” on community API keys.

Use a Community API key with deleteMessage (Delete Messages). Keep the key on your server.

A missing key returns 401 with Invalid token. An invalid key returns 401 with Invalid API key. A community key missing Delete Messages permission returns 401 with Your API key does not have permission to access this action. The permission error contains only message.

Behaviour#

The key can delete ordinary messages from channels in its community, including messages written by other members. A direct message or a message outside the key's community returns 404. A broadcast or a forum topic's main post in the key's community returns 409. Send the message ID in the path and leave the request body empty.

Request#

Path parameters#

messageId#stringREQUIRED
The message's id from Get messages.

Rule24 hex characters

Eg"66f000000000000000000a21"

Headers#

Authorization#stringREQUIRED
Community API key with deleteMessage.

RuleBearer <API_KEY>

curl --request DELETE \
  --url https://api.returning.ai/v1/messages/66f000000000000000000a21 \
  --header 'Authorization: Bearer <API_KEY>'

Response#

A 200 confirms that the message was removed. Returning.AI also attempts to reverse rewards earned from the message and its reactions. Some of that work runs after the response. If you receive partial: true, the message was removed and an associated action failed. Ask support to check the side effects using the returned messageId.

status#stringALWAYS
success when the message was removed.

Eg"success"

message#stringALWAYS
Human-readable confirmation.

Eg"Message deleted"

messageId#stringALWAYS
The deleted message ID, in lowercase.

Rule^[a-fA-F0-9]{24}$

Eg"66f000000000000000000a21"

partial#booleanCONDITIONAL
Present as true if the message was deleted and an associated action failed before the response.

Ruletrue

{
  "status": "success",
  "message": "Message deleted",
  "messageId": "66f000000000000000000a21"
}

Errors#

Fix the request02

400Fix the request
Copy the 24-character message id from Get messages.
401Fix the request
Use a valid community API key with Delete Messages permission. A missing key, invalid key and missing permission all return 401.

Fix the data01

404Fix the data
Check the ID and community. If you already confirmed the original deletion, stop retrying.

Retry with backoff02

500Retry with backoff
Retry with backoff when authentication is available again.
503Retry with backoff
Check whether the message is still visible and retry with the same ID if needed.

Do not retry01

409Do not retry
Use the community's moderation controls for a broadcast or a forum topic's main post.

Retries

A repeat delete returns 404 once the message is gone. After a timeout or 503, read the channel to check the outcome before trying the same ID again. A 404 on its own can also mean the message is outside your community, so check the ID and channel if you have no earlier confirmation. Retrying a deleted message does not rerun its reward reversals.

{
  "status": "error",
  "message": "Message ID must be a 24-character hex ObjectId"
}

Next step#

Get messagesGET/v1/messagesRead the channel to confirm the message is gone.