Flag Scheduling
The Flag Scheduling system enables time-based automation of feature flag changes. The FlagSchedulingController at /api/v1/schedules supports one-time schedules, recurring schedules with cron expressions, and window-based schedules that automatically enable and disable flags within a time range.
Schedule Types
| Type | Description | Use Case |
|---|---|---|
| One-time | Execute once at a specific time | Scheduled feature launch |
| Recurring | Execute on a cron schedule | Weekly maintenance windows |
| Window | Enable at start, disable at end | Time-limited promotions |
Create a One-Time Schedule
Endpoint: POST /api/v1/schedules/one-time
curl -X POST http://localhost:8888/api/v1/schedules/one-time \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-H "X-Tenant-Id: 550e8400-e29b-41d4-a716-446655440000" \
-d '{
"flagId": "880e8400-e29b-41d4-a716-446655440000",
"name": "Launch New Dashboard",
"description": "Enable new dashboard feature at midnight Feb 15",
"action": "ENABLE",
"targetValue": "true",
"targetPercentage": 100,
"startTime": "2026-02-15T00:00:00Z",
"timezone": "America/New_York",
"metadata": { "ticket": "FEAT-1234" },
"createdBy": "550e8400-e29b-41d4-a716-446655440001"
}'Schedule Actions
| Action | Description |
|---|---|
ENABLE | Enable the feature flag |
DISABLE | Disable the feature flag |
SET_VALUE | Set the flag to a specific value |
SET_PERCENTAGE | Set the rollout percentage |
Create a Recurring Schedule
Endpoint: POST /api/v1/schedules/recurring
curl -X POST http://localhost:8888/api/v1/schedules/recurring \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-H "X-Tenant-Id: 550e8400-e29b-41d4-a716-446655440000" \
-d '{
"flagId": "880e8400-e29b-41d4-a716-446655440000",
"name": "Weekly Maintenance Window",
"description": "Disable feature during maintenance every Sunday 2-4 AM",
"action": "DISABLE",
"startTime": "2026-02-16T02:00:00Z",
"timezone": "America/New_York",
"cronExpression": "0 2 * * 0",
"recurrenceType": "WEEKLY",
"recurrenceInterval": 1,
"endDate": "2026-06-30T00:00:00Z",
"maxExecutions": 20,
"createdBy": "550e8400-e29b-41d4-a716-446655440001"
}'Create a Window Schedule
A window schedule enables a flag at startTime and automatically disables it at endTime.
Endpoint: POST /api/v1/schedules/window
curl -X POST http://localhost:8888/api/v1/schedules/window \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-H "X-Tenant-Id: 550e8400-e29b-41d4-a716-446655440000" \
-d '{
"flagId": "880e8400-e29b-41d4-a716-446655440000",
"name": "Black Friday Promotion",
"description": "Enable special pricing for Black Friday weekend",
"action": "ENABLE",
"targetValue": "true",
"startTime": "2026-11-27T00:00:00Z",
"endTime": "2026-11-30T23:59:59Z",
"timezone": "America/New_York",
"createdBy": "550e8400-e29b-41d4-a716-446655440001"
}'Manage Schedule Lifecycle
Pause: POST /api/v1/schedules/{scheduleId}/pause
Resume: POST /api/v1/schedules/{scheduleId}/resume
Cancel: POST /api/v1/schedules/{scheduleId}/cancel
Execute Now: POST /api/v1/schedules/{scheduleId}/execute
List Schedules
All schedules: GET /api/v1/schedules
For a flag: GET /api/v1/schedules/flag/{flagId}
Active schedules: GET /api/v1/schedules/flag/{flagId}/active
Upcoming: GET /api/v1/schedules/upcoming
Execution History
View past executions for a schedule.
Endpoint: GET /api/v1/schedules/{scheduleId}/executions
curl "http://localhost:8888/api/v1/schedules/sched-001/executions?page=0&size=20" \
-H "Authorization: Bearer ${TOKEN}"