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

# Chat

> Send a message to an assistant and get its reply

## Overview

Sends one message to an assistant in a conversation and returns the reply once it is complete. To receive the reply as it is written, use [Chat (Streaming)](https://docs.personal.ai/composer_apis/chat-streaming.md).

The reply's `conversation_id` can differ from the one you sent, for example when your message continues something the assistant is [already arranging with you](https://docs.personal.ai/composer/assistant/handing-off-tasks.md#when-your-assistant-needs-more-from-you). Send follow-up messages to the returned `conversation_id`.

Operation name: `agent.chat`. Member keys can call it.

## Authorization

**x-api-key** `string` *required*

Your Composer API key

## Headers

**Content-Type** `string` *required*

Must be set to application/json

## Body

**agent\_slug** `string` *required*

The assistant to talk to.

```json Example theme={null}
"agent_slug": "my-assistant"
```

**conversation\_id** `string` *required*

The conversation, from Create Conversation.

```json Example theme={null}
"conversation_id": "9a2b7c1e-4d3f-4e8a-b6c5-1f0e2d3c4b5a"
```

**message** `string` *required*

Your message.

```json Example theme={null}
"message": "What's on tomorrow?"
```

**timezone** `string`

Your IANA time zone, for example `America/New_York`. Send it on every message so "today" and "tomorrow" mean your day.

```json Example theme={null}
"timezone": "America/New_York"
```

**channel** `string`

The surface the message comes from, such as `sms`. It shapes the reply (plain and short for a text, markdown on the web). Omit for a web chat.

**attachments** `array`

Files attached to this message: `[{ filename, excerpt }]`, where `excerpt` is the file's text (for example from [Ingest File](https://docs.personal.ai/composer_apis/endpoint/ingest-file.md) with `excerpt_chars`).

**as\_subject** `boolean`

Admin only. Set to true to speak as the person a conversation belongs to, when that person isn't you. Default false.

```json Example Request theme={null}
{
  "agent_slug": "my-assistant",
  "conversation_id": "9a2b7c1e-4d3f-4e8a-b6c5-1f0e2d3c4b5a",
  "message": "What's on tomorrow?",
  "timezone": "America/New_York"
}
```

***

## Response

**response** `string`

The assistant's reply.

**conversation\_id** `string`

The conversation the turn landed in. Use this for follow-ups.

**run\_id** `string`

The id of this turn.

**graphics** `array`

Pictures or charts drawn in this reply.

**places** `array`

Places found on the map in this reply.

**goal** `object`

Present when the message opened or continued something the assistant is arranging with you.

```json Example Success Response theme={null}
{
  "response": "Tomorrow you have the dentist at 9:30 and Emma's swimming at 4pm.",
  "conversation_id": "9a2b7c1e-4d3f-4e8a-b6c5-1f0e2d3c4b5a",
  "run_id": "3f8e2a1b-7c6d-4e5f-9a8b-0c1d2e3f4a5b",
  "graphics": [],
  "places": []
}
```

***

## Example cURL

```bash cURL theme={null}
curl --request POST 'https://composer.personal.ai/lab/api/v1/op/agent.chat' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <your-api-key>' \
--data '{"agent_slug": "my-assistant", "conversation_id": "9a2b7c1e-4d3f-4e8a-b6c5-1f0e2d3c4b5a", "message": "What'\''s on tomorrow?", "timezone": "America/New_York"}'
```

***

## Error Codes

| Code | Description |
| - | - |
| 400 | The body doesn't match the fields above, or the operation failed. The response body says why. |
| 401 | Missing or invalid API key |
| 403 | This key isn't allowed to call this operation |


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