> ## 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 de IA

## Descricao

Este endpoint permite criar um novo agente de IA associado a sua conta, informando o nome do agente e o dispositivo que o hospeda.

### Parametros

<ParamField body="authkey" type="string" required>
  Chave de autenticacao da conta.
</ParamField>

<ParamField body="device" type="string" required>
  Dispositivo que ira hospedar o agente (ex: "servidor").
</ParamField>

<ParamField body="agent_name" type="string" required>
  Nome do agente que sera criado.
</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": "servidor",
      "agent_name": "AGENTE 2"
    }'
  ```

  ```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: 'servidor',
      agent_name: 'AGENTE 2'
    })
  });
  ```

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

  response = requests.post(
      'https://chatbot.menuia.com/api/v2/ia',
      json={
          'authkey': 'SUA_AUTHKEY_AQUI',
          'device': 'servidor',
          'agent_name': 'AGENTE 2'
      }
  )
  ```

  ```php PHP theme={null}
  $response = Http::post('https://chatbot.menuia.com/api/v2/ia', [
      'authkey' => 'SUA_AUTHKEY_AQUI',
      'device' => 'servidor',
      'agent_name' => 'AGENTE 2'
  ]);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Sucesso theme={null}
  {
    "status": 200,
    "message": "Agente criado com sucesso.",
    "agent_id": "ag_123456789"
  }
  ```

  ```json 401 - Erro de autenticacao theme={null}
  {
    "status": 401,
    "message": "Authkey invalida ou expirada."
  }
  ```

  ```json 400 - Erro de validacao theme={null}
  {
    "status": 400,
    "message": "validation.required"
  }
  ```
</ResponseExample>
