---
title: "Compare a window with the previous window"
method: GET
path: "/api/v1/data/trends"
---

# Compare a window with the previous window

`GET /api/v1/data/trends`

## Request

- Base URL: `https://moda.dev`
- URL: `https://moda.dev/api/v1/data/trends`
- Auth: API key in header `x-api-key`

Returns the dashboard's KPIs for the window against the window of equal length just before it, from the same loaders as the Analytics overview, the Signals rate cards, the detector KPI tiles and the Problems trend card. Each figure is { current, previous, delta, delta_pct, spike? }; delta is in points for a _pct rate. With since (for example a deploy time) the previous window is the same span before since, so the response is a before/after comparison.

## Query parameters

- `days_back` integer
- `since` string
- `until` string
- `agent` string
- `unit` 'conversation' | 'segment' | 'turn'
- `include` string
- `family` string
- `series` '0' | '1' | 'true' | 'false'

## Response `200`

Successful response.

- object: window (from, to, previous_from, previous_to, days, bucket), agent (selected, options), overview (conversations, messages, negative_emotion_rate_pct, tool_failure_rate_pct, hallucinations: a count of hallucinations, not a rate), problems (window, analysed_traces, traces_with_signal, signal_rate_pct), rates (unit, units, comparable, <detector>_pct; delta and delta_pct are null when comparable is false), detectors (emotion, tool_failure, laziness, hallucination KPI tiles), series (with series=1), notes.

## Other responses

- `401`: The x-api-key header is missing, invalid, or revoked.
- `404`: The requested resource was not found.

---

[API](https://skmtc.dev/moda-dev/apis/moda-data-api.md) - [All operations](https://skmtc.dev/moda-dev/apis/moda-data-api/llms.txt) - [OpenAPI document](https://skmtc.dev/moda-dev/apis/moda-data-api/revisions/19a11ad88cf6?raw)
