# Discover labels

GET /v1/inboxes/{inbox_id}/labels

Source: https://cherami.to/docs/api/labels/list-labels



{/* Generated from apps/web/openapi. Edit the contract, not this file. */}

`GET /v1/inboxes/{inbox_id}/labels`

Requires a [Claim-issued API key](https://cherami.to/docs/api#authentication): `Authorization: Bearer YOUR_CREDENTIAL`.

`GET /v1/inboxes/{inbox_id}/labels` lists names currently used on undeleted received and sent copies in an owned, undeleted inbox.

Optional `prefix` restricts names by a literal, case-sensitive prefix, trimmed using label-name rules. Empty or omitted means all names; supply it at most once. `limit` is 1–100, default 20. Results are ordered by name using case-sensitive binary order, not locale-specific collation. Continue with `cursor` and the same inbox and prefix.

Counts describe messages, not conversations, and include all processing and sending states. A name disappears when no undeleted message uses it. There is no separate label registry or rename operation. Results and counts can change while you paginate.

## Parameters [#parameters]

| Parameter  | Location | Required | Type    | Meaning                                                                                                       |
| ---------- | -------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------- |
| `inbox_id` | path     | Yes      | string  | Owned Cherami resource ID returned by the API.                                                                |
| `limit`    | query    | No       | integer | Decimal integer without signs, whitespace or leading zeroes. `minimum`: `1` `maximum`: `100` `default`: `20`  |
| `cursor`   | query    | No       | string  | Opaque returned cursor. Keep resource URL, filters and ordering unchanged; stop when next\_cursor is null.    |
| `prefix`   | query    | No       | string  | Literal case-sensitive prefix, trimmed, at most 128 UTF-8 bytes. Empty means all labels. Supply at most once. |

## curl example [#curl-example]

Replace resource-ID placeholders with returned IDs. Supply `CHERAMI_API_KEY` through your private shell environment.

```sh
curl --silent --show-error --include --request GET \
  "https://cherami.to/v1/inboxes/INBOX_ID/labels" \
  --header "Authorization: Bearer $CHERAMI_API_KEY"
```

## Responses [#responses]

### HTTP 200 [#http-200]

Successful operation; inspect resource state and outcome fields.

* `X-Request-ID`: Support correlation ID, not an idempotency key.

Content type: `application/json`.

[LabelList](#schema-labellist)

```json
{
  "labels": [],
  "next_cursor": null
}
```

### HTTP 400 [#http-400]

`invalid_limit`: Use an integer from 1 to 100.

`invalid_cursor`: Use the cursor with its original resource and filters, or restart from the first page. Draft listings instead report invalid\_draft.

`invalid_labels`: Correct label names, changes, filter groups, or discovery prefix.

* `X-Request-ID`: Support correlation ID, not an idempotency key.

Content type: `application/json`.

[Error](#schema-error)

### HTTP 401 [#http-401]

`unauthorized`: Provide a valid bearer credential. Use [human-approved recovery](https://cherami.to/docs/guides/recovery) if access is lost.

* `X-Request-ID`: Support correlation ID, not an idempotency key.
* `WWW-Authenticate`: `"Bearer"`

Content type: `application/json`.

[Error](#schema-error)

### HTTP 404 [#http-404]

`not_found`: Resource is absent or inaccessible to this account. Reply targets must be in the sending inbox.

* `X-Request-ID`: Support correlation ID, not an idempotency key.

Content type: `application/json`.

[Error](#schema-error)

### HTTP 500 [#http-500]

`internal_error`: Operation failed; a write may already have happened. Follow the operation-specific recovery below.

* `X-Request-ID`: Support correlation ID, not an idempotency key.

Content type: `application/json`.

[Error](#schema-error)

## Schema: LabelList [#schema-labellist]

| Field         | Required | Type            | Meaning and constraints |
| ------------- | -------- | --------------- | ----------------------- |
| `labels`      | Yes      | array of object |                         |
| `next_cursor` | Yes      | string or null  |                         |

### `labels` fields [#labels-fields]

| Field            | Required | Type    | Meaning and constraints |
| ---------------- | -------- | ------- | ----------------------- |
| `name`           | Yes      | string  |                         |
| `received_count` | Yes      | integer | `minimum`: `0`          |
| `sent_count`     | Yes      | integer | `minimum`: `0`          |

## Schema: Error [#schema-error]

| Field   | Required | Type   | Meaning and constraints |
| ------- | -------- | ------ | ----------------------- |
| `error` | Yes      | object |                         |

### `error` fields [#error-fields]

| Field     | Required | Type   | Meaning and constraints                                                                       |
| --------- | -------- | ------ | --------------------------------------------------------------------------------------------- |
| `code`    | Yes      | string | Programmatic error code. Handle unrecognized codes by status and operation-specific recovery. |
| `message` | Yes      | string | Human-readable context, not a stable string to match.                                         |

[HTTP conventions, errors and pagination](https://cherami.to/docs/api/errors) · [Download OpenAPI 3.1](https://cherami.to/openapi.json)
