Skip to main content
POST
Issue a Cube API token for Usage Analytics
🔒 Admin only. Requires administrator privileges — the authenticated principal (API key, embed JWT, or any bearer token) must belong to a user with the admin role. Issues a short-lived Cube API token for Cube’s internal Usage Analytics deployment — the data shown on Admin → Usage Analytics — so you can query your own usage and billing data programmatically (REST API, BI tools, scripts) instead of only through the embedded page. The token is scoped to your account: it carries the same server-resolved security context as the embedded Usage Analytics page, so queries only ever see your own data. Send it as Authorization: Bearer <token> on requests to the returned apiUrl (the deployment’s Cube REST API). Tokens expire after ~24 hours (see expiresAt). Issue a fresh one per session or scheduled refresh — issuing is idempotent and cheap. Requires Usage Analytics to be enabled for the account, otherwise 404 is returned.

Authorizations

Authorization
string
header
required

Token authentication. Send Authorization: Bearer <YOUR_TOKEN>.

Response

200 - application/json
apiUrl
string
required

Base URL of the Usage Analytics deployment’s Cube REST API (e.g. https://<host>/cubejs-api/v1). Query it with the returned token.

deploymentId
integer
required

Id of the Usage Analytics deployment the token was issued for.

token
string
required

A short-lived JWT for the Usage Analytics deployment, carrying this tenant’s security context. Send it as Authorization: Bearer <token> on requests to apiUrl.

expiresAt
string | null

When the token expires, as an ISO-8601 timestamp. Request a new token before this moment — issuing one is idempotent and cheap.