Agents · Create
Create an agent via API
Endpoint
https://claix.dev/agentsCreates a Claix Retrieve agent on the API key account, with assigned routes and a response mode. It starts active and ready at /retrieve/{slug}.
This call is free.
1. Authentication
x-api-key: <YOUR_API_KEY>
or
Authorization: Bearer <YOUR_API_KEY>
2. Request format
Method: POST · Content-Type: application/json. The query limit and scope are optional. Omit the limit and the agent stays unlimited. Omit scope and the agent does not restrict rows.
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Visible agent name (max 80). |
| slug | string | Yes | URL id for /retrieve/{slug}. 3–20 chars: a-z and 0-9. |
| description | string | Yes | What the agent is for (max 500). |
| prompt | string | Yes | Business instructions (max 12,000). |
| routes | uuid[] | Yes | route_id list from your account. At least one. |
| response_mode | string | Yes | "bruto" (SQL rows) or "razonada" (typed answer). |
| call_limit_period | string | No | day, week, month, or unlimited. Defaults to unlimited. The week runs Monday through Sunday (UTC). calls_limit_period is also accepted. |
| call_limit | integer | When the period is day, week, or month | Successful queries allowed in that period (1–1000000). Each question in a successful call counts as one. A call that would pass the remaining allowance is rejected and does not count. calls_limit is also accepted. |
| scope | object | null | No | Multi-tenant configuration. See the next section. Null or { "rules": [] } stores the agent with no row restriction. |
3. Multi-tenant configuration
scope says which rows the agent may read in each table. If you omit it, the agent may read every row on its routes.
It is an object with a rules list (1 to 20 rules). Each rule names the tables it applies to and one or more conditions in any_of. Conditions in the same rule are combined with OR: a row only has to match one of them.
A condition is a field name and the value that is allowed. A single value requires an exact match. A list allows any of those values.
The same fact can have a different name in each table. In the example, customer 42 is id on customers and customer_id on orders and invoices. Each rule uses the name that field has on those tables.
A table that is not named in any rule cannot be queried. A row that matches none of its rule's conditions is not returned.
Limits: 20 rules, 40 tables per rule, 20 conditions per rule, and 64 values per field. A table name may include its schema, for example shop.orders. Values are text or numbers; text is 1 to 200 characters. null or { "rules": [] } removes the restriction.
{
"rules": [
{
"tables": ["customers"],
"any_of": [{ "id": 42 }]
},
{
"tables": ["orders", "invoices"],
"any_of": [
{ "customer_id": 42 },
{ "team_id": [7, 8] }
]
}
]
}4. How to build the call
- Create at least one route (POST /routes) and copy its route_id.
- Pick a
slugunique in your account. - POST to
https://claix.dev/agentswith every field. - Save
agent_idand useretrieve_urlto ask questions.
5. Examples
Right panel: cURL, JavaScript, Node.js, Python, PHP, and n8n.
6. Successful response
201 Created
{
"success": true,
"agent": {
"agent_id": "9d8e7f6a-5b4c-3d2e-1f0a-9b8c7d6e5f4a",
"name": "Asistente de agenda",
"slug": "agenda",
"description": "Responde preguntas sobre citas y pacientes de la clínica.",
"status": "active",
"prompt": "Eres el asistente de la clínica. Solo usas las rutas asignadas. No inventes datos.",
"routes": ["7c2f9a1e-4b8d-4e6a-9f21-0a1b2c3d4e5f"],
"response_mode": "razonada",
"call_limit_period": "month",
"call_limit": 100,
"call_limit_reached": false,
"scope": {
"rules": [
{
"tables": ["customers"],
"any_of": [{ "id": 42 }]
},
{
"tables": ["orders", "invoices"],
"any_of": [
{ "customer_id": 42 },
{ "team_id": [7, 8] }
]
}
]
},
"retrieve_url": "https://claix.dev/retrieve/agenda",
"created_at": "2026-10-19T18:00:00.000Z"
}
}7. Errors
| HTTP | When |
|---|---|
| 401 | Invalid API key or inactive account. |
| 400 | Missing field, invalid query limit, invalid multi-tenant configuration, invalid or duplicate slug, or a route is not yours. |
| 405 | Method other than POST. |
| 500 | Internal error. |
{
"error": "Descripción legible del problema.",
"detalle": "Información técnica adicional (solo presente en algunos casos).",
"log_id": "7c2e1a90-4b3d-4f8a-9e21-6d5c8b0a1f34"
}