create_ai_chat

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

Create a new chat

Creates a playground chat titled Untitled Chat, grants the caller owner access, and sets ExpirationTime from the user’s ChatExpirationDays (default 30 days). No request body is read. Returns Message and ChatId.

Parameters:
  • role_id (str) – Amorphic role ID of the requesting user. Must be a role the authenticated user belongs to. (required)

  • content_type (str) – Request body media type. Optional; this endpoint does not use a 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:

CreateAiChat200Response

Returns:

Returns the result object.

Request and Response Examples

HTTP: POST /ai/playground/chats

Parameter examples

Name

In

Example

Content-Type

header

"application/json"

role_id

header

"custom-role-123e4567-e89b-12d3-a456-426614174000"

Success (HTTP 200)

Chat created. Title is Untitled Chat.

Request / response example

{
  "Message": "Chat created successfully",
  "ChatId": "123e4567-e89b-12d3-a456-426614174000"
}

Errors

Documented error codes: IPV-1002, GE-1009, AI-1004, AUTH-1001, AUTH-1011, GE-1008, DB-1002.

HTTP 400

Input validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Codes: IPV-1002 (user not found), GE-1009 (chat already exists), AI-1004 (AICore disabled), AUTH-1001 (missing role_id), AUTH-1011 (caller not authorized).

Missing role_id header

{
  "Message": "AUTH-1001 - Missing role information in event header"
}

Caller not authorized

{
  "Message": "AUTH-1011 - User does not have sufficient permission to perform this action"
}

HTTP 500

Backend failure. Body is {“Message”: “<CODE> - <text>”}. Codes: GE-1008 (unexpected backend failure), DB-1002 (persistence failure).

Unexpected backend failure

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