API Documentation
Server API
The Server API is designed for backend services and provides project-level access. Each API key is scoped to a specific project and can access all environments within that project.
Endpoint
https://www.tinytoggle.com/api/v1/server/environments/{envId}/flags
Retrieve all flags for a specific environment
Authentication
X-API-KEY
Your API key must be included in the request header
Response Example
{
"enable_unicorn_mode": true,
"coffee_consumption_limit": 42,
"debug_mode": false,
"feature_launch_date": "2024-04-01",
"max_pizza_slices": 8,
"secret_sauce_recipe": "classified",
"enable_rainbow_text": true,
"maintenance_mode": false,
"cat_pictures_count": 9000,
"enable_dark_mode": true
}
Rate Limiting
Each successful call counts as one "read" against your monthly quota. Rate limits and quota resets are per user.
Header | Value | Description |
---|---|---|
RateLimit-Limit | 1000000 | Maximum reads per cycle |
RateLimit-Remaining | 999999 | Reads remaining in current cycle |
RateLimit-Reset | 1728000 | Seconds until quota resets |
429 Too Many Requests
response until your cycle resets.Code Examples
Client API
The Client API is optimized for frontend applications and provides environment-level access. Each client key is scoped to a specific environment and is read-only. Responses are cached using Vercel Blob storage for optimal performance.
Endpoint
https://www.tinytoggle.com/api/v1/client/flags
Retrieve all flags for the environment associated with the client key
Authentication
X-API-KEY
Your client key must be included in the request header
Response Example
The cached response contains your feature flags:
{
"enable_confetti_on_login": true,
"max_daily_cat_gifs": 42,
"theme_color": "unicorn_purple",
"enable_easter_eggs": true,
"debug_mode": false,
"feature_launch_date": "2024-04-01",
"max_pizza_slices": 8,
"secret_sauce_recipe": "classified",
"enable_rainbow_text": true,
"maintenance_mode": false
}
Caching & Quota
Each successful call to the client API counts as one "read" against your cycle quota. Fetching the JSON blob from the CDN does not count.
Header | Value | Description |
---|---|---|
Cache-Control | public, s-maxage=60, stale-while-revalidate=30 | CDN and browser caching directives |
Vercel-CDN-Cache-Control | public, s-maxage=60 | Vercel-specific CDN caching |
Surrogate-Key | flags-{environment_id} | Cache invalidation key |