> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chatnorris.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Crear agente

> Crear un nuevo agente de IA en tu organización.

# Crear agente

Crea un nuevo agente de IA. El agente se crea en estado borrador (`is_published: false`).

<RequestExample>
  ```http theme={null}
  POST https://app.chatnorris.ai/api/v2/chatbots
  Authorization: Bearer <tu_api_key>
  Content-Type: application/json
  ```
</RequestExample>

**Scope requerido:** `chatbots:write`

***

## Cuerpo de la request

| Campo                        | Tipo    | Requerido | Descripción                               |
| ---------------------------- | ------- | --------- | ----------------------------------------- |
| `name`                       | string  | ✅         | Nombre del agente (1–100 caracteres)      |
| `system_prompt`              | string  | —         | Instrucciones del sistema para el agente  |
| `widget_config`              | object  | —         | Configuración visual del widget           |
| `widget_config.primaryColor` | string  | —         | Color primario del widget (hex)           |
| `widget_config.greeting`     | string  | —         | Mensaje de bienvenida                     |
| `widget_config.leadCapture`  | boolean | —         | Si el widget captura leads antes del chat |

### Ejemplo

```json theme={null}
{
  "name": "Soporte al cliente",
  "system_prompt": "Eres el asistente virtual de Acme Corp. Respondé en español, con tono amable y conciso.",
  "widget_config": {
    "primaryColor": "#00ed64",
    "greeting": "¡Hola! ¿En qué puedo ayudarte hoy?",
    "leadCapture": false
  }
}
```

***

## Respuesta `201 Created`

```json theme={null}
{
  "status": "success",
  "data": {
    "id": "bot_xyz789",
    "name": "Soporte al cliente",
    "description": null,
    "system_prompt": "Eres el asistente virtual de Acme Corp...",
    "model": "claude-sonnet-4-6",
    "temperature": 0.7,
    "max_tokens": 1000,
    "is_active": true,
    "is_published": false,
    "widget_config": {
      "primaryColor": "#00ed64",
      "greeting": "¡Hola! ¿En qué puedo ayudarte hoy?",
      "leadCapture": false
    },
    "created_at": "2026-06-30T18:00:00.000Z",
    "updated_at": "2026-06-30T18:00:00.000Z"
  }
}
```

***

## Errores comunes

| Code                 | Descripción                                       |
| -------------------- | ------------------------------------------------- |
| `INVALID_INPUT`      | Falta el campo `name` o supera los 100 caracteres |
| `PLAN_LIMIT_REACHED` | Se alcanzó el límite de agentes del plan          |
