---
title: "Reply in a chat"
method: POST
path: "/chats/{chat}/messages"
tags: ["Chats"]
---

# Reply in a chat

`POST /chats/{chat}/messages`

## Request

- Base URL: `https://vocenya.com/api/public/v1`
- URL: `https://vocenya.com/api/public/v1/chats/{chat}/messages`
- Auth: HTTP bearer

Reply in a live chat as your team. The visitor sees it at once, from "Team". A reply to a chat the AI
is answering takes it over. Limited to 30 replies a minute per key, on top of the overall limit.

```bash
curl -X POST https://vocenya.com/api/public/v1/chats/205/messages \
  -H "Authorization: Bearer $VOCENYA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"body": "Thanks for waiting! We have an opening on Thursday at 3pm."}'
```

## Path parameters

- `chat` integer, required

## Request body

- StoreChatMessageRequest
  - `body` string, required: The reply, as plain text. The visitor sees it from "Team".

## Response `201`

The message that was sent.

- object
  - `data` ChatMessageResource, required
    - `id` integer, required
    - `livemode` boolean, required: `true` for live data, `false` for test data (created with a `vk_test_` key).
    - `chat_id` integer, required
    - `sender` string, required: Who wrote it: `visitor`, `ai`, `agent` (a GH Live agent), `owner` (the client's team or the API) or `system`.
    - `role` 'visitor' | 'ai' | 'team' | 'system', required: What the widget shows: `visitor`, `ai`, `team` or `system`.
    - `author` string, required
    - `body` string: The text. Not included for HIPAA-mode accounts.
    - `via_api` boolean, required: Whether it was sent with the public API.
    - `created_at` string, nullable, required

## Other responses

- `401`: The API key is missing, invalid, expired or revoked.
- `403`: Website live chat is not part of the plan (`live_chat_unavailable`).
- `404`: No record with that id belongs to your account.
- `409`: The chat has ended (`chat_closed`).
- `422`: A WhatsApp chat whose 24-hour reply window has closed (`whatsapp_window_closed`): follow up with an approved template from the inbox.
- `429`: Too many requests for this key. Wait for the `Retry-After` seconds.

---

[API](https://skmtc.dev/vocenya/apis/vocenya-api.md) · [All operations](https://skmtc.dev/vocenya/apis/vocenya-api/llms.txt) · [OpenAPI document](https://skmtc.dev/vocenya/apis/vocenya-api/revisions/946913941565?raw)
