delete_ai_project

ArtificialIntelligenceApi.delete_ai_project(project_id, role_id, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Delete an AI project

Starts deleting an AI project in the background. You must be an owner of the project. The project status is set to deleting and the work is queued. A 200 means deletion was accepted, not that it has finished — poll GET /ai/projects/{project_id} until it returns 404. If background deletion fails, status becomes delete-failed and Message holds the error. The original call still returned 200. Deletion removes the project’s data, chats, comments, avatar, guard-rail link, and access entries. Notes are detached from the project but not deleted. Linked knowledge bases and agents are unlinked, not deleted. Calling this again after the project is gone returns 400.

Parameters:
  • project_id (str) – (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:

DeleteProjectResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: DELETE /ai/projects/{project_id}

Success (HTTP 200)

Deletion was accepted and is running in the background. The project is not gone yet; ProjectStatus is deleting.

Request / response example

{
  "Message": "Project deletion triggered successfully"
}

Errors

Documented error codes: AUTH-1001, AUTH-1030, AUTH-1012, IPV-1002, AI-1002, GE-1008.

HTTP 400

The request was invalid, you do not have permission, or deletion could not be started. The body is {“Message”: “<CODE> - <text>”}. Common cases include a missing role_id (AUTH-1001), missing ai.fullaccess permission (AUTH-1030), not being an owner (AUTH-1012), a project that does not exist (IPV-1002, returned as 400 rather than 404), or the background job failing to start (AI-1002; status is delete-failed and you can retry). Permission and not-found cases return 400, not 403 or 404.

notOwner

{
  "Message": "AUTH-1012 - User: jsmith requires at least owner access on the resource to perform this action."
}

projectNotFound

{
  "Message": "IPV-1002 - Invalid ProjectId - 7c9e6f3a-2b41-4d8e-9a15-6f0c2d5b8e41, resource not found."
}

triggerFailed

{
  "Message": "AI-1002 - Failed to trigger project deletion"
}

HTTP 500

An unexpected server error. The body is typically {“Message”: “GE-1008 - Could not complete the request. Please try again.”}.

Request / response example

{
  "Message": "GE-1008 - Could not complete the request. Please try again."
}