Authentication: Bearer Tokens and Personal API Keys
Use a personal API key for a backend integration. Send it in Authorization: Bearer <personal-api-key> for the REST examples. Bearer is a header scheme, not a separate kind of credential: supported endpoints can use either a personal key or a user access token in that header. Legacy inference and analytics have different credential restrictions.

Two supported header forms for v2 runs. Set STACKAI_BASE_URL to your deployment’s documented API base URL. Legacy inference requires the Authorization form.
Before you begin
A valid credential with the required permissions and resource access.
Authentication methods
Authentication
Verification of the account or credential making a request. It identifies the caller but does not grant every resource permission.
Bearer authentication
An Authorization header whose value begins with Bearer followed by a supported credential. Anyone possessing the credential may be able to use it within its permissions.
X-API-Key
A header accepted by supported routes for a raw personal API key. Do not add a Bearer prefix inside this header value.
API key
A secret credential accepted by a supported API or connector. Send it only through the documented authentication field or header.
Access token
A credential used to authorize requests for its valid lifetime. Expiration or revocation can prevent an otherwise valid operation.
Authenticate an API request
Create a personal key in Settings → API Keys in the organization containing the resource. Give it only the scopes needed by your application.
Send the key through
Authorization: Bearerover HTTPS. Keep it in your backend; do not put it in browser code.Call an operation allowed by both the key scopes and its owner’s current access. For a workflow run, the key needs
projects.run; reading its result also needsanalytics.read.For a 401, check the credential and expiry. For a 403, check scope and resource access. Do not retry an unchanged rejected credential.
The request is authenticated as the intended account or key.
Behavior and limitations
The /v2/runs operations also accept X-API-Key for a personal key. Legacy /inference/v0/... and /analytics/org/... routes require the Authorization form. For endpoints supporting X-API-Key, send the raw key as its value. Do not prefix that header value with Bearer. Personal keys can also use Authorization: Bearer on supported routes. Older routes can require the Authorization form. Do not send conflicting credentials in multiple headers.
Or, where supported:
Related resources
API Versions and Compatibility
Was this helpful?

