# Run metrics

> **TL;DR** — `GET https://api.wandura.ai/v2/metrics` returns, per style and per UTC day, how many requests you sent, how many finished, why the others did not, how often a backup model was needed, and how long runs take. Same numbers as the Usage page of the console. Authenticate with your API key; the answer covers your whole org.

## Request
```bash
curl "https://api.wandura.ai/v2/metrics?from=2026-10-01&to=2026-10-14&group_by=day_style" \
  -H "Authorization: Bearer $WANDURA_API_KEY"
```

| Parameter | Meaning |
|---|---|
| `from`, `to` | First and last UTC day, inclusive (`2026-10-01`). Default: the last 30 days. At most 90 days; more is a `400`. |
| `group_by` | `day` (default), `style` or `day_style`. |
| `style` | Only this style id. |
| `path` | `gateway`, `direct`, `jobs` or `standard` (a run made with `POST /v2/runs`). |
| `livemode` | `true` for live keys only, `false` for test keys only. Default: both. |

The answer is limited to your org and to the styles your org can use. It is cached for 60 seconds, so poll it at most once a minute.

## Response
```json
{
  "object": "metrics", "org": "org_123", "from": "2026-10-01", "to": "2026-10-14", "group_by": "day_style",
  "data": [{
    "day": "2026-10-13", "style": "sty_ghibli_portrait",
    "runs": 120, "completed": 108, "failed": 6,
    "failures": { "provider_error": 3, "priority_late": 2, "bad_input": 1, "content_blocked": 4, "canceled": 2 },
    "success_rate": 94.7, "failure_rate": 5.3,
    "fallback_runs": 9, "fallback_rate": 7.8,
    "p50_ms": 3800, "p90_ms": 9100
  }]
}
```

| Field | Definition |
|---|---|
| `runs` | Every request in the window, whatever its status. |
| `completed`, `failed` | Runs that ended `completed` or `failed`. |
| `failures` | Runs that ended without a charge, by reason: `provider_error`, `priority_late` (the priority promise ran out), `bad_input`, `content_blocked`, `canceled`. Blocked and canceled runs are free and are **not** in `failed`. |
| `success_rate` | `completed / (completed + failed)`, in percent. `null` before any run finished. |
| `failure_rate` | `failed / (completed + failed)`, in percent. |
| `fallback_runs` | Runs where the first model failed and a backup model took over. A fallback run can still complete. |
| `fallback_rate` | `fallback_runs` over the runs that reached a model, in percent. Runs that ended on bad input before any model call are not in the denominator. |
| `p50_ms`, `p90_ms` | Time from submit to finish of completed runs. `null` when none completed. |

Which model served a run is never exposed; a fallback is only a count. Spend is not part of this answer: see `GET /v2/runs` and your invoices.

The operation is `getMetrics` in the [OpenAPI spec](https://api.wandura.ai/v2/openapi.json). In the console, open **Usage** for the same numbers as a table, a daily chart and a CSV export. **Rolling out:** Usage also shows this month's live spend so far and a month-end estimate, per product and in total. The estimate is the spend so far plus the average of the last 7 full days for each day left. It is an estimate, not a bill.
