# Send a message, get the agent's reply

> POST /chat/sessions/{id}/messages. HeyRik API parameters and documented request and response examples.

Source: https://www.heyrik.com/docs/api-reference/chat/post-chat-sessions-id-messages-send-a-message-get-the-agent-s-reply

POST https://server.heyrik.com/api/v1/chat/sessions/{id}/messages

## Path parameters

- id (required): Replace {id} in the request URL with the value for this resource.

## Headers

Authorization: Bearer $HEYRIK_API_KEY (required). Keep your key on your server.

## Parameters

- message (string, required): The user's new message. The prior turns are loaded from the session — you only send the latest one.

## Notes

The session carries the memory, so a multi-turn chat is just repeated calls here. For token-by-token streaming, open a WebSocket to wss://server.heyrik.com/ws/chat/{session_id}?api_key=YOUR_KEY instead.

## Request example

```sh
curl -X POST https://server.heyrik.com/api/v1/chat/sessions/cht_c09b79cc/messages \
  -H "Authorization: Bearer $HEYRIK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "message": "Hi, what can you do?" }'
```

## Response example

```json
{
  "data": {
    "reply": "I can help you book an appointment, answer timings, and more. How can I help?",
    "message": { "id": "msg_f8511683", "role": "assistant", "session_id": "cht_c09b79cc" },
    "credits_charged": 1,
    "balance_credits": 4974,
    "session_id": "cht_c09b79cc"
  }
}
```
