Skip to main content
import { createClient } from "@mailsai/sdk";

const client = createClient(); // reads MAILS_API_KEY

const result = await client.labels.list();
console.log(result);
{
  "data": [
    {
      "id": "lbl_01JZX8K3M9Q4P7VN2YB6RTDC0E",
      "name": "<name>",
      "color": "gray",
      "created_at": "2026-10-04T12:00:00.000Z",
      "updated_at": "2026-10-04T12:00:00.000Z"
    }
  ],
  "has_more": false,
  "next_cursor": "<next_cursor>"
}

List labels

Every label in the workspace (at most 200), by name.
GET/v1/labelsscope · read
import { createClient } from "@mailsai/sdk";

const client = createClient(); // reads MAILS_API_KEY

const result = await client.labels.list();
console.log(result);
{
  "data": [
    {
      "id": "lbl_01JZX8K3M9Q4P7VN2YB6RTDC0E",
      "name": "<name>",
      "color": "gray",
      "created_at": "2026-10-04T12:00:00.000Z",
      "updated_at": "2026-10-04T12:00:00.000Z"
    }
  ],
  "has_more": false,
  "next_cursor": "<next_cursor>"
}

Response

dataobject[]

Every label in the workspace, sorted by name; a workspace has at most 200.

Show propertiesHide properties
idstring

Label id (lbl_…).

namestring

Unique in the workspace, ignoring case.

colorstring

The label's colour, one of 12 palette names: gray unless another was chosen.

One of: gray, red, orange, amber, yellow, green, teal, cyan, blue, indigo, purple, pink

created_atstring

When the label was created (UTC).

updated_atstring

When the label was last changed with PATCH, even by a request that left it as it was. Equal to created_at on a label never patched.

has_moreboolean

Always false: every label comes in one response.

next_cursorstring

Pass as cursor to fetch the next page. Absent on the last page.

Was this page helpful?