> ## 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.

# Send message

> Reply as the customer and get the agent's answer.

Step 3 of [Chat with an agent](https://api.scalysis.com/guides/chat-with-an-agent.md). Send one customer message. The response has the full chat, with the agent's reply at the end.

## Path

**id** `number` *required*

Agent ID.

**sessionId** `number` *required*

`session_id` from [Start chat](https://api.scalysis.com/api-reference/agent-chat/start.md).

## Body

**text** `string` *required*

What the customer says.

**revision** `number`

`revision` from the last response. If it is out of date, Scalysis uses the latest one for you.

```bash cURL theme={null}
curl -X POST https://app.scalysis.com/api/v1/agent-scripts/2207/chat/sessions/1061566/messages \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "text": "Haan bol raha hoon", "revision": 2 }'
```

```json 200 theme={null}
{
  "success": true,
  "session": {
    "session_id": 1061566,
    "revision": 4,
    "is_completed": false,
    "messages": [
      { "role": "assistant", "content": "Hello, kya meri baat Rahul se ho rahi hai?" },
      { "role": "user", "content": "Haan bol raha hoon" },
      { "role": "assistant", "content": "Main Demo Store se Priya bol rahi hoon. Aapka order confirm karne ke liye call kiya hai." }
    ]
  }
}
```

```json 400 theme={null}
{ "success": false, "error": "Message is required" }
```

## Response

**session.messages** `array`

The whole chat. The last `assistant` message is the agent's reply.

**session.revision** `number`

Send this with your next message.

**session.is\_completed** `boolean`

`true` when the agent has ended the chat. Start a new one to test again.

## Errors

| Status | Meaning |
| - | - |
| `400` | `text` is empty. |
| `402` | Wallet is empty. |
| `404` | No agent with this ID on your account. |
| `500` | Wrong `session_id`, or a temporary problem. Check the ID, then retry. |


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