Ruby SDKFeature Clients

Cron Client

Cron client for managing cron workflow triggers within Hatchet.

This class provides a high-level interface for creating, deleting, listing, and retrieving cron workflow triggers.

cron = hatchet.cron.create(
  workflow_name: "my-workflow",
  cron_name: "daily-run",
  expression: "0 0 * * *",
  input: { key: "value" },
  additional_metadata: { source: "api" }
)

It is available on the main client as hatchet.cron.

Methods:

NameDescription
createCreate a new workflow cron trigger.
deleteDelete a workflow cron trigger.
listList cron workflow triggers matching the specified criteria.
getRetrieve a specific workflow cron trigger by ID.

Functions

create

Create a new workflow cron trigger.

cron = hatchet.cron.create(
  workflow_name: "my-workflow",
  cron_name: "hourly-run",
  expression: "0 * * * *",
  input: { key: "value" },
  additional_metadata: { source: "api" }
)

Parameters:

NameTypeDescriptionDefault
workflow_nameStringThe name of the workflow to trigger (namespace will be applied)required
cron_nameStringThe name of the cron trigger.required
expressionStringThe cron expression defining the schedule.required
inputHashThe input data for the cron workflow.{}
additional_metadataHashAdditional metadata associated with the cron trigger.{}
priorityInteger | nilThe priority of the cron workflow trigger.nil

Returns:

TypeDescription
ObjectThe created cron workflow instance.

Raises:

TypeDescription
ArgumentErrorIf the cron expression is invalid.
HatchetSdkRest::ApiErrorIf the API request fails.

delete

Delete a workflow cron trigger.

hatchet.cron.delete("cron-123")

Parameters:

NameTypeDescriptionDefault
cron_idStringThe ID of the cron trigger to delete.required

Raises:

TypeDescription
HatchetSdkRest::ApiErrorIf the API request fails.

list

List cron workflow triggers matching the specified criteria.

crons = hatchet.cron.list(limit: 10, workflow_name: "my-workflow")

Parameters:

NameTypeDescriptionDefault
offsetInteger | nilThe offset to start the list from.nil
limitInteger | nilThe maximum number of items to return.nil
workflow_idString | nilThe ID of the workflow to filter by.nil
additional_metadataHash | nilFilter by additional metadata keys.nil
order_by_fieldString | nilThe field to order the list by.nil
order_by_directionString | nilThe direction to order the list by.nil
workflow_nameString | nilThe name of the workflow to filter by.nil
cron_nameString | nilThe name of the cron trigger to filter by.nil

Returns:

TypeDescription
ObjectA list of cron workflows.

Raises:

TypeDescription
HatchetSdkRest::ApiErrorIf the API request fails.

get

Retrieve a specific workflow cron trigger by ID.

cron = hatchet.cron.get("cron-123")

Parameters:

NameTypeDescriptionDefault
cron_idStringThe cron trigger ID to retrieve.required

Returns:

TypeDescription
ObjectThe requested cron workflow instance.

Raises:

TypeDescription
HatchetSdkRest::ApiErrorIf the API request fails.

Last updated on August 24, 2026

On this page