Manage API Tokens
API tokens (access keys) authenticate remote_write and query requests for a specific tenant. Each token is scoped to one tenant and must be sent as a Bearer token in the Authorization header alongside X-Scope-OrgID.
View API tokens for a tenant
- Go to Tenants in the sidebar.
- Click the tenant name.
- Scroll to the API keys section at the bottom of the detail page.
The table shows each key's name, status, last used time, and creation date.
Create a new API token
- Open the tenant detail page (Tenants → click tenant name).
- In the API keys section, click New key.
- Enter a name for the key (e.g.
prometheus-prod,alloy-staging). - Click Create.
- Copy the token immediately — it is only shown once.
:::warning Token shown once The full token value is displayed only at creation time. Store it securely (e.g. in a secrets manager or Kubernetes secret). If you lose it, rotate the key. :::
Rotate an API token
Rotating a key generates a new token and invalidates the old one. Do this if a token may have been exposed, or as part of a regular credential rotation policy.
- Open the tenant detail page (Tenants → click tenant name).
- In the API keys table, find the key to rotate.
- Click the rotate icon (circular arrow) on that row.
- Copy the new token — it is only shown once.
- Update your
remote_writeconfig with the new token before the old one is invalidated.
:::tip Zero-downtime rotation Update your metrics collector config with the new token before closing the rotation dialog. The old token is invalidated as soon as you confirm. :::
Revoke an API token
Revoking permanently deletes a token. Requests using that token will receive HTTP 401 immediately.
- Open the tenant detail page (Tenants → click tenant name).
- In the API keys table, find the key to revoke.
- Click the revoke icon (trash / X) on that row.
- Confirm the action.
The key is removed from the list and is no longer usable.
Using a token in your collector
Every request to xScaler requires both headers:
# Prometheus
remote_write:
- url: https://euw1-01.m.xscalerlabs.com/api/v1/push
authorization:
credentials: <token>
headers:
X-Scope-OrgID: <tenant-id>
# Grafana Alloy
prometheus.remote_write "xscaler" {
endpoint {
url = "https://euw1-01.m.xscalerlabs.com/api/v1/push"
authorization {
type = "Bearer"
credentials = "<token>"
}
headers = { "X-Scope-OrgID" = "<tenant-id>" }
}
}
Audit trail
All token operations are logged in the Activity log:
| Event | Triggered by |
|---|---|
api_key.created | New key created |
api_key.rotated | Key rotated |
api_key.revoked | Key revoked |