API reference
Agents
Agent definitions and the detail of the tasks a turn ran.
List agents
api.niucore.com/api/v1/agentsScope: agents:read
Agents visible to the credential, ordered by name. Includes your own inactive ones so their owner can see them; those cannot be attached to a turn.
Note
agents:read does not enable delegation and agents:use does not enable reading definitions: they are two strict scopes. To know which agents a turn can use, read the agents block of `GET /chat/catalog`.
Query
pageintegerdefaults to 1Page number, starting at 1.
sizeintegerdefaults to 50Items per page. Maximum 200.
Returns
idintegerIdentifier.
namestringName.
descriptionstring | nullWhat it is for.
tagstring | nullWork domain (finance, support…).
levelstringAgent scope.
visibilitystringprivate, shared or public.
is_activebooleanAn inactive agent of your own shows up when reading but cannot be attached to a turn and is not in the chat catalog.
is_anchoredbooleanMandatory for the company.
versionintegerDefinition version.
model_idinteger | nullFixed model for its tasks. null = inherits the turn's. As conductor (principal_agent_id) it always uses the turn's model.
created_atstring (date-time)Creation.
updated_atstring (date-time)Last edit.
Errors
- 503
api_v1_agents_disabledAgents are temporarily disabled in the API (meta.error_details.retry_action: "none"). History and task detail remain available.
curl -sS -X GET 'https://api.niucore.com/api/v1/agents' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": [
{
"id": 4,
"name": "Contador",
"description": "Cierra el mes y revisa asientos.",
"tag": "finanzas",
"level": "user",
"visibility": "private",
"is_active": true,
"is_anchored": false,
"version": 3,
"model_id": null,
"created_at": "2026-09-19T21:50:10Z",
"updated_at": "2026-09-23T10:02:44Z"
}
],
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77",
"page": 1,
"size": 50,
"total": 1
}
}Retrieve an agent
api.niucore.com/api/v1/agents /{agent_id}Scope: agents:read
Detail of one definition, with instructions and persona.
Path
agent_idintegerrequiredIdentifier.
Returns
idintegerIdentifier.
namestringName.
descriptionstring | nullWhat it is for.
tagstring | nullWork domain (finance, support…).
levelstringAgent scope.
visibilitystringprivate, shared or public.
is_activebooleanAn inactive agent of your own shows up when reading but cannot be attached to a turn and is not in the chat catalog.
is_anchoredbooleanMandatory for the company.
versionintegerDefinition version.
model_idinteger | nullFixed model for its tasks. null = inherits the turn's. As conductor (principal_agent_id) it always uses the turn's model.
instructionsstringDetail only. Canonical form, with {{type:id}} citations as-is: reading the definition does not authorize loading what it cites.
personaobjectDetail only. Tone traits.
created_atstring (date-time)Creation.
updated_atstring (date-time)Last edit.
Errors
- 404
api_v1_not_foundIt does not exist, or it is outside the credential's scope. Both cases answer the same. - 503
api_v1_agents_disabledAgents are temporarily disabled in the API (meta.error_details.retry_action: "none"). History and task detail remain available.
curl -sS -X GET 'https://api.niucore.com/api/v1/agents/4' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": {
"id": 4,
"name": "Contador",
"description": "Cierra el mes y revisa asientos.",
"tag": "finanzas",
"level": "user",
"visibility": "private",
"is_active": true,
"is_anchored": false,
"version": 3,
"model_id": null,
"created_at": "2026-09-19T21:50:10Z",
"updated_at": "2026-09-23T10:02:44Z",
"instructions": "Sos el contador de la empresa. Buscá en {{workspace:31}} antes de responder.",
"persona": {
"tone": "formal",
"verbosity": "brief",
"language": "es"
}
},
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77"
}
}Agent tasks of a message
api.niucore.com/api/v1/chats /{chat_id} /messages /{message_id} /agent-runsScope: chat:read
Durable state of the tasks a turn ran: summary plus brief, steps, messages between tasks and result. Includes temporary, failed and cancelled tasks, and survives the agent being deleted later.
It is this credential's history: it requires chat:read, and agents:read does not grant access to other chats. Another credential of the same user, another chat, another message or a deleted chat answer 404.
Note
It retrieves what was stored; it does not replay the stream. Steps carry no tool arguments or results; the brief, lists and result are bounded, and truncated: true tells you when something was cut.
Path
chat_idstring (uuid)requiredChat.
message_idintegerrequiredMessage (turn).
Query
pageintegerdefaults to 1Page number, starting at 1.
sizeintegerdefaults to 50Items per page. Maximum 200.
Returns
task_idstringOpaque correlation for the task within the message. It is the same in message.step, message.action_required, the terminal and the history. It authorizes nothing: an approval is resolved with its action_id.
agent_idinteger | nullnull for a temporary agent.
namestringName at run time.
kindstringuser or temporal.
tagstring | nullTag.
statestringsubmitted, working, waiting, input_required, paused, completed, failed or cancelled.
reasonstring | nullReason for an externally requested terminal.
modelstring | nullEffective model.
providerstring | nullEffective provider.
model_requestedstring | nullFixed model the definition requested.
fallback_reasonstring | nullWhy the requested model was not used.
operation_outcomestring | nullnot_dispatched, applied or unknown. `unknown` is not a safe retry, even if the turn was cancelled.
retry_safeboolean | nullWhether repeating the task is safe.
tokensobjectThe task's input_tokens, output_tokens, total_tokens. Already included in the turn's usage.total_tokens.
started_atstring | nullStart.
finished_atstring | nullEnd.
updated_atstring | nullLast write.
briefobject | nullBrief: objective, output_format, tools_guidance, boundaries, inputs, label.
stepsarray{ title, status, detail?, tools? }.
messagesarrayMessages between tasks: { from_name, state, content, created_at }. They are data, not user instructions.
resultstring | nullTask result.
truncatedbooleanSomething was cut.
Errors
- 404
api_v1_not_foundIt does not exist, or it is outside the credential's scope. Both cases answer the same.
curl -sS -X GET 'https://api.niucore.com/api/v1/chats/3f6b1a90-6c2d-4d84-a0b1-9d0f5e7c2ab3/messages/90214/agent-runs' \
-H "Authorization: Bearer $NIUCORE_ACCESS_TOKEN"{
"status": "success",
"message": "Operación exitosa",
"message_code": "api_v1_ok",
"data": [
{
"task_id": "task_6f0d2a9b41c8e7735a10bd42",
"agent_id": 4,
"name": "Contador",
"kind": "user",
"tag": "finanzas",
"state": "completed",
"reason": null,
"model": "gpt-4o",
"provider": "openai",
"model_requested": null,
"fallback_reason": null,
"operation_outcome": "applied",
"retry_safe": null,
"tokens": {
"input_tokens": 1840,
"output_tokens": 312,
"total_tokens": 2152
},
"started_at": "2026-09-25T10:00:01Z",
"finished_at": "2026-09-25T10:00:19Z",
"updated_at": "2026-09-25T10:00:19Z",
"brief": {
"objective": "Conciliar los asientos de agosto.",
"output_format": "Tabla con diferencias."
},
"steps": [
{
"title": "Buscando en tus bibliotecas",
"status": "completed",
"tools": [
"search_documents"
]
}
],
"messages": [],
"result": "Hay dos asientos sin contrapartida: 4471 y 4502.",
"truncated": false
}
],
"meta": {
"request_id": "9f1c0a3e-7b2d-4f18-9a55-2c6e0d1b4a77",
"page": 1,
"size": 50,
"total": 1
}
}