---
title: "Cost aggregation across all workspaces (admin)"
method: GET
path: "/api/v1/admin/cost-aggregation"
tags: ["admin"]
---

# Cost aggregation across all workspaces (admin)

`GET /api/v1/admin/cost-aggregation`

## Request

- Base URL: `https://memory.kagura-ai.com` (the document declares no server; this is the origin it was published from)
- URL: `https://memory.kagura-ai.com/api/v1/admin/cost-aggregation`
- Auth: none declared

Aggregate LLM + embedding cost across every workspace.

Admin-only (``require_admin``). ``workspace_id`` here is a
convenience filter — admins can scope to one workspace without
using the workspace-scoped route — but absent it, every workspace
is included.

## Query parameters

- `period` string: Aggregation period: day | week | month
- `from` string, date, required: Inclusive lower-bound date
- `to` string, date, required: Inclusive upper-bound date
- `workspace_id` string, uuid, nullable: Filter to a single workspace
- `user_id` string, nullable: Filter to a single user
- `source` string, nullable: Filter by source: ['sleep', 'analysis', 'supersede_verify']
- `paid_by` string, nullable: Filter by billing classification: ['platform', 'byok']

## Response `200`

Successful Response

- CostAggregationResponse: Wrapper around the row list — keeps room for a future cursor / summary block without breaking the response shape.
  - `rows` unknown, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud.md) · [All operations](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/llms.txt) · [OpenAPI document](https://skmtc.dev/kagura-ai/apis/kagura-memory-cloud/revisions/aa9df1a21db9?raw)
