Stats

✨ Get label distribution counts

Changed on
<Card href="https://humansignal.com/goenterprise"> <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/> <p style="margin-top: 10px; font-size: 14px;"> This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise) </p> </Card> 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).
get/api/projects/{id}/stats/label-distribution/counts

Request

  • Base URL
    http://localhost:8000
  • URL
    http://localhost:8000/api/projects/{id}/stats/label-distribution/counts
  • Auth
    API key in header Authorization

Path parameters

idinteger required

Query parameters

choice_keysstring

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

filtersstring

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.

limitinteger

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.

offsetinteger

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 nullable required

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.

Changes

    • warning

      for the query request parameter limit, the min was set to 1.00

    • warning

      for the query request parameter offset, the min was set to 0.00

    • info

      for the query request parameter filters, the type was generalized from object to string

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the new optional query request parameter filters