API key management

ArcFlow uses a two-tier API key model plus optional scoped runtime keys and per-site tokens. This guide covers generation, storage, rotation, and what each credential can access.

Key tiers

CredentialProtectsTypical location
ARCFLOW_SERVER_API_KEY/v1/runs, registry, trace, approve, externalServer env, backend services
ARCFLOW_ADMIN_API_KEY/v1/admin/*BFF env, CI, never browser
Scoped runtime keySubset of workflows via ARCFLOW_STATIC_RUNTIME_KEYSRelay upstream, automation
Site tokenRelay /v1/sites/{id}/*Frontend build env (VITE_*)

Generation

Use cryptographically random keys:

bash
openssl rand -hex 32

Minimum practical length: 32 hex characters (256 bits). Use distinct values for server and admin keys.

Do not use compose defaults (dev-secret, dev-admin) outside local development.

Scoped runtime keys

JSON in ARCFLOW_STATIC_RUNTIME_KEYS:

json
{
 "relay-upstream-1": {
 "workflows": ["chat"],
 "publish": false
 }
}

Relay calls upstream with the scoped key associated with a site (upstream_runtime_key or default). Scoped keys cannot call admin routes (403).

What each key can access

ActionServer keyAdmin keyScoped keySite token
POST /v1/runsYesNoIf workflow allowedVia Relay only
GET /v1/runs/{id}YesNoYesVia Relay
Registry publish (runtime)YesNoIf publish: trueNo
POST /v1/admin/sitesNoYesNoNo
Knowledge ingestNoYesNoNo
Relay create runNoNoNoYes + Origin

Enforcement matrix: API key management.

Storage rules

RuleDetail
Environment variablesPrimary production pattern
Secret managersVault, AWS SM, K8s Secrets preferred at scale
Never in gitNo .env commits; pre-commit secret scan
Never in frontendExcept site token (by design, bounded by Relay)
Never in Docker image layersInject at runtime

Rotation

KeyProcedure
Site tokenToken rotation (ArcFlow repository)
Server keyRolling server deploy + update Relay upstream
Admin keyUpdate BFF secrets + rolling server deploy

Rotate on suspected exposure, schedule, or personnel change.

Logging and support

Classification from Environment variables reference:

  • Never log: server key, admin key, LLM keys, webhook secret, site tokens in support bundles
  • Safe to log: key id names in config (not values), scoped key map structure without secrets

Debug endpoints

ARCFLOW_DEBUG=true enables /v1/debug/* on debug builds. Keep disabled in production. Debug routes are localhost-oriented.