Authentication
All API requests require a Bearer token. Create and manage API keys in the dashboard.
Bearer token authentication
All AlertFlow API requests are authenticated with a Bearer token in the Authorization header:
curl https://app.yourdomain.com/api/v1/alerts \
-H "Authorization: Bearer af_live_your_key_here"
Creating an API key
- 1Open API Keys
Go to Settings → API Keys and click New API Key.
- 2Name and scope it
- Name: a descriptive label, e.g., "Monitoring Script" or "Grafana Integration"
- Scopes: choose the minimum permissions needed (see table below)
- Expiry: optional — set an expiry date for keys used by short-lived scripts
- 3Copy the key
After clicking Create, copy the full key value. It's shown only once. AlertFlow stores only a hash — the plaintext cannot be retrieved later.
API key scopes
Scopes follow the pattern resource:action. Grant only what the consumer needs.
| Scope | Access |
|---|---|
alerts:read | List and get alerts |
alerts:write | Acknowledge, resolve, bulk-acknowledge |
incidents:read | List and get incidents |
incidents:write | Update incident status and assignment |
clients:read | List and get clients |
clients:write | Create, update, delete clients |
workflows:read | List and get workflows |
workflows:write | Create, update, enable/disable workflows |
schedules:read | List schedules and current on-call |
schedules:write | Create, update, delete schedules |
integrations:read | List and get integrations |
integrations:write | Create, update, delete integrations |
suppression:read | List suppression windows |
suppression:write | Create, update, delete suppression windows |
users:read | List organization members |
api_keys:read | List API keys (never returns key values) |
api_keys:write | Create and revoke API keys |
Key format
AlertFlow API keys have the prefix af_live_ (production) or af_test_ (test environment). Example:
af_live_a1b2c3d4e5f6789012345678901234567890abcd
Revoking a key
- Go to Settings → API Keys.
- Click the ... menu next to the key.
- Click Revoke.
Revocation is immediate — in-flight requests using that key will fail with 401.
Security best practices
- Store API keys in environment variables, never in source code
- Use the minimum scopes needed for each integration
- Set expiry dates for keys used by scripts or CI pipelines
- Rotate keys periodically — revoke and recreate
- Monitor key usage in Settings → Audit Log (filter by
api_key.used)
Errors
| HTTP status | Meaning |
|---|---|
401 Unauthorized | Missing, invalid, or revoked API key |
403 Forbidden | The key exists but lacks the required scope |
429 Too Many Requests | Rate limit exceeded |