How can I delete a message via the API? #14140

Closed
opened 2026-02-21 19:15:45 -05:00 by yindo · 2 comments
Owner

Originally created by @gaoconggit on GitHub (May 23, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.3.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

DELETE {{baseUrl}}/v1/messages/{message_id}
Authorization: Bearer {api_key}
Content-Type: application/json

{
"user": "id"
}

✔️ Expected Behavior

Message deleted successfully

Actual Behavior

<!doctype html>

<html lang=en>

Not Found

The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

Originally created by @gaoconggit on GitHub (May 23, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.3.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce DELETE {{baseUrl}}/v1/messages/{message_id} Authorization: Bearer {api_key} Content-Type: application/json { "user": "id" } ### ✔️ Expected Behavior Message deleted successfully ### ❌ Actual Behavior <!doctype html> <html lang=en> <title>404 Not Found</title> <h1>Not Found</h1> <p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>
yindo added the 🙋‍♂️ question label 2026-02-21 19:15:45 -05:00
yindo closed this issue 2026-02-21 19:15:45 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (May 23, 2025):

The 404 error occurs because the endpoint you tried (/v1/messages/{message_id}) does not exist in Dify's API. Based on the codebase, the correct API endpoint for deleting a message is:

DELETE /installed-apps/<uuid:installed_app_id>/saved-messages/<uuid:message_id>

This endpoint is implemented in the SavedMessageApi class and will delete the specified message if the request is valid. Make sure to replace <uuid:installed_app_id> with your installed app's UUID and <uuid:message_id> with the UUID of the message you want to delete. The request should include your Bearer token for authorization.

Example request:

DELETE {{baseUrl}}/installed-apps/{installed_app_id}/saved-messages/{message_id}
Authorization: Bearer {api_key}

A few things to check if you encounter issues:

  • Ensure you are using the correct installed_app_id and message_id.
  • The app must be in "completion" mode for deletion to be allowed.
  • Your user must have the necessary permissions.

There is no comprehensive public API documentation for this, so these details are based on the code implementation. You can see the relevant code and endpoint definition here.

If you continue to have trouble, double-check the UUIDs and your permissions.

To continue talking to Dosu, mention @dosu-bot.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (May 23, 2025): <!-- Answer --> The 404 error occurs because the endpoint you tried (`/v1/messages/{message_id}`) does not exist in Dify's API. Based on the codebase, the correct API endpoint for deleting a message is: ``` DELETE /installed-apps/<uuid:installed_app_id>/saved-messages/<uuid:message_id> ``` This endpoint is implemented in the `SavedMessageApi` class and will delete the specified message if the request is valid. Make sure to replace `<uuid:installed_app_id>` with your installed app's UUID and `<uuid:message_id>` with the UUID of the message you want to delete. The request should include your Bearer token for authorization. Example request: ``` DELETE {{baseUrl}}/installed-apps/{installed_app_id}/saved-messages/{message_id} Authorization: Bearer {api_key} ``` A few things to check if you encounter issues: - Ensure you are using the correct `installed_app_id` and `message_id`. - The app must be in "completion" mode for deletion to be allowed. - Your user must have the necessary permissions. There is no comprehensive public API documentation for this, so these details are based on the code implementation. You can see the relevant code and endpoint definition [here](https://github.com/langgenius/dify/blob/main/api/controllers/console/explore/saved_message.py). If you continue to have trouble, double-check the UUIDs and your permissions. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://go.dosu.dev/dosubot), mention @dosu-bot.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/e6662b14-6598-4511-b682-9b608f65febf?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/e6662b14-6598-4511-b682-9b608f65febf?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/e6662b14-6598-4511-b682-9b608f65febf?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/e6662b14-6598-4511-b682-9b608f65febf?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e6662b14-6598-4511-b682-9b608f65febf?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/e6662b14-6598-4511-b682-9b608f65febf?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/e6662b14-6598-4511-b682-9b608f65febf?feedback_type=other)</sup>
Author
Owner

@gaoconggit commented on GitHub (May 23, 2025):

404 Not Found

@gaoconggit commented on GitHub (May 23, 2025): 404 Not Found
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#14140