# Inbox API

> Inbox in the Broker & Agent API: list conversations; read one conversation.

Base URL: `https://workspace.brokerandagent.com/api/public/v1`. Every call needs an [API key or OAuth token](https://brokerandagent.com/developers/api/authentication).

- [List conversations](#list-conversations): `GET /inbox/threads`
- [Read one conversation](#read-one-conversation): `GET /inbox/messages`

## List conversations

`GET /inbox/threads`

One per person or unsaved number, whatever the channel, newest first, with the credential's person's own unread count. Pinned threads come on the first page. Reading marks nothing read.

Scope: `crm.read`

**Parameters**

| Name | In | Type | |
|---|---|---|---|
| `limit` | query | integer | How many to answer with, 1 to 200. Default `50`. |
| `cursor` | query | string or null | The `nextCursor` of the page before; absent for the first page. Cut to 200 characters. |

```bash
curl https://workspace.brokerandagent.com/api/public/v1/inbox/threads \
  -H "Authorization: Bearer bak_YOUR_KEY"
```

**Responses**

| Status | | Returns |
|---|---|---|
| `200` | A page of conversations. | { `threads`: array of [Thread](https://brokerandagent.com/developers/api/reference/objects#thread), `nextCursor`: string or null } |
| `401` | No credential, or one that's unknown, expired or revoked (unauthorized); or the workspace is suspended (workspace_suspended). |  |
| `403` | The credential lacks the scope (insufficient_scope, naming it in `scope`), the record isn't the person's to change (forbidden), the connection wasn't granted that workspace (workspace_not_granted), or an assistant-only token called outside the assistant's tools (wrong_audience). |  |
| `429` | Too many requests for this credential; wait for Retry-After (rate_limited). |  |

## Read one conversation

`GET /inbox/messages`

Pass `contactId` for a contact's texts, calls, voicemail and email, or `phone` for an unsaved number's. Newest first. Sending stays in the app.

Scope: `crm.read`

**Parameters**

| Name | In | Type | |
|---|---|---|---|
| `contactId` | query | string or null | The contact's thread: texts, calls, voicemail and email. Cut to 64 characters. |
| `phone` | query | string or null | An unsaved number's thread: texts, calls and voicemail. Cut to 40 characters. |
| `limit` | query | integer | How many to answer with, 1 to 200. Default `50`. |

```bash
curl https://workspace.brokerandagent.com/api/public/v1/inbox/messages \
  -H "Authorization: Bearer bak_YOUR_KEY"
```

**Responses**

| Status | | Returns |
|---|---|---|
| `200` | Messages. | { `messages`: array of [Message](https://brokerandagent.com/developers/api/reference/objects#message) } |
| `401` | No credential, or one that's unknown, expired or revoked (unauthorized); or the workspace is suspended (workspace_suspended). |  |
| `403` | The credential lacks the scope (insufficient_scope, naming it in `scope`), the record isn't the person's to change (forbidden), the connection wasn't granted that workspace (workspace_not_granted), or an assistant-only token called outside the assistant's tools (wrong_audience). |  |
| `404` | No such record, or one the credential's person can't see (not_found). |  |
| `422` | A field is the wrong kind or breaks a rule, named in the message (validation); or the Idempotency-Key was used for a different request (idempotency_key_reused). |  |
| `429` | Too many requests for this credential; wait for Retry-After (rate_limited). |  |

---

Source: https://brokerandagent.com/developers/api/reference/inbox
