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

# Start chat

> Open a text chat with an agent. The agent speaks first.

Step 2 of [Chat with an agent](https://api.scalysis.com/guides/chat-with-an-agent.md). Opens a text chat. The agent replies exactly as it would on a phone call, so you can test it without dialing anyone.

No phone call is made. Your wallet must have balance.

## Path

**id** `number` *required*

Agent ID.

## Body

**variables** `object` *required*

A value for every variable from [Prepare chat](https://api.scalysis.com/api-reference/agent-chat/prepare.md). Send `{}` if the agent has none.

```bash cURL theme={null}
curl -X POST https://app.scalysis.com/api/v1/agent-scripts/2207/chat/sessions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "variables": {
      "agent_name": "Priya",
      "brand_name": "Demo Store",
      "customer_name": "Rahul"
    }
  }'
```

```json 200 theme={null}
{
  "success": true,
  "session": {
    "session_id": 1061566,
    "revision": 2,
    "is_completed": false,
    "messages": [
      { "role": "assistant", "content": "Hello, kya meri baat Rahul se ho rahi hai?" }
    ]
  }
}
```

```json 400 theme={null}
{
  "success": false,
  "error": "Fill all required variables before starting chat.",
  "missing_variables": ["brand_name"]
}
```

## Response

**session.session\_id** `number`

Save this. You need it to send messages.

**session.revision** `number`

Send it with your next message.

**session.messages** `array`

The chat so far. `assistant` is the agent, `user` is the customer.

## Errors

| Status | Meaning |
| - | - |
| `400` | Variables missing. `missing_variables` lists them. Or the agent isn't ready: save it in the dashboard. |
| `402` | Wallet is empty. Recharge first. |
| `404` | No agent with this ID on your account. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.