Base URL and paths
/v1/api/. For example, AI spend by customer is:
Authenticate
Send an API key as a bearer token: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:
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.
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 underhttps://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.
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.