APIAuthentication

Every API request requires an Authorization: Bearer header with a valid token.

MethodFormatBest for
Session credentialIssued after browser sign-inDashboard and CLI device sessions
Personal API tokensk_akua_...CI/CD, scripts

For CI/CD and scripts, personal API tokens are recommended.

CLI browser/device authentication

Use browser/device authentication for interactive terminal and coding-agent onboarding:

akua auth login
akua auth status --json

The CLI opens Akua’s device page and waits for you to approve the displayed code. Use akua auth login --no-browser on a remote terminal and open the displayed URL yourself. The CLI stores the resulting credential locally only after approval.

The flow uses the OAuth 2.0 Device Authorization Grant, so the CLI never handles your account password.

Terminalakua auth loginshows a code
BrowserYou approvecheck the code matches
session token
CLISigned innever sees your password

Session credentials

Session credentials back browser-approved interactive sessions: the dashboard, and the CLI after akua auth login. They are validated server-side on every request.

For non-interactive environments such as CI/CD and scripts, use personal API tokens instead.

Personal API tokens

Personal API tokens are long-lived tokens prefixed with sk_akua_. They’re the recommended approach for CI/CD pipelines, scripts, and automated workflows.

A token belongs to you and acts as you. It never does more than your own roles allow, and you can narrow it further when you create it:

  • Workspace: limit the token to one Workspace. It then acts in that Workspace only.
  • Roles: limit the token to what a list of IAM roles allows, such as roles/viewer for a read-only token. The token may do only what one of those roles includes and what you may do yourself.

A token without either limit has your rights in every Workspace you belong to.

Create a token

Create a token from a signed-in session, in the dashboard or with the create endpoint. An API token cannot create another token. The response returns the full token once.

The token field is only returned once at creation time. Store it securely. It cannot be retrieved later.

Use it with the CLI:

akua auth login --token "$AKUA_API_TOKEN"

List and revoke tokens

# List your tokens
curl https://api.akua.dev/v1/api_tokens \
  -H "Authorization: Bearer $AKUA_API_TOKEN"

# Revoke a token
curl -X DELETE https://api.akua.dev/v1/api_tokens/TOKEN_ID \
  -H "Authorization: Bearer $AKUA_API_TOKEN"

A revoked token stops working immediately.

Workspace scoping

Many endpoints operate within a Workspace. Select it with the Akua-Context header:

curl https://api.akua.dev/v1/installs \
  -H "Authorization: Bearer $AKUA_API_TOKEN" \
  -H "Akua-Context: ws_xxx"

A token limited to one Workspace uses that Workspace when you send no header. An Akua-Context that names another Workspace returns 403 Forbidden. Any other credential calling a Workspace endpoint without Akua-Context also returns 403 Forbidden.

For Workspace discovery, call workspaces.list without Akua-Context to discover all Workspaces you can access, or select a Workspace to list only that one. A Workspace-limited token can discover only its own Workspace.

Security

  • Akua never stores plaintext tokens. Tokens are hashed before storage.
  • Every API token carries a checksum, so a mistyped or truncated token is rejected at once and secret scanners can recognize Akua tokens.
  • Tokens can have an expiration date. Expired tokens are rejected automatically.
  • Each token tracks its last used timestamp for auditing.
  • A revoked token stops authenticating requests immediately and cannot be recovered.