STACK
MENU
DOCS / API REFERENCE / AUTHENTICATION

Authentication

STACK accepts different credentials for operators, integrations, agents, and partners. Each route still applies its own role and security rules.

Authorization Header

text
Authorization: Bearer <access token>
bash
curl https://api.getstack.run/v1/agents \
  -H "Authorization: Bearer <access token>"

Do not put tokens in source code, URLs or chat messages.

OAuth Access Tokens

MCP clients, the CLI and other authorized integrations use short-lived OAuth access tokens. An access token comes from signing in. An MCP client signs in through the browser (authorization code flow with PKCE at /oauth/authorize and /oauth/token). For code, run npx @getstackrun/cli auth login: you approve the device in a browser, and the CLI stores a rotating refresh token in ~/.stack/credentials.json, which the CLI and both SDKs exchange for a fresh access token. An access token for the API is valid for one hour. A member token carries the member's role and service-connection restrictions.

Console Sessions

The Console uses a signed session cookie. The API resolves the current operator or member from that session. Do not copy the cookie into scripts or external clients.

Agent JWTs

Customer-managed agents enroll a public key and exchange a signed challenge for a short-lived agent JWT. Agent contexts cannot call governance, billing, identity, credential-expansion, or other operator-only routes.

Passport Tokens

A passport proves agent identity and delegated scope for an action. Send it in X-Passport-Token when a route requires it. It does not replace the bearer credential on normal operator API calls.

text
Authorization: Bearer <access token>
X-Passport-Token: $STACK_PASSPORT

Missing, expired, revoked, or unauthorized credentials fail closed. The response is 401 for failed authentication or 403 for insufficient authority.

Authentication | Docs