Skip to content

Base URL

https://api.phaseflag.com/api/v1

For local development (OSS Docker):

http://localhost:8000/api/v1

All endpoints return JSON. All request bodies must use Content-Type: application/json.


Authentication

The API supports two authentication methods:

1. Bearer Token (JWT)

Used for dashboard and user-facing operations. Obtain a token via POST /auth/login.

http
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

2. SDK API Key

Used by SDKs and server-to-server integrations. Generated per environment in the dashboard under Settings → API Keys.

http
X-API-Key: sdk-prod-xxxxxxxxxxxx

Rate Limiting

Rate limit information is returned in response headers:

HeaderDescription
X-RateLimit-LimitMaximum requests allowed in the current window
X-RateLimit-RemainingRequests remaining in the current window
X-RateLimit-ResetUnix timestamp when the window resets
Retry-AfterSeconds to wait after a 429 response

Default limits:

Endpoint CategoryLimit
Auth endpoints10 req/min per IP
Management API (JWT)1000 req/min per organization
Evaluation API (SDK key)10,000 req/min per environment
SDK ruleset fetch100 req/min per API key

Standard Response Format

Success

json
{
  "data": { ... },
  "meta": {
    "page": 1,
    "per_page": 50,
    "total": 127
  }
}

List endpoints include a meta object with pagination info. Single-resource endpoints return the resource directly under data.

Error

json
{
  "error": {
    "code": "FLAG_NOT_FOUND",
    "message": "Feature flag 'my-flag' does not exist in environment 'production'.",
    "details": {}
  }
}

HTTP Status Codes

CodeMeaning
200 OKRequest succeeded
201 CreatedResource created
204 No ContentDeletion succeeded
400 Bad RequestValidation error — check error.details
401 UnauthorizedMissing or invalid credentials
403 ForbiddenAuthenticated but insufficient permissions
404 Not FoundResource does not exist
409 ConflictDuplicate resource (e.g., flag key already exists)
422 Unprocessable EntitySemantic validation error
429 Too Many RequestsRate limit exceeded
500 Internal Server ErrorServer-side error

Error Codes Reference

CodeHTTPDescription
INVALID_CREDENTIALS401Wrong email or password
TOKEN_EXPIRED401JWT has expired — re-authenticate
INSUFFICIENT_PERMISSIONS403User lacks required role
FLAG_NOT_FOUND404Flag key does not exist
ENVIRONMENT_NOT_FOUND404Environment does not exist
FLAG_KEY_CONFLICT409Flag key already exists in this project
VARIATION_COUNT_INVALID422Boolean flags must have exactly 2 variations
RULE_ROLLOUT_EXCEEDS_100422Percentage allocations sum to more than 100
RATE_LIMIT_EXCEEDED429Too many requests

Pagination

List endpoints support cursor-based pagination:

http
GET /api/v1/flags?page=2&per_page=50
ParameterDefaultMaxDescription
page1Page number
per_page50200Items per page

Filtering and Sorting

http
GET /api/v1/flags?environment_id=env_abc&status=active&sort=name&order=asc

OpenAPI / Swagger

The interactive API documentation (Swagger UI) is available at:

https://api.phaseflag.com/docs

The raw OpenAPI 3.1 schema:

https://api.phaseflag.com/openapi.json

For local development:

http://localhost:8000/docs
http://localhost:8000/openapi.json

Released under the Apache 2.0 License.