delete_ai_project_thread¶
- ArtificialIntelligenceApi.delete_ai_project_thread(project_id, thread_id, role_id, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
Delete a project thread
Permanently deletes a thread, every message in it and every file attached to it, and drops it from the project’s RecentThreads list. You need at least read-only access to the project. There is no undo and no soft delete. The call is idempotent only in the sense that a second attempt fails with a not-found error rather than deleting anything else.
- Parameters:
project_id (str) – Identifier of the project the thread belongs to. You must have at least read-only access to it. (required)
thread_id (str) – Identifier of the thread to delete. (required)
role_id (str) – Amorphic role used to authorize this request. (required)
_request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
_request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
_content_type (str, Optional) – force content-type for the request.
_headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
_host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
- Return type:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: DELETE /ai/projects/{project_id}/threads/{thread_id}
Success (HTTP 200)¶
The thread, its messages and its files were deleted. The deletion has already completed when this returns.
Thread deleted
{
"Message": "Thread deleted successfully"
}
Errors¶
Documented error codes: IPV-1002, AUTH-1012, AUTH-1001, AUTH-1030, GE-1008, DB-1003.
HTTP 400
The request was invalid or you do not have permission. The body is {“Message”: “<CODE> - <text>”}. Common cases include an unknown project or thread (IPV-1002), no access to the project (AUTH-1012), a missing role_id header (AUTH-1001), or the role lacking ai.manage (AUTH-1030). Permission failures return 400, not 403.
Thread does not exist
{
"Message": "IPV-1002 - Invalid ChatId - e2a91c5b-7d64-4f38-91ac-3b5e0d7f2c18, resource not found."
}
Role is missing the ai.manage permission
{
"Message": "AUTH-1030 - User is not authorized to permanently delete a thread conversation and all associated messages due to the following missing permission(s) - {'Ai': ['manage']}"
}
HTTP 500
An unexpected server error. The body is {“Message”: “GE-1008 - Could not complete the request. Please try again.”}. A failure while removing the thread’s files or record surfaces as DB-1003, and the thread may be partly deleted.
Request could not be completed
{
"Message": "GE-1008 - Could not complete the request. Please try again."
}