> ## Documentation Index
> Fetch the complete documentation index at: https://opendata.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# List label values

> Return the sorted list of known values for a given label name.
Optionally filtered by series selectors and/or a time range.

For example, querying `/api/v1/label/job/values` returns all
distinct values of the `job` label across all series.

When `match[]` selectors are provided, only values from series
matching those selectors are returned. When `start` and/or `end` are
provided, only series with samples in that time range are considered.




## OpenAPI

````yaml /openapi/timeseries.yaml get /api/v1/label/{name}/values
openapi: 3.1.0
info:
  title: OpenData Timeseries API
  version: 1.0.0
  description: |
    Prometheus-compatible HTTP API for the OpenData Timeseries service.

    Query endpoints accept both GET (query parameters) and POST
    (application/x-www-form-urlencoded body) with identical parameters.
    This spec documents the GET form; POST is always available as an
    alternative for large queries that may exceed URL character limits.

    ## Timestamp formats

    All timestamp parameters accept either **RFC 3339** format
    (e.g. `2024-01-20T00:00:00Z`) or **Unix seconds** as a float
    (e.g. `1705708800` or `1705708800.123`). Timestamps in responses are
    always Unix seconds.

    ## Duration format

    Duration parameters use PromQL duration syntax: an integer followed by a
    unit suffix. Supported units are `ms` (milliseconds), `s` (seconds),
    `m` (minutes), `h` (hours), `d` (days), `w` (weeks), and `y` (years).
    Examples: `30s`, `5m`, `1h30m`.

    ## Sample values

    Sample values are always transferred as JSON strings (not numbers) to
    allow special values such as `"NaN"`, `"+Inf"`, and `"-Inf"`.

    ## Response envelope

    Every JSON response follows a common envelope:
    ```json
    {
      "status": "success" | "error",
      "data": <payload>,
      "errorType": "<string>",
      "error": "<string>",
      "warnings": ["<string>"]
    }
    ```
    The `error` and `errorType` fields are only present when `status` is
    `"error"`. The `warnings` array may be present on successful responses
    when the query engine has non-fatal issues to report (e.g. partial
    results due to unavailable shards).
servers:
  - url: http://localhost:9090
    description: Local development server
security: []
paths:
  /api/v1/label/{name}/values:
    get:
      summary: List label values
      description: |
        Return the sorted list of known values for a given label name.
        Optionally filtered by series selectors and/or a time range.

        For example, querying `/api/v1/label/job/values` returns all
        distinct values of the `job` label across all series.

        When `match[]` selectors are provided, only values from series
        matching those selectors are returned. When `start` and/or `end` are
        provided, only series with samples in that time range are considered.
      operationId: listLabelValues
      parameters:
        - name: name
          in: path
          required: true
          description: |
            The label name to retrieve values for. Common examples include
            `job`, `instance`, or `__name__` (which returns all metric names).
          schema:
            type: string
          example: job
        - name: match[]
          in: query
          required: false
          description: |
            Optional series selectors to filter which label values are
            returned. When provided, only values of the named label that
            appear on series matching at least one of these selectors are
            included. Multiple selectors are combined with logical OR.
          schema:
            type: array
            items:
              type: string
          style: form
          explode: true
        - name: start
          in: query
          required: false
          description: |
            Start timestamp to limit the time range considered. Only values
            from series with samples within `[start, end]` are returned.
            RFC 3339 or Unix seconds.
          schema:
            type: string
        - name: end
          in: query
          required: false
          description: |
            End timestamp to limit the time range considered. RFC 3339 or
            Unix seconds.
          schema:
            type: string
        - name: limit
          in: query
          required: false
          description: |
            Maximum number of label values to return. A value of `0` disables
            the limit.
          schema:
            type: integer
            minimum: 0
      responses:
        '200':
          description: |
            Sorted list of distinct values for the given label name as
            strings. Returns an empty array if no series have the label.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LabelValuesResponse'
              example:
                status: success
                data:
                  - node
                  - prometheus
        '400':
          description: |
            Bad request. The label name is invalid, or a `match[]` selector
            is malformed. The `errorType` will be `bad_data`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error. The `errorType` will be `internal`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: |
            Service unavailable. The `errorType` will be `unavailable`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    LabelValuesResponse:
      type: object
      description: |
        Response for the label values endpoint
        (`/api/v1/label/{name}/values`). On success, `data` contains a
        sorted array of distinct values for the requested label.
      properties:
        status:
          type: string
          enum:
            - success
            - error
        data:
          type: array
          items:
            type: string
          description: |
            Alphabetically sorted list of distinct values for the given
            label. Returns an empty array if no series carry the label.
        error:
          type: string
          description: Human-readable error message (present when status is `error`).
        errorType:
          type: string
          description: Error category (present when status is `error`).
      required:
        - status
    ErrorResponse:
      type: object
      description: |
        Prometheus-compatible error response. Returned for all non-2xx
        responses. The `errorType` indicates the category:

        - `bad_data` (HTTP 400/422): The request was malformed or the
          expression could not be executed.
        - `internal` (HTTP 500): An unexpected server-side error occurred.
        - `unavailable` (HTTP 503): The server is temporarily unable to
          handle the request due to backpressure or a query timeout.
      properties:
        status:
          type: string
          example: error
        errorType:
          type: string
          description: |
            Error category. Maps to HTTP status codes:
            - `bad_data` → 400 or 422
            - `internal` → 500
            - `unavailable` → 503
          enum:
            - bad_data
            - internal
            - unavailable
        error:
          type: string
          description: Human-readable error message describing what went wrong.
      required:
        - status
        - errorType
        - error

````