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

# Send Chat Message

> Send a website visitor's chat message to an agent

Called from the browser with a publishable key. The agent answers with the same setup that answers its text messages: its prompt, tools and model. Read the reply with [List Chat Messages](https://docs.telzino.com/api-reference/chat/list.md). The [Chat SDK](https://docs.telzino.com/sdk/chat.md) calls both endpoints for you.

The request `Origin` must be one of the publishable key's allowed origins, exactly as for [Voice Sessions](https://docs.telzino.com/api-reference/voice-sessions.md). Responses to an allowed origin carry CORS headers.

**Authorization** `string` *required*

`Bearer pk_live_...`

**agent\_id** `string (UUID)` *required*

The agent to chat with

**visitor\_id** `string` *required*

A random id you keep per visitor, 8 to 64 letters, digits, `_` or `-`. The same id continues the same conversation. The SDK stores one in `localStorage`.

**text** `string` *required*

The message, 1 to 4000 characters

**client\_message\_id** `string`

Up to 64 letters, digits, `_` or `-`. Sending the same id again is a no-op (`duplicate: true`), so a retried request never posts the message twice.

```bash cURL theme={null}
curl -X POST https://api.telzino.com/v1/chat/messages \
  -H "Authorization: Bearer pk_live_..." \
  -H "Origin: https://example.com" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "3f1c2a4e-8b7d-4c3a-9e2f-1a2b3c4d5e6f",
    "visitor_id": "v_9b1c5f3e2d1a0b9c",
    "text": "Do you open on Sunday?",
    "client_message_id": "c_01"
  }'
```

```json 202 theme={null}
{ "id": "6d0c8b8e-2f2a-4a8e-9b1c-5f3e2d1a0b9c", "duplicate": false }
```

```json 403 theme={null}
{ "error": "chat_disabled", "error_description": "Chat is turned off for this agent" }
```

## Errors

| Status | `error` | Meaning |
| - | - | - |
| 400 | `invalid_request` | The body failed validation. |
| 401 | `invalid_key` | Unknown or revoked publishable key. |
| 403 | `origin_not_allowed` | The `Origin` is not on the key. |
| 403 | `embed_disabled` | The SDK is turned off for the account. |
| 403 | `chat_disabled` | Chat is turned off for this agent. |
| 404 | `agent_not_found` | No such agent, outside the key's scope or allowlist, or not live. |
| 429 | `rate_limited` | 60 messages per minute per key, or 10 per minute per key and IP. |
| 503 | `temporarily_unavailable` | Retry shortly with the same `client_message_id`. |


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