Documentation Navigation
Getting Started
API Reference
Resources
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 indicatorxxxx...-- 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
| Scope | Access |
|---|---|
generate | Create generations (image, video, voice, music) |
assets:read | List and download generated assets |
assets:delete | Delete generated assets |
credits:read | View 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
- Quickstart -- make your first API call
- SDKs -- Python, Node.js, and CLI
- API Reference -- full endpoint documentation