Docs
/
/

Schedules API reference

Complete reference documentation for the Schedules resource.

Schedules

#

A Schedule allows you to automatically trigger a workflow at a given time for one or more recipients. You can think of a schedule as a managed, recipient-timezone-aware cron job that Knock will run on your behalf.

Create schedules

#

Creates one or more schedules for a workflow with the specified recipients, timing, and data. Schedules can be one-time or recurring. This endpoint also handles inline identifications for the actor, recipient, and tenant fields.

Endpoint

POST/v1/schedules

Request body

A map of properties describing a user or an object to identify in Knock and mark as who or what performed the action.

data
object(any)

An optional map of data to pass into the workflow execution. There is a 10MB limit on the size of the full data payload. Any individual string value greater than 1024 bytes in length will be truncated in your logs.

ending_at
string(date-time)

The ending date and time for the schedule.

recipientsRequired

The recipients to set the schedule for. Limited to 100 recipients per request.

The repeat rule for the schedule.

__typename
string

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)
Required

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

scheduled_at
string(date-time)

The starting date and time for the schedule.

The tenant to trigger the workflow for. Triggering with a tenant will use any tenant-level overrides associated with the tenant object, and all messages produced from workflow runs will be tagged with the tenant.

workflow
string
Required

The key of the workflow.

Returns

SchedulesResponse

A list of schedules.

List schedules

#

Returns a paginated list of schedules for the current environment, filtered by workflow and optionally by recipients and tenant.

Endpoint

GET/v1/schedules

Query parameters

workflow
string

Filter by workflow key.

Filter by recipient references.

tenant
string

Filter by tenant ID.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page (defaults to 50).

Returns

ListSchedulesResponse

A response containing a list of schedules.

entries

A list of schedules.

__typename
string

The typename of the schema.

A map of properties describing a user or an object to identify in Knock and mark as who or what performed the action.

data
object(any)

An optional map of data to pass into the workflow execution. There is a 10MB limit on the size of the full data payload. Any individual string value greater than 1024 bytes in length will be truncated in your logs.

id
string(uuid)
Required

Unique identifier for the schedule.

inserted_at
string(date-time)
Required

Timestamp when the resource was created.

last_occurrence_at
string(date-time)

The last occurrence of the schedule.

next_occurrence_at
string(date-time)

The next occurrence of the schedule.

recipient
2 possible types
Required

A recipient of a notification, which is either a user or an object.

repeatsRequired

The repeat rule for the schedule.

__typename
string

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)
Required

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

tenant
string

The tenant to trigger the workflow for. Triggering with a tenant will use any tenant-level overrides associated with the tenant object, and all messages produced from workflow runs will be tagged with the tenant.

updated_at
string(date-time)
Required

The timestamp when the resource was last updated.

workflow
string
Required

The workflow the schedule is applied to.

page_info

Pagination information for a list of resources.

__typename
string

The typename of the schema.

after
string

The cursor to fetch entries after.

before
string

The cursor to fetch entries before.

page_size
integer

The number of items per page (defaults to 50).

Update schedules

#

Updates one or more existing schedules with new timing, data, or other properties. All specified schedule IDs will be updated with the same values. This endpoint also handles inline identifications for the actor, recipient, and tenant fields.

Endpoint

PUT/v1/schedules

Request body

A map of properties describing a user or an object to identify in Knock and mark as who or what performed the action.

data
object(any)

An optional map of data to pass into the workflow execution. There is a 10MB limit on the size of the full data payload. Any individual string value greater than 1024 bytes in length will be truncated in your logs.

ending_at
string(date-time)

The ending date and time for the schedule.

The repeat rule for the schedule.

__typename
string

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)
Required

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

schedule_ids
string(uuid)[]
Required

A list of schedule IDs.

scheduled_at
string(date-time)

The starting date and time for the schedule.

The tenant to trigger the workflow for. Triggering with a tenant will use any tenant-level overrides associated with the tenant object, and all messages produced from workflow runs will be tagged with the tenant.

Returns

SchedulesResponse

A list of schedules.

Delete schedules

#

Permanently deletes one or more schedules identified by the provided schedule IDs. This operation cannot be undone.

Endpoint

DELETE/v1/schedules

Request body

schedule_ids
string[]
Required

A list of schedule IDs.

Returns

SchedulesResponse

A list of schedules.

Bulk schedules

#

Bulk operations available for schedules.

Create schedules in bulk

#

Bulk creates up to 1,000 schedules at a time. This endpoint also handles inline identifications for the actor, recipient, and tenant fields.

Endpoint

POST/v1/schedules/bulk/create

Request body

schedules
object[]
Required

A list of schedules.

A map of properties describing a user or an object to identify in Knock and mark as who or what performed the action.

data
object(any)

An optional map of data to pass into the workflow execution. There is a 10MB limit on the size of the full data payload. Any individual string value greater than 1024 bytes in length will be truncated in your logs.

ending_at
string(date-time)

The ending date and time for the schedule.

recipient
3 possible types

Specifies a recipient in a request. This can either be a user identifier (string), an inline user request (object), or an inline object request, which is determined by the presence of a collection property.

The repeat rule for the schedule.

__typename
string

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)
Required

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

scheduled_at
string(date-time)

The starting date and time for the schedule.

The tenant to trigger the workflow for. Triggering with a tenant will use any tenant-level overrides associated with the tenant object, and all messages produced from workflow runs will be tagged with the tenant.

workflow
string
Required

The key of the workflow.

Returns

A bulk operation entity.

__typename
string

The typename of the schema.

completed_at
string(date-time)

Timestamp when the bulk operation was completed.

error_count
integer

The number of failed operations.

error_items
object[]

A list of items that failed to be processed.

collection
string

The collection this object belongs to.

id
string
Required

Unique identifier for the object.

estimated_total_rows
integer

The estimated total number of rows to process.

failed_at
string(date-time)

Timestamp when the bulk operation failed.

id
string(uuid)

Unique identifier for the bulk operation.

inserted_at
string(date-time)

Timestamp when the resource was created.

name
string

The name of the bulk operation.

processed_rows
integer

The number of rows processed so far.

progress_path
string(uri)

The URI to the bulk operation's progress.

started_at
string(date-time)

Timestamp when the bulk operation was started.

status
enum(string)

The status of the bulk operation.

queuedprocessingcompletedfailed
success_count
integer

The number of successful operations.

updated_at
string(date-time)

The timestamp when the resource was last updated.

Schedule

#

A schedule represents a recurring workflow execution.

Attributes

__typename
string

The typename of the schema.

A map of properties describing a user or an object to identify in Knock and mark as who or what performed the action.

data
object(any)

An optional map of data to pass into the workflow execution. There is a 10MB limit on the size of the full data payload. Any individual string value greater than 1024 bytes in length will be truncated in your logs.

id
string(uuid)

Unique identifier for the schedule.

inserted_at
string(date-time)

Timestamp when the resource was created.

last_occurrence_at
string(date-time)

The last occurrence of the schedule.

next_occurrence_at
string(date-time)

The next occurrence of the schedule.

recipient
2 possible types

A recipient of a notification, which is either a user or an object.

The repeat rule for the schedule.

__typename
string

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)
Required

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

tenant
string

The tenant to trigger the workflow for. Triggering with a tenant will use any tenant-level overrides associated with the tenant object, and all messages produced from workflow runs will be tagged with the tenant.

updated_at
string(date-time)

The timestamp when the resource was last updated.

workflow
string

The workflow the schedule is applied to.

ScheduleRepeatRule

#

The repeat rule for the schedule.

Attributes

__typename
string

The typename of the schema.

day_of_month
integer

The day of the month to repeat the schedule.

days
enum(string)[]

The days of the week to repeat the schedule.

montuewedthufrisatsun
frequency
enum(string)

The frequency of the schedule.

dailyweeklymonthlyhourly
hours
integer

The hour of the day to repeat the schedule.

interval
integer

The interval of the schedule.

minutes
integer

The minute of the hour to repeat the schedule.

New chat