---
title: "Cost aggregation scoped to one workspace (owner/admin)"
method: GET
path: "/api/v1/workspaces/{workspace_id}/cost-aggregation"
tags: ["workspaces"]
---

# Cost aggregation scoped to one workspace (owner/admin)

`GET /api/v1/workspaces/{workspace_id}/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/workspaces/{workspace_id}/cost-aggregation`
- Auth: none declared

Aggregate cost for a single workspace.

Requires workspace **owner** or **admin** role — viewer / member
are rejected because cost aggregates leak per-user activity volume
across private contexts that those roles should not see. Owners
review billing; admins manage workspace settings.

Cross-workspace probing is impossible here: the path-bound
``workspace_id`` is the only scope passed to the service, and
``check_workspace_admin`` rejects callers without admin/owner
membership in *that specific* workspace before the query runs.

## Path parameters

- `workspace_id` string, uuid, required

## 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
- `user_id` string, nullable: Filter to a single user
- `source` string, nullable: Filter by source: ['sleep', 'analysis', 'supersede_verify', 'llm_selector']
- `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/09f17f5ada29?raw)
