Skip to main content
The REST API lets you pull what the console shows into your own tools: dashboards, reports, scheduled jobs. With an API key it is read-only in practice today; see What a key can do.

Base URL and paths

Every path starts with /v1/api/. For example, AI spend by customer is:
Paths of the form /api/<service>/... without /v1 do not accept API keys. They answer 401. The proxy, observation and OpenTelemetry endpoints are the opposite: they live under /api/inference-proxy/ and take a short-lived token, not an API key. See the proxy.

Authenticate

Send an API key as a bearer token:
An API key starts with tc_. It is different from the SDK key (which authenticates the SDK and the proxy) and from an MCP key. Each key belongs to your workspace. The console’s Connect › API keys page creates SDK keys, MCP keys, usage keys and revenue signing secrets. It does not create REST API keys. To create one, call the key endpoint from a signed-in session, with the session’s token as the bearer. A scope is read, write or admin:
The response contains the key once. Store it then; it cannot be shown again. GET /v1/api/identity/api-keys lists keys, DELETE /v1/api/identity/api-keys/<id> revokes one, and POST /v1/api/identity/api-keys/<id>/rotate replaces one.

What a key can do

This is how keys behave today. Reads work. Anything that needs a workspace role returns 403 with an API key, whatever scope the key was created with. Automate writes from a signed-in session, or make them in the console.
A read key can only make GET requests; any other method returns 403 with This API key is read-only: it can make GET requests only. A write or admin key is allowed other methods, but a key carries no role. So creating or changing budgets, routing policies, run and period caps, alert rules and webhooks, accepting recommendations, stopping a run and minting SDK keys all return 403. Writes that need no role, such as export jobs for cost, usage and events, work.

Useful reads

All paths below are under https://api.tensorcost.com/v1. window is a number of days from 1 to 365 and defaults to 30. You can use since and until as YYYY-MM-DD instead; until counts only with since.

Spend by customer

The month’s total

from is included and to is excluded. Add compare_from and compare_to for a comparison period, and grain=day, week or month for the series.
The total counts each dollar once, even when it appears in a provider’s usage and on a cloud bill. See How TensorCost counts AI spend.

Export rows

kind is cost, usage or events; limit is at most 1000, and offset pages. The FOCUS export needs a finance or admin role and cannot be called with a key.
The response shapes above are as the services return them today. Fields are added over time, so read the ones you need and ignore the rest.