import { createClient } from "@mailsai/sdk";
const client = createClient(); // reads MAILS_API_KEY
const result = await client.labels.get(
"lbl_01JZX8K3M9Q4P7VN2YB6RTDC0E",
);
console.log(result);from mailsai import create_client
client = create_client() # reads MAILS_API_KEY
result = client.get_label(
"lbl_01JZX8K3M9Q4P7VN2YB6RTDC0E",
)
print(result)curl 'https://api.mails.ai/v1/labels/lbl_01JZX8K3M9Q4P7VN2YB6RTDC0E' \
-H "Authorization: Bearer $MAILS_API_KEY"mails labels get lbl_01JABC{
"name": "mails_labels_get",
"arguments": {
"label_id": "lbl_01JZX8K3M9Q4P7VN2YB6RTDC0E"
}
}{
"id": "lbl_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"name": "<name>",
"color": "gray",
"created_at": "2026-10-04T12:00:00.000Z",
"updated_at": "2026-10-04T12:00:00.000Z"
}200 The label.
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).
404 Resource not found in this workspace, or the agent
a send names is archived (agent_archived).
500 Internal server error.Retrieve a label
import { createClient } from "@mailsai/sdk";
const client = createClient(); // reads MAILS_API_KEY
const result = await client.labels.get(
"lbl_01JZX8K3M9Q4P7VN2YB6RTDC0E",
);
console.log(result);from mailsai import create_client
client = create_client() # reads MAILS_API_KEY
result = client.get_label(
"lbl_01JZX8K3M9Q4P7VN2YB6RTDC0E",
)
print(result)curl 'https://api.mails.ai/v1/labels/lbl_01JZX8K3M9Q4P7VN2YB6RTDC0E' \
-H "Authorization: Bearer $MAILS_API_KEY"mails labels get lbl_01JABC{
"name": "mails_labels_get",
"arguments": {
"label_id": "lbl_01JZX8K3M9Q4P7VN2YB6RTDC0E"
}
}{
"id": "lbl_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"name": "<name>",
"color": "gray",
"created_at": "2026-10-04T12:00:00.000Z",
"updated_at": "2026-10-04T12:00:00.000Z"
}200 The label.
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).
404 Resource not found in this workspace, or the agent
a send names is archived (agent_archived).
500 Internal server error.Path Parameters
idstringrequired
Label id (lbl_…).
Response
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.
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.
Was this page helpful?