Claix Retrieve

Agent Actions

Create, edit, and pause or resume Retrieve agents via API.

Agents · Create

Create an agent via API

Endpoint

POSThttps://claix.dev/agents

Creates 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.

FieldTypeRequiredDescription
namestringYesVisible agent name (max 80).
slugstringYesURL id for /retrieve/{slug}. 3–20 chars: a-z and 0-9.
descriptionstringYesWhat the agent is for (max 500).
promptstringYesBusiness instructions (max 12,000).
routesuuid[]Yesroute_id list from your account. At least one.
response_modestringYes"bruto" (SQL rows) or "razonada" (typed answer).
call_limit_periodstringNoday, week, month, or unlimited. Defaults to unlimited. The week runs Monday through Sunday (UTC). calls_limit_period is also accepted.
call_limitintegerWhen the period is day, week, or monthSuccessful 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.
scopeobject | nullNoMulti-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

  1. Create at least one route (POST /routes) and copy its route_id.
  2. Pick a slug unique in your account.
  3. POST to https://claix.dev/agents with every field.
  4. Save agent_id and use retrieve_url to 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

HTTPWhen
401Invalid API key or inactive account.
400Missing field, invalid query limit, invalid multi-tenant configuration, invalid or duplicate slug, or a route is not yours.
405Method other than POST.
500Internal 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"
}

Request examples

curl -X POST "https://claix.dev/agents" \
  -H "x-api-key: <TU_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{  "name": "Asistente de agenda",  "slug": "agenda",  "description": "Responde preguntas sobre citas y pacientes de la clínica.",  "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,  "scope": {    "rules": [      {        "tables": ["customers"],        "any_of": [{ "id": 42 }]      },      {        "tables": ["orders", "invoices"],        "any_of": [          { "customer_id": 42 },          { "team_id": [7, 8] }        ]      }    ]  }}'