List Labels with the REST API
The labels endpoint returns every active label in the workspace. Each entry carries a UUID, a display name, a hex color and a count of users assigned to that label. This page covers the request shape, the response fields and how to tell the different error responses apart.
Endpoint and method
Send a GET request to the labels path under the v1 REST API. The endpoint takes no path parameters and no documented query parameters. The base URL is supplied through the $API_BASE_URL configuration variable, so the full request target is $API_BASE_URL/v1/labels.
Request example
The cURL form below is the canonical request shape. Language variants for JavaScript, Python, Go, Java and C# follow the same path and header.
Response fields
A successful response has a status of ok and a data array. Each array item is a label object with four fields. The table below maps each field to its type and meaning.
Sample response
The example below shows one label object. A real response may contain many entries in the data array, one per active label.
Error responses
Errors arrive in two shapes. Gateway-level rejections (missing key, unknown path) return only a message field. Endpoint-level errors return a status of error plus a message. The table below separates the documented status codes by likely cause.
Before you call
Run through this short list to avoid the most common failures:
- Confirm the key is present in the x-api-key header, not the URL.
- Confirm the path ends in /v1/labels with no trailing segment.
- Confirm the key is authorized for the labels resource, not just for the account.
- Parse the data array rather than assuming a single object.
| Field | Type | Meaning |
|---|---|---|
| id | string (UUID) | label ID |
| name | string | lable name |
| color | string | label color (hex code) |
| userCount | number | a number of users with this label |
Field names and meanings are taken from the documented response schema.
| Status | Body shape | Likely cause |
|---|---|---|
| 400 | status: error, message | A validation problem on the request (the documented example message references a required field) |
| 403 | message: Forbidden | Missing or unrecognized API key |
| 404 | message: Not Found | API key not authorized for this resource, or unknown path |
| 500 | status: error, message | Server-side failure while listing labels |
Status codes and body shapes are from the documented responses; the 400 example message is illustrative.
Frequently asked questions
What does the labels endpoint return?
A list of all active labels. Each label carries its ID, name, color and the number of users assigned to it.
Where does the API key go?
In the x-api-key request header, written as x-api-key <token>. It is not a query parameter.
Why do I get 403 instead of 404?
A 403 with a Forbidden message means the API key is missing or unrecognized. A 404 with Not Found means the key is recognized but not authorized for this resource, or the path is wrong.
What does userCount measure?
It is the number of users who currently have that label applied.
Are there related list endpoints?
Yes. Departments and leave types have their own list endpoints under the same v1 API.
curl -X GET "$API_BASE_URL/v1/labels" \
-H "x-api-key: "{
"status": "ok",
"data": [
{
"id": "969f8429-7dc3-48a1-96b1-6049a99dda06",
"name": "Team B",
"color": "FF0000",
"userCount": 42
}
]
}{
"status": "error",
"message": "\"startDate\" is required"
}{
"message": "Forbidden"
}{
"message": "Not Found"
}{
"status": "error",
"message": "Failed to list users"
}response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | |||
| response.status | string | No | Allowed values: "ok" | "error" | |
| response.data | array<Labels> | No | ||
| response.data[] | object | |||
| response.data[].id | string | No | label ID | Format: UUID |
| response.data[].name | string | No | lable name | |
| response.data[].color | string | No | label color (hex code) | |
| response.data[].userCount | number | No | a number of users with this label |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Standard error body returned by all validated endpoints. | ||
| response.status | string | Yes | Allowed values: "error" | |
| response.message | string | Yes | Human-readable description of what went wrong. |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | GatewayErrorResponse | ErrorResponse | |||
| response[variant1] | object | Error body returned when the request is rejected before reaching the endpoint (missing API key, unknown path). | ||
| response[variant1].message | string | Yes | ||
| response[variant2] | object | Standard error body returned by all validated endpoints. | ||
| response[variant2].status | string | Yes | Allowed values: "error" | |
| response[variant2].message | string | Yes | Human-readable description of what went wrong. |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Error body returned when the request is rejected before reaching the endpoint (missing API key, unknown path). | ||
| response.message | string | Yes |
response
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
| response | object | Standard error body returned by all validated endpoints. | ||
| response.status | string | Yes | Allowed values: "error" | |
| response.message | string | Yes | Human-readable description of what went wrong. |