aiAgentsCreate
AiFolderWrapper aiAgentsCreate(AiAgentsCreateRequest)
POST /api/2.0/ai/agents
Create an agent
Creates an AI agent room and binds a model to it, in that order. profileId is required, has to be a UUID, has to name an existing profile, and that profile has to support chat - an image-only model is refused here rather than failing on every later request. prompt is required and is stored on the room as its standing instruction with any markup stripped, so it cannot round-trip HTML into another user's reply. The two steps are not atomic: when the room is created but the model binding fails, the call reports an error and the room is left behind, so re-bind it with PUT api/2.0/ai/agents/{id} rather than creating a second one.
Parameters
| Name | In | Type | Description | Notes |
|---|---|---|---|---|
| AiAgentsCreateRequest | body | AiAgentsCreateRequest | [required] |
Responses
| Status code | Description | Type | Response headers |
|---|---|---|---|
| 200 | The created agent room, with the model already bound to it. | AiFolderWrapper | - |
| 400 | profileId is missing, is not a UUID, names no existing profile, or names one that does not support chat; or prompt is missing. | AiErrorResponse | - |
| 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 | - |
| 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