Skip to main content
POST
/
v1
/
api
/
add_schedule_rule
curl -X POST "https://api.hookpulse.io/v1/api/add_schedule_rule/" \
  -H "x-hookpulse-api-key: {{x-hookpulse-api-key}}" \
  -H "x-brand-uuid: {{x-brand-uuid}}" \
  -H "Content-Type: application/json" \
  -d '{
    "schedule_uuid": "{{schedule_uuid}}",
    "rule_type": "{{rule_type}}",
    "start_time": "{{start_time}}",
    "end_time": "{{end_time}}",
    "timezone": "{{timezone}}",
    "allow_days": {{allow_days}},
    "allow_months": {{allow_months}},
    "exclusion_dates": {{exclusion_dates}},
    "solar_start_event": "{{solar_start_event}}",
    "solar_end_event": "{{solar_end_event}}",
    "solar_lat": "{{solar_lat}}",
    "solar_long": "{{solar_long}}",
    "max_run_to_terminate_after": {{max_run_to_terminate_after}},
    "expire_at": {{expire_at}}
  }'
{
  "success": true,
  "details": "Schedule rule added successfully"
}
Add a rule to an existing schedule to control execution conditions, exclusions, and termination criteria. Rules allow you to create complex scheduling patterns with time windows, calendar restrictions, exclusions, and automatic termination.

Base URL

All API requests should be made to:
https://api.hookpulse.io

Example request

curl -X POST "https://api.hookpulse.io/v1/api/add_schedule_rule/" \
  -H "x-hookpulse-api-key: {{x-hookpulse-api-key}}" \
  -H "x-brand-uuid: {{x-brand-uuid}}" \
  -H "Content-Type: application/json" \
  -d '{
    "schedule_uuid": "{{schedule_uuid}}",
    "rule_type": "{{rule_type}}",
    "start_time": "{{start_time}}",
    "end_time": "{{end_time}}",
    "timezone": "{{timezone}}",
    "allow_days": {{allow_days}},
    "allow_months": {{allow_months}},
    "exclusion_dates": {{exclusion_dates}},
    "solar_start_event": "{{solar_start_event}}",
    "solar_end_event": "{{solar_end_event}}",
    "solar_lat": "{{solar_lat}}",
    "solar_long": "{{solar_long}}",
    "max_run_to_terminate_after": {{max_run_to_terminate_after}},
    "expire_at": {{expire_at}}
  }'

Request body

FieldTypeRequiredDescription
schedule_uuidstringYesUUID of the schedule to add the rule to
rule_typestringYesType of rule: "time_window", "calendar_window", "solar_window", "exclusion", or "termination"
start_timestringConditionalStart time for time window rules (format: "HH:mm:ss")
end_timestringConditionalEnd time for time window rules (format: "HH:mm:ss")
timezonestringConditionalTimezone for time window rules (IANA timezone identifier)
allow_daysarrayConditionalArray of day numbers (1-31) for calendar window rules
allow_monthsarrayConditionalArray of month numbers (1-12) for calendar window rules
exclusion_datesarrayConditionalArray of dates to exclude (format: "YYYY-MM-DD") for exclusion rules
solar_start_eventstringConditionalSolar event for start of solar window (e.g., "sunrise", "sunset")
solar_end_eventstringConditionalSolar event for end of solar window
solar_latstringConditionalLatitude for solar window rules (decimal degrees)
solar_longstringConditionalLongitude for solar window rules (decimal degrees)
max_run_to_terminate_afterintegerConditionalMaximum number of runs before termination (for termination rules)
expire_atstring | nullConditionalISO 8601 datetime when schedule should expire (for termination rules)

Example response

{
  "success": true,
  "details": "Schedule rule added successfully"
}

Response fields

FieldTypeDescription
successbooleanIndicates if the rule was added successfully
detailsstringSuccess 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
Example:
{
  "schedule_uuid": "{{schedule_uuid}}",
  "rule_type": "time_window",
  "start_time": "09:00:00",
  "end_time": "17:00:00",
  "timezone": "America/New_York",
  "allow_days": [],
  "allow_months": [],
  "exclusion_dates": [],
  "solar_start_event": "",
  "solar_end_event": "",
  "solar_lat": "",
  "solar_long": "",
  "max_run_to_terminate_after": null,
  "expire_at": null
}

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 15th
  • allow_months: Array of month numbers (1-12), optional
Example:
{
  "schedule_uuid": "{{schedule_uuid}}",
  "rule_type": "calendar_window",
  "start_time": "",
  "end_time": "",
  "timezone": "",
  "allow_days": [1, 15],
  "allow_months": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
  "exclusion_dates": [],
  "solar_start_event": "",
  "solar_end_event": "",
  "solar_lat": "",
  "solar_long": "",
  "max_run_to_terminate_after": null,
  "expire_at": null
}

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 degrees
  • solar_long: Longitude in decimal degrees
Example:
{
  "schedule_uuid": "{{schedule_uuid}}",
  "rule_type": "solar_window",
  "start_time": "",
  "end_time": "",
  "timezone": "",
  "allow_days": [],
  "allow_months": [],
  "exclusion_dates": [],
  "solar_start_event": "civil_dawn",
  "solar_end_event": "civil_dusk",
  "solar_lat": "40.7128",
  "solar_long": "-74.0060",
  "max_run_to_terminate_after": null,
  "expire_at": null
}

4. Exclusion Rule

Exclude specific dates from execution: Required Fields:
  • rule_type: "exclusion"
  • exclusion_dates: Array of dates in "YYYY-MM-DD" format
Example:
{
  "schedule_uuid": "{{schedule_uuid}}",
  "rule_type": "exclusion",
  "start_time": "",
  "end_time": "",
  "timezone": "",
  "allow_days": [],
  "allow_months": [],
  "exclusion_dates": ["2024-12-25", "2025-01-01"],
  "solar_start_event": "",
  "solar_end_event": "",
  "solar_lat": "",
  "solar_long": "",
  "max_run_to_terminate_after": null,
  "expire_at": null
}

5. Termination Rule

Automatically stop schedule after conditions are met: Required Fields:
  • rule_type: "termination"
  • Either max_run_to_terminate_after OR expire_at (or both)
Example (Max Runs):
{
  "schedule_uuid": "{{schedule_uuid}}",
  "rule_type": "termination",
  "start_time": "",
  "end_time": "",
  "timezone": "",
  "allow_days": [],
  "allow_months": [],
  "exclusion_dates": [],
  "solar_start_event": "",
  "solar_end_event": "",
  "solar_lat": "",
  "solar_long": "",
  "max_run_to_terminate_after": 100,
  "expire_at": null
}
Example (Expiration Date):
{
  "schedule_uuid": "{{schedule_uuid}}",
  "rule_type": "termination",
  "start_time": "",
  "end_time": "",
  "timezone": "",
  "allow_days": [],
  "allow_months": [],
  "exclusion_dates": [],
  "solar_start_event": "",
  "solar_end_event": "",
  "solar_lat": "",
  "solar_long": "",
  "max_run_to_terminate_after": null,
  "expire_at": "2025-12-31T23:59:59Z"
}
Example (Both):
{
  "schedule_uuid": "{{schedule_uuid}}",
  "rule_type": "termination",
  "start_time": "",
  "end_time": "",
  "timezone": "",
  "allow_days": [],
  "allow_months": [],
  "exclusion_dates": [],
  "solar_start_event": "",
  "solar_end_event": "",
  "solar_lat": "",
  "solar_long": "",
  "max_run_to_terminate_after": 5,
  "expire_at": null
}

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)

{
  "schedule_uuid": "{{schedule_uuid}}",
  "rule_type": "time_window",
  "start_time": "09:00:00",
  "end_time": "17:00:00",
  "timezone": "America/New_York",
  "allow_days": [],
  "allow_months": [],
  "exclusion_dates": [],
  "solar_start_event": "",
  "solar_end_event": "",
  "solar_lat": "",
  "solar_long": "",
  "max_run_to_terminate_after": null,
  "expire_at": null
}

Monthly on 1st and 15th (Calendar Window)

{
  "schedule_uuid": "{{schedule_uuid}}",
  "rule_type": "calendar_window",
  "start_time": "",
  "end_time": "",
  "timezone": "",
  "allow_days": [1, 15],
  "allow_months": [],
  "exclusion_dates": [],
  "solar_start_event": "",
  "solar_end_event": "",
  "solar_lat": "",
  "solar_long": "",
  "max_run_to_terminate_after": null,
  "expire_at": null
}

Exclude Holidays (Exclusion)

{
  "schedule_uuid": "{{schedule_uuid}}",
  "rule_type": "exclusion",
  "start_time": "",
  "end_time": "",
  "timezone": "",
  "allow_days": [],
  "allow_months": [],
  "exclusion_dates": ["2024-12-25", "2025-01-01", "2025-07-04"],
  "solar_start_event": "",
  "solar_end_event": "",
  "solar_lat": "",
  "solar_long": "",
  "max_run_to_terminate_after": null,
  "expire_at": null
}

Daylight Hours Only (Solar Window)

{
  "schedule_uuid": "{{schedule_uuid}}",
  "rule_type": "solar_window",
  "start_time": "",
  "end_time": "",
  "timezone": "",
  "allow_days": [],
  "allow_months": [],
  "exclusion_dates": [],
  "solar_start_event": "civil_dawn",
  "solar_end_event": "civil_dusk",
  "solar_lat": "40.7128",
  "solar_long": "-74.0060",
  "max_run_to_terminate_after": null,
  "expire_at": null
}

Stop After 100 Runs (Termination)

{
  "schedule_uuid": "{{schedule_uuid}}",
  "rule_type": "termination",
  "start_time": "",
  "end_time": "",
  "timezone": "",
  "allow_days": [],
  "allow_months": [],
  "exclusion_dates": [],
  "solar_start_event": "",
  "solar_end_event": "",
  "solar_lat": "",
  "solar_long": "",
  "max_run_to_terminate_after": 100,
  "expire_at": null
}

Expire at Year End (Termination)

{
  "schedule_uuid": "{{schedule_uuid}}",
  "rule_type": "termination",
  "start_time": "",
  "end_time": "",
  "timezone": "",
  "allow_days": [],
  "allow_months": [],
  "exclusion_dates": [],
  "solar_start_event": "",
  "solar_end_event": "",
  "solar_lat": "",
  "solar_long": "",
  "max_run_to_terminate_after": null,
  "expire_at": "2025-12-31T23:59:59Z"
}

Authorizations

x-hookpulse-api-key
string
header
required

API key for authentication. Get this from your dashboard by selecting a brand and going to API Keys section.

x-brand-uuid
string
header
required

Brand UUID for authentication. Get this from your dashboard after adding a brand - it will be displayed in the UI.

Body

application/json

Schedule rule configuration

schedule_uuid
string
required

UUID of the schedule to add the rule to

rule_type
enum<string>
required

Type of rule

Available options:
time_window,
calendar_window,
solar_window,
exclusion,
termination
start_time
string<time>

Start time for time window rules (format: HH:mm:ss)

end_time
string<time>

End time for time window rules (format: HH:mm:ss)

timezone
string

Timezone for time window rules (IANA timezone identifier)

allow_days
integer[]

Array of day numbers (1-31) for calendar window rules

Required range: 1 <= x <= 31
allow_months
integer[]

Array of month numbers (1-12) for calendar window rules

Required range: 1 <= x <= 12
exclusion_dates
string<date>[]

Array of dates to exclude (format: YYYY-MM-DD) for exclusion rules

solar_start_event
enum<string>

Solar event for start of solar window

Available options:
sunrise,
sunset,
civil_dawn,
civil_dusk,
nautical_dawn,
nautical_dusk,
astronomical_dawn,
astronomical_dusk
solar_end_event
enum<string>

Solar event for end of solar window

Available options:
sunrise,
sunset,
civil_dawn,
civil_dusk,
nautical_dawn,
nautical_dusk,
astronomical_dawn,
astronomical_dusk
solar_lat
string

Latitude for solar window rules (decimal degrees)

solar_long
string

Longitude for solar window rules (decimal degrees)

max_run_to_terminate_after
integer

Maximum number of runs before termination (for termination rules)

expire_at
string<date-time> | null

ISO 8601 datetime when schedule should expire (for termination rules)

Response

Rule added successfully

success
boolean

Indicates if the schedule was created successfully

details
string

Success message