Skip to navigation

✨ Get label distribution counts

Returns counts and percentages for requested label choices, from both annotations and predictions. Supports either pagination (limit, offset) or targeted fetches via explicit choice_keys. Omitting filters preserves the unfiltered cached-count behavior. When a non-empty filters plan is provided, filtered aggregation is aggregation-complete and non-paginated: the response includes all structure choice keys and next_offset is always null (limit/offset are ignored for filtered requests).

Authentication

AuthorizationToken

The token (or API key) must be passed as a request header. You can find your user token on the User Account page in Label Studio. Example:

curl https://label-studio-host/api/projects -H “Authorization: Token [your-token]”

Path parameters

idintegerRequired

Query parameters

choice_keysstringOptional

Explicit choice keys to fetch, joined by “PIPE” (for example: “label___SEP___pos___PIPE___quality___SEP___4”). When provided, pagination params are ignored.

filtersstringOptional

Optional JSON-encoded string containing a curated filter plan (not an exploded object). Pass one JSON string query value (for example json.dumps(Filters.create(...)) from label_studio_sdk.data_manager); do not pass a nested object or Fern will explode filters[...] keys. The plan uses normalized AND semantics (conjunction must be "and"), contains at most 20 items, does not permit nested child_filters, and treats an empty items list as unfiltered. Supported filter fields are filter:tasks:id, filter:tasks:inner_id, filter:tasks:data.*, filter:tasks:annotators, filter:tasks:ground_truth, filter:tasks:reviews_accepted, filter:tasks:reviews_rejected, filter:tasks:reviewed, filter:tasks:predictions_model_versions, filter:tasks:annotations_updated_at, and filter:tasks:predictions_updated_at. Each item requires filter, operator, type, and value. Annotator filters require one or more positive integer IDs. Model-version filters require 1-100 non-empty strings. Source updated-at filters require an inclusive, ordered, timezone-aware range object with string min and max timestamps.

limitintegerOptional>=1

Maximum number of choice keys to return for pagination. Ignored when choice_keys is provided. Also ignored for filtered requests (non-empty filters), which always return the full aggregation-complete choice set.

offsetintegerOptional>=0Defaults to 0

Zero-based offset into the structure choice_keys list. Used only when choice_keys is not provided. Ignored for filtered requests (non-empty filters).

Response

Label distribution counts
next_offsetinteger or null

Next offset for pagination when using limit/offset mode; null when there are no more results, when filtering by explicit choice_keys, or for filtered (aggregation-complete / non-paginated) responses.

resultslist of objects
totalsobject

Errors

400
Bad Request Error
409
Conflict Error