API Reference
Log In
API Reference

Get cost breakdown by department

Cost, requests and tokens per department over time, bucketed as cost-by-user. Each call counts in the department its person was in when it was made. Spend with no department at the time is the group "No department assigned" (departmentId "unassigned"). Groups carry departmentId and parentDepartmentId: hashids as team-medians takes, not the numeric ids of GET /v2/api/departments; series are keyed by id because names can repeat. Metrics: the department's own cost, requests and tokens, which sum across groups to cost-by-user, and the same three WITH_SUBDEPARTMENTS. Calls that name no person are in neither. departmentSetup.status NO_DEPARTMENTS, NO_ASSIGNMENTS or DATA_NOT_LOADED means no groups, never $0; departmentSetup.message says why, setupUrl where to set up. Same filters as cost-by-user. For one figure per group over the whole period, a far smaller answer over a long date range, use get_cost_by_department_aggregated.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Query Params
date-time

Start of the date range, ISO 8601 in UTC, for example 2026-01-01T00:00:00Z. Defaults to 24 hours before endDate.

date-time

End of the date range, ISO 8601 in UTC. Defaults to now.

string
enum

How the values in each group are combined: sum, avg, max, min, count, median, or the percentile p50, p90, p95 or p99. Defaults to sum.

integer | null
≥ 0
Defaults to 0

Zero-based page of _embedded.items to return. Defaults to 0.

integer
≤ 100
Defaults to 20

Number of _embedded.items per page, from 1 to 100. Defaults to 20.

costSources
array of strings
Defaults to coding_assistant

Which cost to count: coding_assistant (coding assistant seats and usage), revenium_metered (usage metered by the Revenium SDK) or provider_billing (cost reported by your AI provider's billing). Defaults to coding_assistant only. Repeat the parameter to pass several values.

costSources
Allowed:
agents
array of strings

Keep only these agents, by name. Repeat the parameter to pass several values.

agents
providers
array of strings

Keep only these providers, by name. Repeat the parameter to pass several values.

providers
models
array of strings

Keep only these models, by name. Repeat the parameter to pass several values.

models
users
array of strings

Keep only these users, by subscriber email. Repeat the parameter to pass several values.

users
string

Hashed id of the team to answer for. Optional. With a user token it may be any team the user belongs to; without it the user's default team answers. An API key always answers for its own team, and naming any other team is refused with 403.

Headers
string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Responses

Language
Credentials
Bearer
API Key
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json
application/problem+json