> ## 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 names

> Return the sorted list of all label names present in the database.
Optionally filtered by series selectors and/or a time range.

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

Also accepts POST with a `application/x-www-form-urlencoded` body
containing the same parameters.




## OpenAPI

````yaml /openapi/timeseries.yaml get /api/v1/labels
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/labels:
    get:
      summary: List label names
      description: |
        Return the sorted list of all label names present in the database.
        Optionally filtered by series selectors and/or a time range.

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

        Also accepts POST with a `application/x-www-form-urlencoded` body
        containing the same parameters.
      operationId: listLabels
      parameters:
        - name: match[]
          in: query
          required: false
          description: |
            Optional series selectors to filter which label names are
            returned. When provided, only label names 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 label
            names 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 names to return. A value of `0` disables
            the limit.
          schema:
            type: integer
            minimum: 0
      responses:
        '200':
          description: |
            Sorted list of label names as strings. Always includes built-in
            labels like `__name__` if any metric data exists.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LabelsResponse'
              example:
                status: success
                data:
                  - __name__
                  - instance
                  - job
        '400':
          description: |
            Bad request. A `match[]` selector is malformed or a parameter is
            invalid. 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:
    LabelsResponse:
      type: object
      description: |
        Response for the label names endpoint (`/api/v1/labels`). On success,
        `data` contains a sorted array of label name strings.
      properties:
        status:
          type: string
          enum:
            - success
            - error
        data:
          type: array
          items:
            type: string
          description: |
            Alphabetically sorted list of label names. Includes built-in
            labels like `__name__` if any metric data exists.
        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

````