---
title: "Fetch Analytics"
method: POST
path: "/tracing/analytics/query"
tags: ["Observability"]
---

# Fetch Analytics

`POST /tracing/analytics/query`

## Query parameters

- `focus` 'trace' | 'span'
- `format` 'agenta' | 'opentelemetry'
- `oldest` union
  - string
  - integer
- `newest` union
  - string
  - integer
- `interval` integer, nullable
- `rate` number, nullable
- `filter` unknown
- `specs` unknown

## Response `200`

Successful Response

- AnalyticsResponse
  - `count` integer
  - `buckets` MetricsBucket[]
    - `timestamp` string, date-time, required
    - `interval` integer, required
    - `metrics` object, nullable
  - `query` TracingQuery
    - `formatting` Formatting
      - `focus` 'trace' | 'span'
      - `format` 'agenta' | 'opentelemetry'
    - `windowing` Windowing
      - `newest` string, date-time, nullable
      - `oldest` string, date-time, nullable
      - `next` string, uuid, nullable
      - `limit` integer, nullable
      - `order` 'ascending' | 'descending', nullable
      - `interval` integer, nullable
      - `rate` number, nullable
    - `filtering` FilteringOutput
      - `operator` 'and' | 'or' | 'not' | 'nand' | 'nor'
      - `conditions` union[]
        - union
          - Condition
            - `field` string, required
            - `key` string, nullable
            - `value` union
              - …
            - `operator` union
              - …
            - `options` union
              - …
          - FilteringOutput — recursive
  - `specs` MetricSpec[]
    - `type` 'numeric/continuous' | 'numeric/discrete' | 'binary' | 'categorical/single' | 'categorical/multiple' | 'string' | 'json' | 'none' | '*'
    - `path` string
    - `bins` integer, nullable
    - `vmin` number, nullable
    - `vmax` number, nullable
    - `edge` boolean, nullable

## Other responses

- `422` — Validation Error

## Changes

- **2026-02-13** `72fe88316d15` — 2 info
  - added the optional property `detail/items/ctx` to the response with the `422` status
  - added the optional property `detail/items/input` to the response with the `422` status
- **2026-01-14** `53da4c9de2b7` — 1 info
  - endpoint added
- **2025-06-27** `e3e84db47198` — 1 info
  - api path removed with deprecation

[Change history](https://skmtc.dev/agenta-ai/apis/agenta-api/changes/tracing/analytics/query/post.md)

---

[API](https://skmtc.dev/agenta-ai/apis/agenta-api.md) · [All operations](https://skmtc.dev/agenta-ai/apis/agenta-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/agenta-ai/agenta-api/revisions/8fcd55a5a656/schema)
