API Documentation

Direct API integration for custom implementations and serverless functions

REST API Overview

Our REST API allows you to programmatically manage feature flags and their configurations. This documentation provides detailed information about available endpoints, authentication, and usage examples.

Authentication

API Key Authentication

All API requests must include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Base URL

API Endpoint

https://myflags.io/api

Endpoints

Get Feature Flags

GET /flags

Retrieve all feature flags for a project

curl -X GET 'https://myflags.io/api/flags' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'x-api-env: development' \
  -H 'x-api-project: YOUR_PROJECT_KEY'
{
  "flag_name": false,
  "flag_name_2": true
}

Check Feature Flag

GET /api/flags/FLAG_ID

Check if a specific feature flag is enabled for a user

curl -X GET 'https://myflags.io/api/flags/FLAG_ID' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'x-api-env: development' \
  -H 'x-api-project: YOUR_PROJECT_KEY'
{
  "enabled": true
}

Update Feature Flag

PATCH /api/flags/FLAG_ID

Update a feature flag's configuration

curl -X PATCH 'https://myflags.io/api/flags/FLAG_ID' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "enabled": true
  }'
{
  "enabled": true
}

Error Handling

The API uses standard HTTP status codes to indicate success or failure:

  • • 200: Success
  • • 400: Bad Request
  • • 401: Unauthorized
  • • 403: Forbidden
  • • 404: Not Found
  • • 429: Too Many Requests
  • • 500: Server Error

Rate Limiting

API requests are limited to:

  • • 100 requests per minute for free tier
  • • 1000 requests per minute for paid tier
  • • 10000 requests per minute for enterprise tier