# Start a stateful conversation

> POST /chat/sessions. HeyRik API parameters and documented request and response examples.

Source: https://www.heyrik.com/docs/api-reference/chat/post-chat-sessions-start-a-stateful-conversation

POST https://server.heyrik.com/api/v1/chat/sessions

## Headers

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

## Parameters

- agent_id (string, required): The agent to talk to. `agency_id` also accepted.
- title (string): A label for the conversation.
- test (boolean): true runs the session for FREE (not charged, balance_credits comes back null) — for trying an agent out.

## Notes

Keep the returned id — every message goes to /chat/sessions/{id}/messages and the agent remembers the whole thread.

## Request example

```sh
curl -X POST https://server.heyrik.com/api/v1/chat/sessions \
  -H "Authorization: Bearer $HEYRIK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agent_id": "agc_9f2a1c30", "title": "Support chat" }'
```

## Response example

```json
{
  "data": {
    "id": "cht_c09b79cc",
    "agency_id": "agc_9f2a1c30",
    "channel": "api",
    "message_count": 0,
    "credits_used": 0,
    "created_at": "2026-07-31T10:17:49.946Z"
  }
}
```
