Delete message
Permanently remove a channel message in your community by its message ID.
- 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#
id from Get messages.Rule24 hex characters
Eg"66f000000000000000000a21"
Headers#
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.
success when the message was removed.Eg"success"
Eg"Message deleted"
Rule^[a-fA-F0-9]{24}$
Eg"66f000000000000000000a21"
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
id from Get messages.401.Fix the data01
Retry with backoff02
Do not retry01
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"
}