Closed Beta — Aira is currently invite-only. Request access to join the early program.
Aira

Feature Flags

Resolve, toggle, and manage feature flags for organizations and platform-wide rollouts.

All endpoints require a Bearer token (Authorization: Bearer aira_live_xxxxx) unless noted otherwise. Base URL: https://api.airaproof.com/api/v1

The feature flags API has two sets of endpoints:

  • Org routes (/api/v1/feature-flags/...) -- authenticated with a Bearer token, scoped to the caller's organization.
  • Admin routes (/api/v1/admin/feature-flags/...) -- require the X-Admin-Key header for superadmin access.

Get Org Flags

GET /api/v1/feature-flags
Authorization: Bearer aira_live_xxxxx

Returns all feature flags resolved for the authenticated organization. Each flag is evaluated using three-tier resolution: per-org override, global enablement with rollout percentage, and self-hosted environment variable fallback.

Example Request

curl https://api.airaproof.com/api/v1/feature-flags \
  -H "Authorization: Bearer aira_live_xxxxx"

Response (200 OK)

{
  "flags": {
    "advanced_drift": true,
    "beta_dashboard": false,
    "consensus_v2": true
  },
  "request_id": "req_01J9E..."
}

Response Fields

FieldTypeDescription
flagsobjectMap of flag keys to their resolved boolean values for the current org
request_idstringRequest ID for tracing

Toggle Flag for Org

PUT /api/v1/feature-flags/{key}
Authorization: Bearer aira_live_xxxxx

Enables or disables a beta feature flag for the authenticated organization. Requires the org admin role. If the flag does not exist yet (common on self-hosted instances), enabling it will create it automatically.

Path Parameters

ParameterTypeRequiredDescription
keystringYesThe feature flag key

Request Body

FieldTypeRequiredDescription
enabledbooleanYesWhether to enable (true) or disable (false) the flag for this org

Example Request

curl -X PUT https://api.airaproof.com/api/v1/feature-flags/beta_dashboard \
  -H "Authorization: Bearer aira_live_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true
  }'

Response (200 OK)

{
  "key": "beta_dashboard",
  "enabled": true,
  "request_id": "req_01J9F..."
}

Response Fields

FieldTypeDescription
keystringThe feature flag key
enabledbooleanThe new state of the flag for this org
request_idstringRequest ID for tracing

List All Flags (Admin)

GET /api/v1/admin/feature-flags
X-Admin-Key: <admin_api_key>

Returns all feature flags in the system. Requires the X-Admin-Key header.

Example Request

curl https://api.airaproof.com/api/v1/admin/feature-flags \
  -H "X-Admin-Key: your-admin-key"

Response (200 OK)

[
  {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "key": "advanced_drift",
    "description": "Enable advanced drift detection with KL divergence",
    "enabled_global": true,
    "rollout_percentage": 100,
    "enabled_org_ids": [],
    "created_at": "2026-06-01T12:00:00+00:00",
    "updated_at": "2026-06-15T09:30:00+00:00"
  },
  {
    "id": "660e8400-e29b-41d4-a716-446655440001",
    "key": "beta_dashboard",
    "description": "New dashboard UI beta",
    "enabled_global": false,
    "rollout_percentage": 100,
    "enabled_org_ids": ["org_01J9A...", "org_01J9B..."],
    "created_at": "2026-06-10T08:00:00+00:00",
    "updated_at": "2026-06-10T08:00:00+00:00"
  }
]

Create Flag (Admin)

POST /api/v1/admin/feature-flags
X-Admin-Key: <admin_api_key>

Creates a new feature flag. The key must be unique and match the pattern ^[a-z][a-z0-9_]{1,98}[a-z0-9]$ (lowercase letters, digits, and underscores; 3--100 characters; must start with a letter and end with a letter or digit).

Request Body

FieldTypeRequiredDescription
keystringYesUnique flag key (lowercase, underscores allowed, 3--100 chars)
descriptionstringNoHuman-readable description
enabled_globalbooleanNoWhether the flag is globally enabled (default: false)
rollout_percentageintegerNoPercentage of orgs to roll out to when globally enabled, 0--100 (default: 100)
enabled_org_idsstring[]NoList of org UUIDs to explicitly enable the flag for (default: [])

Example Request

curl -X POST https://api.airaproof.com/api/v1/admin/feature-flags \
  -H "X-Admin-Key: your-admin-key" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "consensus_v2",
    "description": "V2 consensus scoring algorithm",
    "enabled_global": false,
    "rollout_percentage": 50,
    "enabled_org_ids": ["org_01J9A..."]
  }'

Response (201 Created)

{
  "id": "770e8400-e29b-41d4-a716-446655440002",
  "key": "consensus_v2",
  "description": "V2 consensus scoring algorithm",
  "enabled_global": false,
  "rollout_percentage": 50,
  "enabled_org_ids": ["org_01J9A..."],
  "created_at": "2026-07-01T10:00:00+00:00",
  "updated_at": "2026-07-01T10:00:00+00:00"
}

Error Codes

StatusDescription
409A flag with this key already exists

Update Flag (Admin)

PUT /api/v1/admin/feature-flags/{key}
X-Admin-Key: <admin_api_key>

Updates an existing feature flag. Only the fields you provide will be changed; omitted fields are left unchanged.

Path Parameters

ParameterTypeRequiredDescription
keystringYesThe feature flag key

Request Body

FieldTypeRequiredDescription
descriptionstringNoUpdated description
enabled_globalbooleanNoUpdated global enablement
rollout_percentageintegerNoUpdated rollout percentage (0--100)
enabled_org_idsstring[]NoUpdated list of explicitly enabled org UUIDs (replaces the existing list)

Example Request

curl -X PUT https://api.airaproof.com/api/v1/admin/feature-flags/consensus_v2 \
  -H "X-Admin-Key: your-admin-key" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled_global": true,
    "rollout_percentage": 25
  }'

Response (200 OK)

{
  "id": "770e8400-e29b-41d4-a716-446655440002",
  "key": "consensus_v2",
  "description": "V2 consensus scoring algorithm",
  "enabled_global": true,
  "rollout_percentage": 25,
  "enabled_org_ids": ["org_01J9A..."],
  "created_at": "2026-07-01T10:00:00+00:00",
  "updated_at": "2026-07-05T14:00:00+00:00"
}

Error Codes

StatusDescription
404Flag not found

Delete Flag (Admin)

DELETE /api/v1/admin/feature-flags/{key}
X-Admin-Key: <admin_api_key>

Deletes a feature flag. If the flag does not exist, the request completes silently.

Path Parameters

ParameterTypeRequiredDescription
keystringYesThe feature flag key

Example Request

curl -X DELETE https://api.airaproof.com/api/v1/admin/feature-flags/consensus_v2 \
  -H "X-Admin-Key: your-admin-key"

Response (204 No Content)

No response body.


Enable Flag for Org (Admin)

POST /api/v1/admin/feature-flags/{key}/enable-org/{org_uuid}
X-Admin-Key: <admin_api_key>

Adds an organization to a flag's enabled_org_ids list. This is an additive operation -- existing org IDs are preserved.

Path Parameters

ParameterTypeRequiredDescription
keystringYesThe feature flag key
org_uuidstringYesThe UUID of the organization to enable

Example Request

curl -X POST https://api.airaproof.com/api/v1/admin/feature-flags/beta_dashboard/enable-org/org_01J9C... \
  -H "X-Admin-Key: your-admin-key"

Response (200 OK)

{
  "id": "660e8400-e29b-41d4-a716-446655440001",
  "key": "beta_dashboard",
  "description": "New dashboard UI beta",
  "enabled_global": false,
  "rollout_percentage": 100,
  "enabled_org_ids": ["org_01J9A...", "org_01J9B...", "org_01J9C..."],
  "created_at": "2026-06-10T08:00:00+00:00",
  "updated_at": "2026-07-05T15:00:00+00:00"
}

Error Codes

StatusDescription
404Flag not found

Disable Flag for Org (Admin)

POST /api/v1/admin/feature-flags/{key}/disable-org/{org_uuid}
X-Admin-Key: <admin_api_key>

Removes an organization from a flag's enabled_org_ids list.

Path Parameters

ParameterTypeRequiredDescription
keystringYesThe feature flag key
org_uuidstringYesThe UUID of the organization to disable

Example Request

curl -X POST https://api.airaproof.com/api/v1/admin/feature-flags/beta_dashboard/disable-org/org_01J9C... \
  -H "X-Admin-Key: your-admin-key"

Response (200 OK)

{
  "id": "660e8400-e29b-41d4-a716-446655440001",
  "key": "beta_dashboard",
  "description": "New dashboard UI beta",
  "enabled_global": false,
  "rollout_percentage": 100,
  "enabled_org_ids": ["org_01J9A...", "org_01J9B..."],
  "created_at": "2026-06-10T08:00:00+00:00",
  "updated_at": "2026-07-05T15:30:00+00:00"
}

Error Codes

StatusDescription
404Flag not found

Flag Response Object

All admin endpoints that return a flag use this shape:

FieldTypeDescription
idstringFlag UUID
keystringUnique flag key
descriptionstring | nullHuman-readable description
enabled_globalbooleanWhether the flag is globally enabled
rollout_percentageintegerPercentage of orgs included in global rollout (0--100)
enabled_org_idsstring[]Org UUIDs explicitly enabled regardless of global/rollout state
created_atstringCreation timestamp (ISO 8601)
updated_atstringLast update timestamp (ISO 8601)

Flag Resolution Logic

When resolving a flag for a specific organization, the system uses three-tier resolution:

  1. Per-org override -- if the org's UUID is in enabled_org_ids, the flag is true.
  2. Global + rollout -- if enabled_global is true, a deterministic hash of the org UUID is checked against rollout_percentage to decide inclusion.
  3. Self-hosted fallback -- on self-hosted deployments, if the flag does not exist in the database, the environment variable ENABLE_{KEY} (uppercased) is checked.

On this page