Skip to content

Administer

API keys

Keys for automation and for sending usage data, each scoped to one project.

Each key belongs to one project and is created in Settings, API keys. The secret is shown once, when the key is created. Store it in your secret manager; it cannot be retrieved later.

Scopes

Every key starts with crm_ and has one of three scopes:

ScopeWhat it can do
Read onlyRead the organization, the project it belongs to, and the project's costs, budgets and alerts.
Read and writeRead the same, and change the project's settings, such as its name and currency.
Send data onlySend usage data, custom source files and business metric values to the project, and nothing else: it cannot read anything.

No key can manage people, single sign on or other keys, and none can reach another project. A key that leaked reaches no further than its project and scope. A key reads its whole project, so someone who sees part of a project cannot create one for it. Use a Send data only key in your own services, since it can never read your billing data; see Sending usage data, Custom sources and Unit costs.

Using a key

Send it as a bearer token:

Authorization: Bearer crm_...

Every path below is under https://api.costreveal.com/api/v1. A request the API refuses is answered with a code that says why, as Errors lists them.

Reading costs

A read only or read and write key reads its own project's figures through the same endpoints the dashboard reads, and answers with the same figures, each carrying its basis. Name the project with projectId; a key can read no other.

EndpointWhat it returnsParameters
GET /costs/overviewA month's total, how much is explained, unknown and not yet invoiced, and reconciliationprojectId, period, currency, billedIn, costType
GET /costs/exploreSpend by a dimension, then by a second, filtered, compared with another monthThose, and groupBy, thenBy, filter, compare
GET /costs/explore/driversWhat drove the change from the month compared withAs Explore, with compare
GET /costs/businessCost per feature, customer and user, beside the calls usage data countedprojectId, period, currency, billedIn, costType
GET /costs/marginRevenue beside cost, by customer, once Stripe is connectedprojectId, period, currency, billedIn, costType
GET /costs/unit-costsEach unit cost's month, the month before, its trend, its days and each owner's figureprojectId, period, currency, billedIn, costType
GET /metricsEach business metric, and the days it holds values forprojectId
GET /costs/insightsThe month's forecast, the next month's, and anomalies against what was expected, with where each standsprojectId, currency, billedIn, costType
GET /costs/insights/anomaly-driversWhat drove an anomaly's day, divided exactly by every dimensionprojectId, provider, day, lens and its subject, currency, billedIn
GET /costs/insights/anomaly-movementsWhat moved below the service: usage types and resources, more use or a higher priceAs above
GET /costs/insights/anomaly-changesWhat changed around an anomaly, from each cloud's own records and the cluster'sAs above
GET /costs/savingsSavings each cloud recommends and clusters' idle capacity, with where each standsprojectId, currency, billedIn
GET /budgetsEach budget, its spend so far, its state and its forecastprojectId
GET /kubernetes/costsEach cluster's bill, its workloads, idle capacity and unmeasured daysprojectId, period, costType
  • period is a month as YYYY-MM; the current month when left out.
  • currency shows every figure in that currency, at the European Central Bank's average rate for the month; the project's display currency when left out. billedIn reads only what was billed in one currency, unconverted.
  • costType is billed, discounted, amortized or discounted_amortized; billed when left out. Each answer states its costType, and the anomalies of /costs/insights are in billed cost whichever is asked for. See Cost types.
  • groupBy and thenBy are provider, account, region, service, model, team, feature, customer or user, cluster, namespace or workload for Kubernetes, or a custom dimension as tag:<key>.
  • filter is dimension:value, repeated for each, such as filter=team:search&filter=service:AmazonEC2.
  • compare is previous_month, previous_year or a month as YYYY-MM.
  • An anomaly is named as /costs/insights lists it: its provider, its day as YYYY-MM-DD, and its subject's lens with the subject's fields, such as lens=service&service=AmazonEC2.
  • Amounts are decimal strings, exact as billed, never floating point numbers.
curl -H "Authorization: Bearer crm_..." \
  "https://api.costreveal.com/api/v1/costs/explore?projectId=<project>&period=2026-10&groupBy=team&thenBy=service"

The same reads are offered to AI tools such as Claude Code, Cursor and Visual Studio Code through the MCP server.

Chargeback statements and reports are read in the dashboard, where each download is recorded against the person who made it.

Rate limits

An organization's read only and read and write keys, together, may call each endpoint up to its plan's limit a minute, listed under Settings, Plan and usage. A Send data only key has a limit of its own, so usage data, custom source files and metric values are never held up by other keys. A request past its limit is answered with status 429, and its Retry-After header says how many seconds to wait. People signed in to the dashboard are counted apart, each on their own.

Expiry and revocation

Choose an expiry of 30 days, 90 days, a year, or none. Revoking a key stops everything using it straight away. Each key shows when it was last used, which helps find keys that can be retired.