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

# Criar Agente

## Descrição

Este endpoint permite criar um agente de IA.

### Parâmetros

<ParamField body="authkey" type="string" required>
  Chave de autenticação da conta.
</ParamField>

<ParamField body="device" type="string" required>
  APPKEY ou nome da chave do dispositivo.
</ParamField>

<ParamField body="agent_name" type="string" required>
  Nome do agente de IA.
</ParamField>

<ParamField body="webhook" type="string">
  URL do webhook para receber notificações.
</ParamField>

<ParamField body="voice" type="string">
  Configuração de voz do agente.
</ParamField>

<ParamField body="work_days" type="array">
  Dias de trabalho do agente.
</ParamField>

<ParamField body="system" type="string">
  Configuração do sistema/prompt do agente.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://chatbot.menuia.com/api/v2/ia \
    -H "Content-Type: application/json" \
    -d '{
      "authkey": "SUA_AUTHKEY_AQUI",
      "device": "SUA_APPKEY_AQUI",
      "agent_name": "Meu Agente de IA",
      "system": "Você é um assistente prestativo."
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://chatbot.menuia.com/api/v2/ia', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      authkey: 'SUA_AUTHKEY_AQUI',
      device: 'SUA_APPKEY_AQUI',
      agent_name: 'Meu Agente de IA',
      system: 'Você é um assistente prestativo.'
    })
  });
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://chatbot.menuia.com/api/v2/ia',
      json={
          'authkey': 'SUA_AUTHKEY_AQUI',
          'device': 'SUA_APPKEY_AQUI',
          'agent_name': 'Meu Agente de IA',
          'system': 'Você é um assistente prestativo.'
      }
  )
  ```

  ```php PHP theme={null}
  $response = Http::post('https://chatbot.menuia.com/api/v2/ia', [
      'authkey' => 'SUA_AUTHKEY_AQUI',
      'device' => 'SUA_APPKEY_AQUI',
      'agent_name' => 'Meu Agente de IA',
      'system' => 'Você é um assistente prestativo.'
  ]);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Sucesso theme={null}
  {
    "status": 200,
    "message": "Agente de IA criado com sucesso.",
    "data": {
      "id": 123,
      "agent_name": "Meu Agente de IA"
    }
  }
  ```

  ```json 401 - Erro de validação theme={null}
  {
    "status": 401,
    "message": "validation.required"
  }
  ```

  ```json 404 - Dispositivo não encontrado theme={null}
  {
    "status": 404,
    "message": "Nenhum dispositivo encontrado."
  }
  ```
</ResponseExample>
