Admin API
This endpoint requires admin-level roles (platform_admin, tenant_admin, or system_admin). Accessible via the API gateway at /v1/platform/*.
Feature Gating API
Control feature availability across the platform.
Overview
The Feature Gating API provides powerful feature management:
| Feature | Description |
|---|---|
| Feature Flags | Toggle features on/off |
| Gradual Rollout | Percentage-based deployment |
| A/B Testing | Experiment with variants |
| Targeting | User, tenant, location rules |
| Scheduling | Time-based activation |
Gate Model
{
"id": "gate-new-checkout",
"key": "new_checkout_flow",
"name": "New Checkout Flow",
"description": "Redesigned checkout experience",
"status": "partial",
"rollout_percentage": 25,
"variants": ["control", "variant_a"],
"created_at": "2026-01-10T10:00:00Z"
}
List Gates
Request
GET /api/v1/gates?status=active
Authorization: Bearer {access_token}
Query Parameters
| Parameter | Type | Description |
|---|---|---|
status | string | Filter by status |
category | string | Filter by category |
search | string | Search by name or key |
Response
{
"gates": [
{
"id": "gate-001",
"key": "new_checkout_flow",
"name": "New Checkout Flow",
"category": "checkout",
"status": "partial",
"rollout_percentage": 25,
"enabled_tenants": 45,
"total_evaluations_24h": 125000
},
{
"id": "gate-002",
"key": "ai_recommendations",
"name": "AI Menu Recommendations",
"category": "ai",
"status": "active",
"rollout_percentage": 100,
"enabled_tenants": 180
}
]
}
Get Gate
Request
GET /api/v1/gates/{gate_id}
Authorization: Bearer {access_token}
Response
{
"id": "gate-001",
"key": "new_checkout_flow",
"name": "New Checkout Flow",
"description": "Redesigned checkout experience with improved UX",
"category": "checkout",
"status": "partial",
"rollout_percentage": 25,
"targeting": {
"rules": [
{
"type": "tenant",
"operator": "in",
"values": ["tenant-beta1", "tenant-beta2"],
"enabled": true
},
{
"type": "location",
"operator": "tag_equals",
"values": ["beta_tester"],
"enabled": true
}
],
"default": false
},
"variants": [
{"key": "control", "weight": 50},
{"key": "variant_a", "weight": 50}
],
"schedule": {
"start_date": "2026-01-15T00:00:00Z",
"end_date": null,
"timezone": "America/Los_Angeles"
},
"metrics": {
"evaluations_24h": 125000,
"enabled_count": 31250,
"disabled_count": 93750
},
"created_at": "2026-01-10T10:00:00Z",
"updated_at": "2026-01-18T14:30:00Z"
}
Create Gate
Request
POST /api/v1/gates
Authorization: Bearer {access_token}
Content-Type: application/json
{
"key": "voice_ordering",
"name": "Voice Ordering",
"description": "Enable voice-based order taking",
"category": "ai",
"status": "disabled",
"targeting": {
"rules": [],
"default": false
}
}
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
key | string | Yes | Unique identifier (snake_case) |
name | string | Yes | Display name |
description | string | No | Description |
category | string | No | Category for organization |
status | string | Yes | Initial status |
targeting | object | No | Targeting rules |
Gate Status Values
| Status | Description |
|---|---|
disabled | Gate is off for everyone |
active | Gate is on for everyone |
partial | Gate uses targeting rules |
archived | Gate is archived |
Response
{
"id": "gate-new123",
"key": "voice_ordering",
"status": "disabled",
"created_at": "2026-01-18T12:00:00Z"
}
Update Gate
Request
PATCH /api/v1/gates/{gate_id}
Authorization: Bearer {access_token}
Content-Type: application/json
{
"name": "Updated Name",
"description": "Updated description"
}
Update Gate Status
Request
PUT /api/v1/gates/{gate_id}/status
Authorization: Bearer {access_token}
Content-Type: application/json
{
"status": "active"
}
Update Rollout Percentage
Gradually roll out a feature to a percentage of users.
Request
PUT /api/v1/gates/{gate_id}/rollout
Authorization: Bearer {access_token}
Content-Type: application/json
{
"percentage": 50,
"sticky": true
}
Parameters
| Field | Type | Description |
|---|---|---|
percentage | number | 0-100 rollout percentage |
sticky | boolean | Keep users in same group |
Update Targeting Rules
Request
PUT /api/v1/gates/{gate_id}/targeting
Authorization: Bearer {access_token}
Content-Type: application/json
{
"rules": [
{
"type": "tenant",
"operator": "in",
"values": ["tenant-abc123", "tenant-xyz789"],
"enabled": true
},
{
"type": "user",
"operator": "has_role",
"values": ["owner", "manager"],
"enabled": true
},
{
"type": "location",
"operator": "in_region",
"values": ["us-west"],
"enabled": true
}
],
"default": false
}
Targeting Rule Types
| Type | Operators | Description |
|---|---|---|
tenant | in, not_in | Match specific tenants |
user | in, has_role, email_domain | Match specific users |
location | in, in_region, tag_equals | Match locations |
percentage | random | Random percentage |
time | between, day_of_week | Time-based rules |
Enable for Tenant
Request
POST /api/v1/gates/{gate_id}/tenants
Authorization: Bearer {access_token}
Content-Type: application/json
{
"tenant_ids": ["tenant-abc123", "tenant-xyz789"]
}
Disable for Tenant
Request
DELETE /api/v1/gates/{gate_id}/tenants
Authorization: Bearer {access_token}
Content-Type: application/json
{
"tenant_ids": ["tenant-abc123"]
}
A/B Testing Variants
Set Variants
PUT /api/v1/gates/{gate_id}/variants
Authorization: Bearer {access_token}
Content-Type: application/json
{
"variants": [
{"key": "control", "weight": 50, "config": {}},
{"key": "variant_a", "weight": 25, "config": {"button_color": "blue"}},
{"key": "variant_b", "weight": 25, "config": {"button_color": "green"}}
]
}
Get Variant for User
GET /api/v1/gates/{gate_id}/variant?user_id=user-abc123
Authorization: Bearer {access_token}
Response
{
"gate_key": "new_checkout_flow",
"variant": "variant_a",
"config": {
"button_color": "blue"
}
}
Schedule Gate
Request
PUT /api/v1/gates/{gate_id}/schedule
Authorization: Bearer {access_token}
Content-Type: application/json
{
"start_date": "2026-02-01T00:00:00Z",
"end_date": "2026-02-28T23:59:59Z",
"timezone": "America/Los_Angeles",
"auto_enable": true,
"auto_disable": true
}
Evaluate Gate
Check if a gate is enabled for a specific context.
Request
POST /api/v1/gates/evaluate
Authorization: Bearer {access_token}
Content-Type: application/json
{
"gates": ["new_checkout_flow", "ai_recommendations", "voice_ordering"],
"context": {
"user_id": "user-abc123",
"tenant_id": "tenant-abc123",
"location_id": "loc-xyz789"
}
}
Response
{
"results": {
"new_checkout_flow": {
"enabled": true,
"variant": "variant_a",
"config": {"button_color": "blue"}
},
"ai_recommendations": {
"enabled": true,
"variant": null,
"config": {}
},
"voice_ordering": {
"enabled": false,
"variant": null,
"config": {}
}
},
"evaluated_at": "2026-01-18T12:00:00Z"
}
Bulk Evaluate
Evaluate multiple gates efficiently (for client initialization).
Request
POST /api/v1/gates/bulk-evaluate
Authorization: Bearer {access_token}
Content-Type: application/json
{
"context": {
"user_id": "user-abc123",
"tenant_id": "tenant-abc123",
"location_id": "loc-xyz789"
}
}
Response
{
"gates": {
"new_checkout_flow": true,
"ai_recommendations": true,
"voice_ordering": false,
"advanced_analytics": true,
"beta_features": false
},
"variants": {
"new_checkout_flow": "variant_a"
},
"config": {
"new_checkout_flow": {"button_color": "blue"}
},
"cache_ttl_seconds": 300
}
Gate Analytics
Get Metrics
GET /api/v1/gates/{gate_id}/analytics?period=7d
Authorization: Bearer {access_token}
Response
{
"gate_id": "gate-001",
"period": "7d",
"evaluations": {
"total": 875000,
"enabled": 218750,
"disabled": 656250,
"by_day": [
{"date": "2026-01-12", "enabled": 28000, "disabled": 84000},
{"date": "2026-01-13", "enabled": 30000, "disabled": 90000}
]
},
"variants": {
"control": {"evaluations": 109375, "conversions": 5468},
"variant_a": {"evaluations": 109375, "conversions": 6562}
},
"performance": {
"avg_evaluation_ms": 2.5,
"p99_evaluation_ms": 8.0
}
}
Copy Gate
Request
POST /api/v1/gates/{gate_id}/copy
Authorization: Bearer {access_token}
Content-Type: application/json
{
"key": "new_checkout_flow_v2",
"name": "New Checkout Flow V2"
}
Archive Gate
Request
POST /api/v1/gates/{gate_id}/archive
Authorization: Bearer {access_token}
Delete Gate
Request
DELETE /api/v1/gates/{gate_id}
Authorization: Bearer {access_token}
REST API Usage
Check Gate Status
# Evaluate a gate for the current user (JWT provides user/tenant context)
curl -s -X POST https://dev.api.olympuscloud.ai/v1/platform/gates/evaluate \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"gate_key": "new_checkout_flow",
"context": {
"location_id": "550e8400-e29b-41d4-a716-446655449110"
}
}' | jq .
JavaScript Example
const response = await fetch('https://dev.api.olympuscloud.ai/v1/platform/gates/evaluate', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
gate_key: 'new_checkout_flow',
context: { location_id: 'loc-xyz789' }
}),
});
const result = await response.json();
if (result.enabled) {
// Show new checkout
}
Python Example
import requests
resp = requests.post(
"https://dev.api.olympuscloud.ai/v1/platform/gates/evaluate",
headers={"Authorization": f"Bearer {token}"},
json={"gate_key": "new_checkout_flow", "context": {"location_id": "loc-xyz789"}}
)
result = resp.json()
if result["enabled"]:
# Show new checkout
pass
Error Responses
Gate Not Found (404)
{
"error": {
"code": "GATE_NOT_FOUND",
"message": "Gate does not exist"
}
}
Duplicate Key (409)
{
"error": {
"code": "DUPLICATE_KEY",
"message": "A gate with this key already exists"
}
}
Invalid Rule (400)
{
"error": {
"code": "INVALID_RULE",
"message": "Invalid targeting rule configuration"
}
}
Related Documentation
- Roles API - Role-based access
- Tenants API - Tenant management
- Analytics API - Feature analytics