Skip to main content
Setting up a CI/CD pipeline? Use a CI deploy token instead: a least-privilege fjall_dk_ token built for pipelines, minted in the web app under Settings → CI/CD Tokens (minting is session-only, so the CLI cannot create one). See CI/CD Integration.

Overview

fjall token mints scoped fjall_ak_ API tokens for AI agents, scripts, and automation acting as you. Create one per consumer, scope it to what that consumer needs, and revoke it independently when it is done. Consumers authenticate by setting the token as the FJALL_API_KEY environment variable instead of running an interactive fjall login. FJALL_API_KEY takes precedence over the stored login in ~/.fjall/auth.json (or $FJALL_CONFIG_DIR/auth.json). For pipelines, prefer a CI deploy token (fjall_dk_, minted in the web app under Settings → CI/CD Tokens): it carries a fixed least-privilege scope set and doubles as the pipeline’s AWS credential.
fjall token is the home for these commands. There is no fjall user token subcommand.

Prerequisites

  • A Fjall login (fjall login). Every subcommand authenticates first.
  • A subcommand. Bare fjall token prints usage rather than acting.
  • admin scope to run token create or token revoke. A token minted with the default scope set cannot mint or revoke other tokens.

Subcommands

Create a token

The plaintext token is the result, so it is the only thing on stdout — bare, with no prefix and no surrounding text. The token id, name and prefix are commentary and go to stderr with the rest of the conversation. In --agent mode the token rides the TOON result block as token, verbatim and unmasked, because it is the value the caller ran the command to receive.
The token value is shown once, including in agent output. Store it in your secret store immediately; do not print it into model context, CI logs or shell tracing. Request the minimum scopes explicitly rather than relying on the broad * default.

List tokens

Each row shows the token’s name, prefix, status (active, expired, or revoked), and a constraint summary such as env=staging acct=production app=2. Use --agent for structured output.

Show a token

Prints the id, name, prefix, status, scopes, every constraint axis, expiry, creation time, last-used time, and request count. Constrained accounts are listed by name alongside the stored id.

Revoke a token

--reason is optional, and recording one makes the audit trail readable later.

Scopes

--scope accepts a comma-separated list. The default, *, expands to every user-grantable scope except destroy and admin. Two further scopes, deploy:oidc:mint and deploy:governance, belong to CI deploy tokens only. Requesting either from fjall token create is refused with a pointer to Settings → CI/CD Tokens. The table describes Fjall API access, not AWS IAM permissions. A personal or agent token with deploy does not acquire deploy:oidc:mint and cannot use the Fjall API’s CI-token-only AWS mint path. See aws exec authentication. Local-only editors such as add, remove, modify, undo, history and validate do not become API-authorised operations merely because a scope registry names them; synth or subsequent deploy steps have separate credential requirements.
admin cannot combine with any other scope, and an admin token expires within 24 hours. Every other scope set caps at 90 days.

Restrict a token

Three constraint axes narrow what a token may touch. Combine them freely.
  • --app and --account are repeatable and accept a name or an id. Fjall resolves each input before minting, and an unresolvable name fails the mint rather than issuing a wider token.
  • --environment takes a single free-form environment name.
  • A token with no constraints can act on every application, environment, and account its scopes reach.
A restricted token covers an application only when every axis it was minted with admits it. --app is checked against the application itself, --account against the connected account the application is linked to, and --environment against that account’s environment. So a token minted with --environment staging alone doesn’t cover an application linked to a production account, or to an account with no environment. An asset, such as a bucket or a database, is checked through its application and the connected account it sits in, and a finding through its asset. A restricted token that names an application or asset it doesn’t cover gets 403 and code forbidden-resource, and so does one that names an id that doesn’t exist, so the token can’t tell the two apart. Lists, such as fjall metrics show without --app, return only what the token covers. A read that always spans the whole organisation, such as fjall metrics show --mode org_summary or fjall costs show --mode summary, is refused to any restricted token, and the cure is a token without resource constraints. A deploy doesn’t stop at that refusal yet. When a restricted token deploys an application or account it doesn’t cover, fjall.io refuses to record the deployment with the same 403. Every CLI release so far, 39.2.4 included, reads that refusal as tracking it couldn’t set up and carries on. The deploy runs, and it doesn’t appear in the deployment history. fjall deploy prints this warning, followed by Cause: and the refusal’s message.
If your organisation requires tracked deployments, fjall deploy stops there instead, unless you pass --force-untracked. When fjall org deploy meets the refusal, it carries on without the warning, whatever that setting says. Until a CLI release stops at this refusal, give each token constraints that cover everything it deploys, or use a token without resource constraints.

Destroy-scoped tokens

Teardown rights are never granted by default, and two extra mint gates apply.
1

Request destroy explicitly

Name the scopes rather than relying on *: --scope read,deploy,destroy.
2

Name the environments it may destroy

A destroy scope without --environment <name> is refused at mint time.
3

Acknowledge production, if it is in scope

When --environment names production (any casing), add --confirm-production-destroy.

Use a token

To capture the token in a script, just capture stdout — nothing else is on it, and a mint that fails writes nothing there at all, so the variable is either the token or empty:

Next steps

Agent Mode

Run Fjall from AI agents with structured output and field selection.

fjall ci

Configure pipelines, list or revoke browser-minted CI deploy tokens, and run deploys from CI.

CI/CD Integration

Deploy to AWS from pipelines with a least-privilege CI deploy token.

fjall login

Sign in interactively and see where Fjall stores your credentials.