aiThreadsOpenOrCreate
AiOpenOrCreateResult aiThreadsOpenOrCreate(AiThreadsOpenOrCreateRequest)
POST /api/2.0/ai/threads/open-or-create
Open or create
Opens a chat thread and returns it with its history, or creates one whose title is generated from the first message supplied in the request. That first message is not persisted: follow up with POST api/2.0/ai/threads/append-user-message to store it, or start the round directly with POST api/2.0/ai/ai/send-with-stream. Unlike create this takes a whole resolved profile object rather than an ID, and a request without one answers 404 because no model could be bound. A supplied entityId has to be a room the caller can open; anything that is not an agent room folds to the global scope instead of being rejected.
Parameters
| Name | In | Type | Description | Notes |
|---|---|---|---|---|
| AiThreadsOpenOrCreateRequest | body | AiThreadsOpenOrCreateRequest | [required] |
Responses
| Status code | Description | Type | Response headers |
|---|---|---|---|
| 200 | The thread that was opened or created, with its prior messages. A created one carries the generated title. | AiOpenOrCreateResult | - |
| 401 | Missing asc_auth_key cookie or Authorization header. | AiErrorResponse | - |
| 403 | AI is disabled for this portal, the caller is a guest, or the room named by entityId is one the caller cannot open. Relayed from the DocSpace AI service or the Files API. | AiErrorResponse | - |
| 404 | The entityId names a room the caller cannot open, or no live AI profile is bound to it. | AiErrorResponse | - |
| 413 | The request body is larger than 100 KB, the JSON parser's limit on this route. | AiErrorResponse | - |
| 500 | Unhandled failure. The reason is logged server-side and never echoed back. | AiErrorResponse | - |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json