Execute Actions
Managing Schedules
Create, list, retrieve, update, pause, resume, and delete schedules.
This guide explains how to create, list, retrieve, update, pause, resume, and delete schedules using the Captain Data API.
Creating a Schedule
- Use the API to schedule an action by calling the appropriate action’s
/schedule
endpoint (e.g.,/v4/api/actions/{action-name}/schedule
). - You can schedule a one-time run in the future, or set up a recurring schedule using a cron expression.
Parameters:
inputs
: The inputs for your action (array).callback
: Object with aurl
(required) to receive results.cron
: (optional) POSIX cron expression for recurring schedules.schedule_at
: (optional) ISO8601 date-time for a one-shot schedule.timezone
: (optional) IANA timezone string (e.g., “Europe/Paris”).
Example: Create a recurring schedule
Example: Create a one-time schedule
Creating CRON Expressions
A CRON expression is a string used to define the schedule for recurring jobs. It consists of five fields separated by spaces, representing:
- Minute (0-59)
- Hour (0-23)
- Day of month (1-31)
- Month (1-12)
- Day of week (0-6, where 0 = Sunday)
Examples:
0 9 * * 1-5
— Every weekday (Monday to Friday) at 9:00 AM30 2 * * *
— Every day at 2:30 AM0 0 1 * *
— On the first day of every month at midnight*/15 * * * *
— Every 15 minutes
You can use online tools like crontab.guru to build and test your CRON expressions.
Listing Schedules
- Use
GET /v4/api/schedules
to retrieve all schedules. - You can filter by
status
,action_name
,user_uid
,workspace_uid
, and more. Pagination is supported vialimit
andoffset
. Sorting is available using thesort
parameter (prefix with-
for descending order).
Example: List all active schedules for a workspace
When using the sandbox, the workspace UID will be different from your main workspace.
Getting a Specific Schedule
- Use
GET /v4/api/schedules/{schedule_uid}
with the schedule UID to fetch details.
Example: Get a schedule by UID
Managing a Schedule (Pause, Resume, Cancel)
- Use
POST /v4/api/schedules/{schedule_uid}/{action}
to update a schedule’s status. - Actions:
pause
,resume
,cancel
.
Example: Pause a schedule
Example: Resume a schedule
Example: Cancel (delete) a schedule
Updating a Schedule
- To update timing or inputs, cancel the existing schedule and create a new one with the desired parameters.
See the API Reference for detailed endpoint usage, parameters, and more examples.