RealTimeX
Sign inStart for free
RealTimeXAPI Documentationv1
IntroductionAuthenticationBase URLHeadersError codes
GETGet profilePATCHUpdate profilePATCHChange passwordGETList conversationsGETConversation metadata keysGETGet conversationGETConversation messagesPATCHUpdate conversationDELDelete conversationPOSTBulk delete conversationsGETList messagesGETMessage metadata keysPATCHUpdate messageDELDelete messagePOSTBulk delete messagesGETList usersGETUser metadata keysGETGet userPATCHUpdate userDELDelete userPOSTBulk delete users
Sample requestsSample responsesStatus codesAppendixChangelog
API ReferenceAPI endpointsPlatform

Delete Message

Overview

Permanently delete a single message from the tenant workspace by its ID.

Call this endpoint when removing one message from moderation tools, admin panels, or cleanup flows. On success the API returns a deletion count. For removing many messages at once, use Bulk Delete Messages instead.

When to use this endpoint?

Use Delete Message when:

  • Removing a single message after moderation or user request.
  • Cleaning up one incorrect or unwanted message from a conversation.
  • You already know the message _id from List Messages.
  • You need a confirmation count that exactly one message was deleted.

To delete many messages in one request, use Bulk Delete Messages.

DELETE{baseUrl}/api/{apiVersion}/client/messages/:messageId
Authentication
Required (Bearer token)
Tenant-scoped
Yes (tenant DB - requires x-client-id)

Request Headers

HeaderValueDescription
is-tenanttrueTargets the tenant DB ("true", needs x-client-id).
x-client-id{{clientId}}Tenant (client) id. Uses the {{clientId}} variable.

Path Parameters

ParameterExampleDescription
messageIdstringMessage _id (24-char Mongo ObjectId).

Success Response (HTTP 200 OK)

On success, the API confirms how many messages were deleted.

json
1{2  "success": true,3  "message": "Message deleted successfully",4  "data": {5    "messagesDeleted": 16  },7  "error": null8}

Error Responses

HTTP 404 Not Found - Not found

json
1{2  "success": false,3  "message": "Message not found",4  "data": null,5  "error": "Message not found"6}

Notes & Validation Rules

  • Message not found (HTTP 404 - Not found)

Common Errors

HTTP 200 OK means the message was deleted. Deletion fails when the message does not exist or authentication is missing.

CodeReason
400 Bad RequestRequired headers are missing or messageId is invalid.
401 UnauthorizedAccess Token is missing, invalid, or expired.
404 Not FoundMessage not found for the given messageId.
500 Internal Server ErrorAn unexpected error occurred while deleting the message.

Best Practices

  • Confirm the message exists via List Messages before deleting.
  • Treat deletion as irreversible - require an explicit confirmation in your UI.
  • Use Bulk Delete Messages when removing more than one message.
  • Refresh list views after a successful delete so removed messages disappear immediately.
  • Always send tenant headers and a valid Bearer token over HTTPS.

Message deleted

Refresh List Messages to confirm the record is gone. For batch cleanup, continue with Bulk Delete Messages.

PreviousUpdate messageNextBulk delete messages

On this page

OverviewWhen to use this endpoint?Request HeadersPath ParametersSuccess Response (HTTP 200 OK)Error ResponsesNotesCommon ErrorsBest Practices
Back to top