Dashboard (user JWT)
API keys
Create, update, rotate, and revoke workspace ingest keys with conditions.
GET
All management routes require a Supabase user JWT + workspace membership.
Guide: API keys & conditions. Ingest with the secret via
Returns
201 response includes
Same body fields as create (all optional). Does not rotate the secret. Creates an audit event (
Issues a new secret (shown once) and invalidates the previous hash. Conditions are preserved. Audit action:
Soft-revokes (
Ledger rows stamped with
Authorization: Bearer cmcp_live_... on REST or https://mcp.costmcp.com.
List keys
{ keys: [...] } including conditions and spent_usd (month-to-date when monthly_limit is set). Secrets are never returned.
Fields: id, name, key_prefix, permissions, environment, status, project_id, monthly_limit, expires_at, rate_limit_rpm, allowed_cidrs, conditions, last_used_at, created_at, spent_usd.
Create key
Display name
Defaults to
log_usage, add_expenses, read_summaries, estimate_costsRestrict the key to a single project UUID (null = all projects)
Optional allow-list stored in
conditions.project_slugs (ignored when project_id is set)Max USD attributed to this key in the current UTC month
ISO datetime; requests after this return
401 key_expiredMax requests per rolling minute (
429 rate_limited)Empty = allow all. Otherwise client IP must match (
403 ip_not_allowed)live (default) or testExtensible JSON:
project_slugs, deny_project_slugs, features, sources, notessecret (cmcp_live_...) — shown once.
Valid permissions: log_usage, add_expenses, read_summaries, estimate_costs, manage_subscriptions, delete_records.
Update conditions
updated).
Rotate secret
rotated.
Revoke key
status = "revoked"). Returns { ok: true }. Audit action: revoked.
Enforcement on ingest
| Condition | HTTP | Error code |
|---|---|---|
| Expired | 401 | key_expired |
| IP not allowed | 403 | ip_not_allowed |
| Rate exceeded | 429 | rate_limited |
| Missing permission | 403 | missing_permission |
| Wrong project | 403 | project_not_allowed |
| Monthly cap | 403 | monthly_limit_exceeded |
| Wrong source / feature | 403 | source_not_allowed / feature_not_allowed |
api_key_id power the monthly spend meter.
