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

# List aggregated metrics

For grouping, paging, and series limits, see [Querying metrics](https://docs.appsignal.com/api/v2/metrics.md#query-a-list).

```yaml POST /api/v2/metrics/list theme={null}
openapi: 3.1.0
info:
  title: AppSignal V2 API
  description: >-
    REST API for metrics, traces, logs, Kubernetes monitoring, and deployment
    tracking.
  license:
    name: ''
  version: 0.1.0
paths:
  /api/v2/metrics/list:
    post:
      tags:
        - Metrics
      summary: List aggregated metrics
      operationId: list
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ListQuery'
            example:
              site_id: abc123
              from: '2024-01-01T00:00:00Z'
              to: '2024-01-01T01:00:00Z'
              select:
                - id: cpu
                  name: cpu
                  field: GAUGE
                  tags:
                    hostname: '*'
              group_by:
                - Tag: hostname
        required: true
      responses:
        '200':
          description: One row per unique combination of group-by values.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/List'
        '400':
          description: >-
            Invalid query; the `error` slug identifies why. Pagination slugs:
            `pagination_requires_deterministic_grouping`,
            `pagination_unsupported_for_selector`,
            `pagination_invalid_per_page`, `pagination_key_limit_exceeded`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Missing or invalid authentication token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Route or resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: External query concurrency limit exceeded; retry shortly.
          headers:
            Retry-After:
              schema:
                type: integer
              description: Seconds to wait before retrying.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Unhandled server-side failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearer_auth: []
        - token_query: []
components:
  schemas:
    Aggregation:
      type: string
      description: >-
        The aggregation function applied when combining multiple values within a
        time bucket.


        Serialized as uppercase strings (e.g. `"SUM"`, `"AVERAGE"`). When no
        aggregation is

        explicitly set on a selector, a default is chosen based on the [`Field`]
        type.
      enum:
        - SUM
        - AVERAGE
        - MIN
        - MAX
        - FIRST
        - LAST
    BadRequestResponse:
      type: object
      description: >-
        Standard body for HTTP 400 Bad Request responses. Branch on the stable
        `error` slug, display `message` as-is, and read per-error structured
        data from `details`.
      required:
        - error
        - message
      properties:
        error:
          type: string
          description: Stable, machine-readable slug identifying the specific error case.
        message:
          type: string
          description: Human-readable message. Safe to log or display to end users.
        details:
          description: >-
            Per-error structured payload. Shape varies by
            [`error`](Self::error).
    ErrorResponse:
      type: object
      description: Error body returned for 401, 404 and 500 responses.
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
    Field:
      type: string
      description: >-
        The specific measurement within a metric to retrieve.


        A gauge metric only has a [`Gauge`](Self::Gauge) field; a counter metric
        only has a

        [`Counter`](Self::Counter) field; a measurement metric has statistical
        fields such as

        [`Mean`](Self::Mean), [`Count`](Self::Count), [`Min`](Self::Min),
        [`Max`](Self::Max)

        and percentiles.


        Serialized as uppercase strings (e.g. `"GAUGE"`, `"P95"`).
      enum:
        - GAUGE
        - COUNTER
        - MEAN
        - COUNT
        - MIN
        - MAX
        - P99
        - P95
        - P90
        - P80
        - P75
        - P70
        - P60
        - P50
        - P40
        - P30
        - P20
        - P10
    GroupBy:
      oneOf:
        - type: object
          description: >-
            Group by the value of a specific tag (e.g. `"hostname"`). The tag
            value becomes

            part of the row's id and group map.
          required:
            - Tag
          properties:
            Tag:
              type: string
              description: >-
                Group by the value of a specific tag (e.g. `"hostname"`). The
                tag value becomes

                part of the row's id and group map.
        - type: string
          description: Group by the metric name itself.
          enum:
            - Name
      description: Specifies how rows in a [`List`](super::output::List) are grouped.
    List:
      type: object
      description: >-
        A tabular collection of [`Row`]s, returned for list-view queries.


        Each row represents an aggregated metric value grouped by tags, used for
        displaying

        metric data in table format in the frontend.
      required:
        - resolution
        - from
        - to
        - rows
      properties:
        resolution:
          $ref: '#/components/schemas/Resolution'
          description: The time interval used for aggregation (e.g. one minute, one hour).
        from:
          type: string
          format: date-time
          description: Start of the queried time range (inclusive).
        to:
          type: string
          format: date-time
          description: End of the queried time range (inclusive).
        rows:
          type: array
          items:
            $ref: '#/components/schemas/Row'
          description: The rows of aggregated metric data.
    ListQuery:
      type: object
      description: >-
        Query for fetching aggregated metric data in tabular form, used to
        populate list views.


        Unlike [`TimeseriesQuery`], which returns data points over time, a
        `ListQuery` returns

        one [`Row`](super::output::Row) per unique combination of group-by
        values, with each row

        containing aggregated metric values.
      required:
        - from
        - to
        - site_id
        - select
        - group_by
      properties:
        from:
          type: string
          format: date-time
          description: Start of the time range to query (inclusive).
        to:
          type: string
          format: date-time
          description: End of the time range to query (inclusive).
        resolution:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Resolution'
              description: >-
                The desired interval for aggregation. When `None`, a resolution
                is

                automatically chosen based on the time range.
        site_id:
          type: string
          description: The site to fetch metrics for.
        select:
          type: array
          items:
            $ref: '#/components/schemas/ListSelector'
          description: >-
            Selectors that define which metrics and fields to fetch. Each
            selector contributes

            a key-value entry in the resulting
            [`Row::data`](super::output::Row::data) map.
        group_by:
          type: array
          items:
            $ref: '#/components/schemas/GroupBy'
          description: >-
            How to group metrics into rows. Each unique combination of group-by
            values produces

            one [`Row`](super::output::Row), whose id is derived from the
            grouped values.
        limit:
          type:
            - integer
            - 'null'
          format: int32
          description: Maximum number of rows to return. When `None`, no limit is applied.
        pagination:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Pagination_MetricsPagination'
              description: >-
                Id-cursor paging (`per_page` 1 to 1000, rows ordered by `id`);
                takes precedence over

                `limit`. A page shorter than `per_page` is the last.
    ListSelector:
      type: object
      description: >-
        Selects a specific metric, field and tag combination to include in a
        list response.


        Each selector contributes one entry in the resulting
        [`Row::data`](super::output::Row::data)

        map, keyed by [`id`](Self::id).
      required:
        - id
        - name
        - tags
        - field
      properties:
        id:
          type: string
          description: |-
            The key under which this selector's aggregated value appears in
            [`Row::data`](super::output::Row::data) (e.g. `"mean"`, `"count"`).
        name:
          type: string
          description: >-
            The metric name to query (e.g. `"cpu_usage"`,
            `"transaction_duration"`).
        tags:
          type: object
          description: >-
            Tag key-value pairs to filter on. May contain wildcard values (`*`)
            for tags

            that are included in the query's [`group_by`](ListQuery::group_by).
          additionalProperties:
            type: string
          propertyNames:
            type: string
        field:
          $ref: '#/components/schemas/Field'
          description: >-
            The specific measurement field to retrieve (e.g. `Gauge`, `Mean`,
            `P95`).
        aggregation:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Aggregation'
              description: >-
                The aggregation function to apply when combining values within a
                time bucket.

                When `None`, a default is chosen based on the field type.
    Order:
      type: string
      description: |-
        Sort order for query results

        Used across multiple domains for paginated and ordered queries.
      enum:
        - ASC
        - DESC
    Pagination_MetricsPagination:
      type: object
      description: Keyset pagination settings, generic over each domain's cursor type.
      required:
        - per_page
        - order
        - cursor
      properties:
        per_page:
          type: integer
          format: int32
          description: Number of results per page.
          minimum: 1
        order:
          $ref: '#/components/schemas/Order'
          description: Sort order for results.
        cursor:
          oneOf:
            - type: object
              description: >-
                Cursor: the id of the last row of the previous page; rows are
                ordered by id.
              required:
                - id
              properties:
                id:
                  type:
                    - string
                    - 'null'
                  description: >-
                    Cursor: the id of the last row of the previous page; rows
                    are ordered by id.
          description: Pagination cursor type for metric lists.
    Resolution:
      type: string
      description: Time resolution that metrics can be returned in
      enum:
        - HOURLY
        - MINUTELY
        - DAILY
    Row:
      type: object
      description: >-
        A single row in a [`List`], representing aggregated metric values for
        one group of tags.


        Rows from different metric sources can be merged together using
        [`Row::merge`],

        combining their data maps into a single row.
      required:
        - id
        - group
        - data
      properties:
        id:
          type: string
          description: >-
            Unique identifier for this row, typically derived from the group tag
            values.
        group:
          type: object
          description: |-
            Tag key-value pairs that define this row's grouping
            (e.g. `{"hostname": "frontend1"}`).
          additionalProperties:
            type: string
          propertyNames:
            type: string
        data:
          type: object
          description: >-
            Aggregated metric values keyed by selector id (e.g. `{"mean": 42.5,
            "count": 100.0}`).
          additionalProperties:
            type: number
            format: double
          propertyNames:
            type: string
    TooManyRequestsResponse:
      type: object
      description: Error body returned for 429 responses.
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
        suggestion:
          type:
            - string
            - 'null'
          description: >-
            A cheaper way to write the request's filter. Only the trace list

            endpoints set it, and only for a filter with a known indexed
            rewrite.
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      description: '`Authorization: Bearer <token>`'
    token_query:
      type: apiKey
      in: query
      name: token
      description: >-
        Alternative to the Authorization header: pass the token as a
        `?token=<token>` query parameter.
```


## API Specification

The full API specification for this endpoint is available in the [documentation index](https://docs.appsignal.com/llms.txt).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.