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

# Create WhatsApp AI Agent

> Create WhatsApp AI assistants for messaging automation and customer ordering workflows.

### Authorizations

<ParamField header="Authorization" type="string" required>
  Enter your ContactSwing JWT Bearer token.
</ParamField>

### Request Body

<ParamField body="name" type="string" required>
  Assistant display name. Example: `"My WhatsApp AI Agent"`
</ParamField>

<ParamField body="type" type="string" required>
  Assistant type: `"WHATSAPP"`
</ParamField>

<ParamField body="model" type="string" required>
  LLM model: `"cw-llm-1"`
</ParamField>

<ParamField body="api_keys" type="string[]">
  API key configuration `[]`
</ParamField>

<ParamField body="instructions" type="string" required>
  Detailed agent instructions and restaurant ordering guidelines
</ParamField>

<ParamField body="prompts" type="object">
  Agent prompts with `agent` and `goal` fields

  <ParamField body="agent" type="string" />

  <ParamField body="goal" type="string" />
</ParamField>

<ParamField body="phone_number" type="string" required>
  WhatsApp number ID. Example: `"650175178190170"`
</ParamField>

<ParamField body="kb_id" type="string">
  Knowledge base ID
</ParamField>

### WhatsApp Settings

<ParamField body="action_ids" type="string[]">
  Linked action IDs `[]`
</ParamField>

<ParamField body="additional_settings" type="object">
  Idle timeout in hours. Example: `24`

  <ParamField body="idle_time" type="integer">
    Idle timeout in hours. Example: `24`
  </ParamField>

  <ParamField body="max_messages" type="integer">
    Maximum messages per conversation. Example: `10`
  </ParamField>
</ParamField>

<ParamField body="incoming_call_greeting" type="string">
  WhatsApp greeting message
</ParamField>

### Response

**201 Created** - WhatsApp assistant created successfully

<ResponseField name="ctx_id" type="string">Request context ID</ResponseField>

<ResponseField name="data" type="object">
  <ResponseField name="assistant_id" type="string">New assistant ID</ResponseField>
  <ResponseField name="name" type="string">Assistant name</ResponseField>
</ResponseField>

**400 Bad Request** - Invalid WhatsApp configuration

**401 Unauthorized** - Invalid token
