Skip to content

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.

Authorization

Requests use the apiKeyAuth scheme. Place your key in the x-api-key header, in the form x-api-key <token>. The header travels in the request header, not the query string or body. A missing or unrecognized key is rejected before the endpoint logic runs.

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.
Label object field map
FieldTypeMeaning
idstring (UUID)label ID
namestringlable name
colorstringlabel color (hex code)
userCountnumbera number of users with this label

Field names and meanings are taken from the documented response schema.

Error status reference
StatusBody shapeLikely cause
400status: error, messageA validation problem on the request (the documented example message references a required field)
403message: ForbiddenMissing or unrecognized API key
404message: Not FoundAPI key not authorized for this resource, or unknown path
500status: error, messageServer-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

FieldTypeRequiredDescriptionConstraints
responseobject
response.statusstringNoAllowed values: "ok" | "error"
response.dataarray<Labels>No
response.data[]object
response.data[].idstringNolabel IDFormat: UUID
response.data[].namestringNolable name
response.data[].colorstringNolabel color (hex code)
response.data[].userCountnumberNoa number of users with this label

response

FieldTypeRequiredDescriptionConstraints
responseobjectStandard error body returned by all validated endpoints.
response.statusstringYesAllowed values: "error"
response.messagestringYesHuman-readable description of what went wrong.

response

FieldTypeRequiredDescriptionConstraints
responseGatewayErrorResponse | ErrorResponse
response[variant1]objectError body returned when the request is rejected before reaching the endpoint (missing API key, unknown path).
response[variant1].messagestringYes
response[variant2]objectStandard error body returned by all validated endpoints.
response[variant2].statusstringYesAllowed values: "error"
response[variant2].messagestringYesHuman-readable description of what went wrong.

response

FieldTypeRequiredDescriptionConstraints
responseobjectError body returned when the request is rejected before reaching the endpoint (missing API key, unknown path).
response.messagestringYes

response

FieldTypeRequiredDescriptionConstraints
responseobjectStandard error body returned by all validated endpoints.
response.statusstringYesAllowed values: "error"
response.messagestringYesHuman-readable description of what went wrong.