GET
/
api
/
v1
/
workspaces
/
{slug}
/
metrics
curl "https://api.costmcp.com/api/v1/workspaces/acme-ai/metrics?period=month&type=usage" \
  -H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN"
Requires Supabase JWT + workspace membership. Powers the Robinhood-style spend panel.
slug
string
required
Workspace slug
period
string
day | week | month | quarter | year | all (default month)
project
string
Filter to one project slug
type
string
Filter by message type (usage, expense, subscription, …)
environment
string
Filter by environment label

Response fields

FieldTypeDescription
periodstringEcho of query
period_labelstringHuman label
total_usdnumber
usage_usdnumber
expense_usdnumberNon-usage, non-subscription
subscription_usdnumber
message_countnumber
dailyarray{ date, amount_usd }
daily_by_typearrayGap-filled usage / subscription / expense / total
daily_by_projectobject{ series, daily } — top 5 + other
by_projectarray{ slug, name, amount_usd, percent } sorted desc
by_typeobjectMap of message_type → amount
budgetobject | nullGlobal budget with status: ok | warning | danger
top_projectobject | nullHighest spend project
curl "https://api.costmcp.com/api/v1/workspaces/acme-ai/metrics?period=month&type=usage" \
  -H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN"