POST
/
api
/
v1
/
workflow
/
public
/
scheduled
curl --request POST \
  --url https://api.gocobalt.io/api/v1/workflow/public/scheduled \
  --header 'Content-Type: application/json' \
  --header 'linked_account_id: <linked_account_id>' \
  --header 'slug: <slug>' \
  --header 'workflow_id_alias: <workflow_id_alias>' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "trigger_type": "<string>",
  "payload": {},
  "regex": "*/6 * * * *",
  "currentDate": "YYYY-MM-DD",
  "tz": "Asia/Kolkata",
  "endDate": "YYYY-MM-DD",
  "startDate": "YYYY-MM-DD",
  "interval_dates": [
        {
            "date": {
                "day": 23,
                "month": 1,
                "year": 2025
            },
            "tz": "Asia/Kolkata"
        }
    ]
}'
{
    "_id": "67becf62f29636d291eaadc0",
    "event_id": "67becf62f29636d291eaadbf",
    "workflow": "663c73e4608a784bacac384a",
    "linked_account_id": "tim-cook",
    "environment": "test",
    "org_id": "65c9ef72f4b95fce32e8ccf8",
    "cron_patten": "*/6 * * * *",
    "inactive": false,
    "registered_by_api": true,
    "options": {
        "currentDate": "2025-02-26",
        "endDate": "2025-02-28",
        "startDate": "2025-02-27",
        "tz": "Asia/Kolkata"
    },
    "trigger_type": "cron",
    "trigger_interval": [],
    "schedule_added_at": "2025-02-26T08:22:58.080Z",
    "updatedAt": "2025-02-26T08:22:58.080Z"
}

This API registers a cron schedule for a workflow.

Request description

Headers

linked_account_id
string
required

Unique customer identification id. For Eg: markwood@some_email.com

slug
string
required

Application slug. For Eg: slack

workflow_id_alias
string
required

Workflow ID or the Workflow alias.

Body

trigger_type
string
required

The type of schedule trigger you want to set. Options are either cron or interval.

Based on the trigger_type provided, Request Body differs.

payload
object
required

Event Payload to be sent during workflow execution. Required in both trigger types.

regex
string
required

Cron expression. For Eg: */6 * * * *. Required in cron trigger type.

currentDate
string
required

Date currently. for Eg: 2025-01-15. Required in cron trigger type.

tz
string
required

Time Zone for the cron job. For Eg: Asia/Kolkata. Required in cron trigger type.

endDate
string
required

End Date for the cron job. For Eg: 2025-01-19. Required in cron trigger type.

startDate
string
required

Start date of the cron job. for Eg: 2025-01-16. Required in cron trigger type.

interval_dates
array
required

The dates in which schedule needs to be executed.Required in interval trigger type.

curl --request POST \
  --url https://api.gocobalt.io/api/v1/workflow/public/scheduled \
  --header 'Content-Type: application/json' \
  --header 'linked_account_id: <linked_account_id>' \
  --header 'slug: <slug>' \
  --header 'workflow_id_alias: <workflow_id_alias>' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "trigger_type": "<string>",
  "payload": {},
  "regex": "*/6 * * * *",
  "currentDate": "YYYY-MM-DD",
  "tz": "Asia/Kolkata",
  "endDate": "YYYY-MM-DD",
  "startDate": "YYYY-MM-DD",
  "interval_dates": [
        {
            "date": {
                "day": 23,
                "month": 1,
                "year": 2025
            },
            "tz": "Asia/Kolkata"
        }
    ]
}'

Response description

_id
string

ID of the registered cron

event_id
string

Event ID

workflow
string

ID or Alias of the workflow

linked_account_id
string

Linked Account ID for which cron is registered

environment
string

Environment in which cron registered

org_id
string

Organization id

cron_pattern
string

Cron Pattern used for schedule register.

inactive
boolean

The schedule is inactive or not.

registered_by_api
boolean

Whether the cron is registered using API.

options
object

Cron body sent in the request

trigger_interval
array

Array of the interval dates for which the schedule is registered. It is empty if cron trigger_type is used.

schedule_added_at
string

Timestamp when schedule was added

updatedAt
string

Timestamp of schedule updation.

{
    "_id": "67becf62f29636d291eaadc0",
    "event_id": "67becf62f29636d291eaadbf",
    "workflow": "663c73e4608a784bacac384a",
    "linked_account_id": "tim-cook",
    "environment": "test",
    "org_id": "65c9ef72f4b95fce32e8ccf8",
    "cron_patten": "*/6 * * * *",
    "inactive": false,
    "registered_by_api": true,
    "options": {
        "currentDate": "2025-02-26",
        "endDate": "2025-02-28",
        "startDate": "2025-02-27",
        "tz": "Asia/Kolkata"
    },
    "trigger_type": "cron",
    "trigger_interval": [],
    "schedule_added_at": "2025-02-26T08:22:58.080Z",
    "updatedAt": "2025-02-26T08:22:58.080Z"
}