API Overview
REST API reference for the Switchflag flag evaluation API. All endpoints require a valid API key.
The Switchflag REST API provides read-only access to flag configurations and evaluation data. The SDK uses this API internally, but you can also call it directly for custom integrations.
Base URL
https://api.switchflag.devAll endpoints are served over HTTPS.
Authentication
Every request must include a valid API key in the Authorization header:
Authorization: Bearer sf_production_...API keys are scoped to a specific environment. A production key only returns flags configured for the production environment.
See Authentication for details.
CORS
The API allows cross-origin requests from any origin:
| Header | Value |
|---|---|
Access-Control-Allow-Origin | * |
Access-Control-Allow-Methods | GET, OPTIONS |
Access-Control-Allow-Headers | Authorization, Content-Type |
Access-Control-Max-Age | 86400 |
All endpoints support OPTIONS preflight requests.
Rate limiting
Requests are rate-limited to 100 requests per minute per API key. Rate limit headers are included in every response.
See Rate Limiting for details.
Endpoints
| Method | Path | Description |
|---|---|---|
GET | /v1/flags | List all flags for the environment |
GET | /v1/flags/{key} | Get a single flag by key |