Authentication

API keys, scopes, and security for the FairStack API.

FairStack uses API keys to authenticate requests. All API requests must include your API key in the Authorization header.

API Key Format

FairStack API keys use a recognizable prefix format:

fs_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  • fs_ -- FairStack prefix (all keys start with this)
  • live_ -- Environment indicator
  • xxxx... -- 32 random characters unique to your key

Using Your API Key

curl https://api.fairstack.ai/v1/models \
  -H "Authorization: Bearer fs_live_YOUR_API_KEY"

API Key Scopes

ScopeAccess
generateCreate generations (image, video, voice, music)
assets:readList and download generated assets
assets:deleteDelete generated assets
credits:readView credit balance and usage

Spending Caps

FairStack supports three levels of spending caps:

  • Organization level -- total budget across all keys
  • Project level -- budget per project
  • API key level -- budget per individual key

When a cap is reached, generation requests return 402 Payment Required.

Security Best Practices

  • Never expose API keys in client-side code or version control
  • Use environment variables to store keys
  • Create separate keys for different environments (dev, staging, production)
  • Set spending caps on agent keys to prevent runaway costs
  • Rotate keys periodically

Next steps