Add Schedule Rule
Add a rule to an existing schedule to control execution conditions, exclusions, and termination criteria
Base URL
All API requests should be made to:Example request
Request body
| Field | Type | Required | Description |
|---|---|---|---|
schedule_uuid | string | Yes | UUID of the schedule to add the rule to |
rule_type | string | Yes | Type of rule: "time_window", "calendar_window", "solar_window", "exclusion", or "termination" |
start_time | string | Conditional | Start time for time window rules (format: "HH:mm:ss") |
end_time | string | Conditional | End time for time window rules (format: "HH:mm:ss") |
timezone | string | Conditional | Timezone for time window rules (IANA timezone identifier) |
allow_days | array | Conditional | Array of day numbers (1-31) for calendar window rules |
allow_months | array | Conditional | Array of month numbers (1-12) for calendar window rules |
exclusion_dates | array | Conditional | Array of dates to exclude (format: "YYYY-MM-DD") for exclusion rules |
solar_start_event | string | Conditional | Solar event for start of solar window (e.g., "sunrise", "sunset") |
solar_end_event | string | Conditional | Solar event for end of solar window |
solar_lat | string | Conditional | Latitude for solar window rules (decimal degrees) |
solar_long | string | Conditional | Longitude for solar window rules (decimal degrees) |
max_run_to_terminate_after | integer | Conditional | Maximum number of runs before termination (for termination rules) |
expire_at | string | null | Conditional | ISO 8601 datetime when schedule should expire (for termination rules) |
Example response
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates if the rule was added successfully |
details | string | Success message |
Rule Types
1. Time Window Rule
Restrict execution to specific time ranges: Required Fields:rule_type:"time_window"start_time: Start time (e.g.,"09:00:00")end_time: End time (e.g.,"17:00:00")timezone: IANA timezone identifier
2. Calendar Window Rule
Restrict execution to specific days and months: Required Fields:rule_type:"calendar_window"allow_days: Array of day numbers (1-31), e.g.,[1, 15]for 1st and 15thallow_months: Array of month numbers (1-12), optional
3. Solar Window Rule
Restrict execution to solar event windows: Required Fields:rule_type:"solar_window"solar_start_event: Solar event for start (e.g.,"civil_dawn")solar_end_event: Solar event for end (e.g.,"civil_dusk")solar_lat: Latitude in decimal degreessolar_long: Longitude in decimal degrees
4. Exclusion Rule
Exclude specific dates from execution: Required Fields:rule_type:"exclusion"exclusion_dates: Array of dates in"YYYY-MM-DD"format
5. Termination Rule
Automatically stop schedule after conditions are met: Required Fields:rule_type:"termination"- Either
max_run_to_terminate_afterORexpire_at(or both)
Solar Event Options
For solar window rules, valid solar events are:"sunrise"- When the sun appears above the horizon"sunset"- When the sun disappears below the horizon"civil_dawn"- Morning when the sun is 6° below the horizon"civil_dusk"- Evening when the sun is 6° below the horizon"nautical_dawn"- Morning when the sun is 12° below the horizon"nautical_dusk"- Evening when the sun is 12° below the horizon"astronomical_dawn"- Morning when the sun is 18° below the horizon"astronomical_dusk"- Evening when the sun is 18° below the horizon
Use Cases
- Business Hours: Use time window rules to execute only during business hours
- Monthly Billing: Use calendar window rules to execute on specific days (e.g., 1st and 15th)
- Holiday Exclusions: Use exclusion rules to skip execution on holidays
- Daylight Operations: Use solar window rules for operations that should only run during daylight
- Limited Runs: Use termination rules to automatically stop after N executions
- Temporary Schedules: Use expiration rules to automatically stop schedules at specific dates
Examples
Business Hours Only (Time Window)
Monthly on 1st and 15th (Calendar Window)
Exclude Holidays (Exclusion)
Daylight Hours Only (Solar Window)
Stop After 100 Runs (Termination)
Expire at Year End (Termination)
Related Documentation
- Scheduling Overview - Learn about scheduling types and rule engine
- Add Interval Schedule - Create interval-based schedules
- Add Cron Schedule - Create cron-based schedules
- Get Active Schedules (Paginated) - View all schedules with filters
Authorizations
API key for authentication. Get this from your dashboard by selecting a brand and going to API Keys section.
Brand UUID for authentication. Get this from your dashboard after adding a brand - it will be displayed in the UI.
Body
Schedule rule configuration
UUID of the schedule to add the rule to
Type of rule
time_window, calendar_window, solar_window, exclusion, termination Start time for time window rules (format: HH:mm:ss)
End time for time window rules (format: HH:mm:ss)
Timezone for time window rules (IANA timezone identifier)
Array of day numbers (1-31) for calendar window rules
1 <= x <= 31Array of month numbers (1-12) for calendar window rules
1 <= x <= 12Array of dates to exclude (format: YYYY-MM-DD) for exclusion rules
Solar event for start of solar window
sunrise, sunset, civil_dawn, civil_dusk, nautical_dawn, nautical_dusk, astronomical_dawn, astronomical_dusk Solar event for end of solar window
sunrise, sunset, civil_dawn, civil_dusk, nautical_dawn, nautical_dusk, astronomical_dawn, astronomical_dusk Latitude for solar window rules (decimal degrees)
Longitude for solar window rules (decimal degrees)
Maximum number of runs before termination (for termination rules)
ISO 8601 datetime when schedule should expire (for termination rules)

