create_ai_project_thread

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

Create a thread in a project

Starts a new conversation thread in a project and returns its identifier. You need at least read-only access to the project. The call takes no request body. The thread is created with the title “New Thread” and visibility private, and you become its owner; rename it or share it afterwards with the thread update endpoint. It also joins the project’s RecentThreads list, which keeps the five most recently active threads.

Parameters:
  • role_id (str) – Amorphic role used to authorize this request. (required)

  • project_id (str) – Identifier of the project to create the thread in. You must have atleast read-only access to it. (required)

  • content_type (str) – Media type of the request. Send application/json. This operation reads no request body.

  • _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:

CreateAiProjectThreadResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: POST /ai/projects/{project_id}/threads

Success (HTTP 200)

The thread was created. `ThreadId` is the identifier to use on the thread detail, update, delete and messages endpoints.

Thread created

{
  "Message": "Thread created successfully",
  "ThreadId": "e2a91c5b-7d64-4f38-91ac-3b5e0d7f2c18"
}

Errors

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

HTTP 400

The request was invalid or you do not have permission. The body is {“Message”: “<CODE> - <text>”}. Common cases include an unknown project (IPV-1002), no access to the project (AUTH-1012), a missing role_id header (AUTH-1001), or the role lacking ai.view (AUTH-1030). Permission failures return 400, not 403.

Project does not exist

{
  "Message": "IPV-1002 - Invalid ProjectId - 7b3f2c18-4a5d-4e91-9c0a-2d6e8f1b3a44, resource not found."
}

Role is missing the ai.view permission

{
  "Message": "AUTH-1030 - User is not authorized to initialize a new AI thread conversation session due to the following missing permission(s) - {'Ai': ['view']}"
}

HTTP 500

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

Request could not be completed

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