# API reference: Chat

[Guide index](../../v1.md) · [API reference](../api-reference.md) · [Developer API](../api.md)

Sending your users' messages and reading their threads. Not limited by folder.

## `POST /v1/messages`

Body (application/json): `SubmitMessageRequest`

Answers 202 with `SubmitMessageResponse`.

## `GET /v1/threads`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `userId` | query | string | yes |  |
| `page` | query | integer (int32) |  |  |
| `size` | query | integer (int32) |  |  |

Answers 200 with list of ApiThreadResponse.

## `GET /v1/threads/{threadId}/files/{fileId}`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `threadId` | path | string (uuid) | yes |  |
| `fileId` | path | string (uuid) | yes |  |

Answers 200.

## `GET /v1/threads/{threadId}/messages`

| Parameter | In | Type | Required | Notes |
|---|---|---|---|---|
| `threadId` | path | string (uuid) | yes |  |
| `afterSeq` | query | integer (int64) |  |  |
| `limit` | query | integer (int32) |  |  |

Answers 200 with `ApiMessagePage`.

## Types

**SubmitMessageRequest**

| Field | Type | Required | Notes |
|---|---|---|---|
| `userId` | string | yes | at most 200 characters |
| `threadId` | string (uuid) |  |  |
| `text` | string | yes | at most 20000 characters |
| `longRunning` | boolean |  |  |

**SubmitMessageResponse**

| Field | Type | Required | Notes |
|---|---|---|---|
| `messageId` | string (uuid) | yes |  |
| `threadId` | string (uuid) | yes |  |
| `receivedAt` | string (date-time) | yes |  |

**ApiThreadResponse**

| Field | Type | Required | Notes |
|---|---|---|---|
| `threadId` | string (uuid) | yes |  |
| `status` | string | yes |  |
| `lastActivityAt` | string (date-time) | yes |  |
| `createdAt` | string (date-time) | yes |  |

**ApiMessagePage**

| Field | Type | Required | Notes |
|---|---|---|---|
| `messages` | list of ApiMessageResponse | yes |  |
| `nextAfterSeq` | integer (int64) |  |  |

**ApiMessageResponse**

| Field | Type | Required | Notes |
|---|---|---|---|
| `chatId` | string (uuid) | yes |  |
| `seq` | integer (int64) | yes |  |
| `from` | string | yes |  |
| `text` | string | yes |  |
| `time` | string (date-time) | yes |  |
| `files` | list of SharedFileLink |  |  |
