import { createClient } from "@mailsai/sdk";
const client = createClient(); // reads MAILS_API_KEY
const result = await client.labels.list();
console.log(result);from mailsai import create_client
client = create_client() # reads MAILS_API_KEY
result = client.list_labels()
print(result)curl 'https://api.mails.ai/v1/labels' \
-H "Authorization: Bearer $MAILS_API_KEY"mails labels list{ "name": "mails_labels_list", "arguments": {} }{
"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>"
}200 The workspace's labels.
401 Missing or invalid API key.
403 The API key lacks the required scope
(insufficient_scope), or the token belongs to an
app connected by sign-in and this operation is
closed to connected apps
(connected_app_not_allowed).
500 Internal server error.List labels
Every label in the workspace (at most 200), by name.
import { createClient } from "@mailsai/sdk";
const client = createClient(); // reads MAILS_API_KEY
const result = await client.labels.list();
console.log(result);from mailsai import create_client
client = create_client() # reads MAILS_API_KEY
result = client.list_labels()
print(result)curl 'https://api.mails.ai/v1/labels' \
-H "Authorization: Bearer $MAILS_API_KEY"mails labels list{ "name": "mails_labels_list", "arguments": {} }{
"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>"
}200 The workspace's labels.
401 Missing or invalid API key.
403 The API key lacks the required scope
(insufficient_scope), or the token belongs to an
app connected by sign-in and this operation is
closed to connected apps
(connected_app_not_allowed).
500 Internal server error.Was this page helpful?