Skip to content

Reference

Schedules API

Create, list, read, change, pause and delete recurring schedules. An environment API key can call every route on this page, in its own environment.

On this page

These are the routes the SDKs' schedules calls use. With an environment API key, every schedule is in the key's environment: the environment field and parameter may be left out, and a schedule in another environment answers 404. For what schedules do, see Schedules.

SDKRoute
schedules.createPOST /v1/schedules
schedules.listGET /v1/schedules
schedules.retrieveGET /v1/schedules/{id}
schedules.updatePUT /v1/schedules/{id}
schedules.del (Python: schedules.delete)DELETE /v1/schedules/{id}
schedules.activate, schedules.deactivatePOST /v1/schedules/{id}/activate, POST /v1/schedules/{id}/deactivate
None yetGET /v1/schedules/{id}/ticks

The wire format is snake case, and a schedule's source is declared or api. The SDKs answer in Trigger.dev's shape instead, with type set to DECLARATIVE or IMPERATIVE.

List schedules#

GET/v1/schedules

Auth: Operator token or Environment API key

Live schedules of one environment, declared and created through the API, paused ones too, oldest first. Page them with limit and cursor, or number the pages with page and per_page, as Trigger's schedules.list does. Either pair, not both: mixing them is a 400.

Parameters

List schedules: parameters
FieldDescription
environmentstring in queryDefault: an API key's own environment, else the one the control plane serves. Another than an API key's own, or an unknown one, is a 404.
taskstring in queryOnly this task's schedules.
limitinteger in querySchedules per page, 1..200.
cursorstring in queryA page's next_cursor, for the page after it. A malformed cursor is a 400.
pageinteger in queryA numbered page, from 1. A page past the last is empty; its pagination still counts the schedules.
per_pageinteger in querySchedules per numbered page, 1..200.

Responses

  • 200OK SchedulePage
  • 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead. Error
  • 401Missing or wrong bearer token. Error
  • 404The resource does not exist. Error
Fields of SchedulePage
SchedulePage fields
FieldDescription
schedulesSchedule[] requiredLive schedules (paused ones too), oldest first.
next_cursorstring | null required?cursor= this value for the next page; null on the last, and on a numbered page.
paginationPaginationA numbered page's place. Present only when the request named page or per_page.

Create a schedule#

POST/v1/schedules

Auth: Operator token or Environment API key

A new schedule fires from its next tick after now. With a deduplication_key that names a live schedule in the environment, that schedule is updated instead (200). At most 1000 API schedules per environment.

Request body ScheduleCreate

Create a schedule: request body
FieldDescription
taskstring requiredA task of the environment's current deployment; another is a 400.
cronstring requiredFive fields, as TaskSchedule.cron. A bad cron is a 400.
timezonestring | nullAn IANA time zone. Absent: UTC. An unknown one is a 400.
external_idstring | nullThe payload's externalId: 1..128 bytes, no NUL.
deduplication_keystring | nullWith a key that names a live schedule in the environment, that schedule is updated and the answer is 200. The SDKs generate one per call when the caller gives none, so their own retries never create two.
environmentstring | nullDefault: an API key's own environment, else the one the control plane serves. Another than an API key's own is a 404; a preview is a 400; one with no current deployment is a 409.

Responses

  • 200The live schedule the deduplication key names, updated. Schedule
  • 201Created. Schedule
  • 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead. Error
  • 401Missing or wrong bearer token. Error
  • 404The resource does not exist. Error
  • 409The request conflicts with current state, or is fenced by a newer attempt epoch, lease or owner. Error
  • 422The JSON body did not match the request schema string
Fields of Schedule
Schedule fields
FieldDescription
idstring (uuid) requiredThe payload's scheduleId.
environmentstring requireddev, staging or prod; never a preview.
source"declared" | "api" requireddeclared: a task's schedule in the current deployment, synced by every promotion. api: created through POST /v1/schedules.
taskstring required
cronstring required
timezonestring requiredAn IANA time zone.
external_idstring | null requiredThe payload's externalId (API schedules only).
deduplication_keystring | null requiredThe key that created it (API schedules only).
deployment_idstring | null requiredFor a declared schedule, the deployment that declares it; null for an API schedule, which runs the current deployment.
activeboolean requiredFalse while paused.
next_atstring | null requiredThe next undecided tick; null while paused or retired.
last_tick_atstring | null requiredThe last tick that fired a run: the next run's lastTimestamp.
last_run_idstring | null requiredThe run that tick fired.
created_atstring (date-time) required
updated_atstring (date-time) required
retired_atstring | null requiredWhen it was deleted (API) or dropped by a promotion (declared). A retired schedule never fires.

Get a schedule with its next and newest ticks#

GET/v1/schedules/{id}

Auth: Operator token or Environment API key

A schedule outside an API key's environment, a deleted one and a retired one are a 404, the same as a missing one.

Parameters

Get a schedule with its next and newest ticks: parameters
FieldDescription
idstring (uuid) in path requiredSchedule ID.

Responses

  • 200OK ScheduleDetails
  • 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead. Error
  • 401Missing or wrong bearer token. Error
  • 404The resource does not exist. Error
Fields of ScheduleDetails
ScheduleDetails fields
FieldDescription
scheduleSchedule requiredA schedule: declared by a task in the current deployment, or created through POST /v1/schedules.
upcomingstring (date-time)[] requiredThe next 5 ticks from next_at; empty while paused.
ticksScheduleTick[] requiredThe newest 20 decided ticks, newest first.

Replace a schedule created through the API#

PUT/v1/schedules/{id}

Auth: Operator token or Environment API key

Sets the task, cron, time zone and external ID; an absent time zone is UTC and an absent external ID is cleared. A new cron or time zone starts at its next tick after now. A declared schedule is a 409: change it in the task definition and deploy. A schedule outside an API key's environment, a deleted one and a retired one are a 404, the same as a missing one.

Parameters

Replace a schedule created through the API: parameters
FieldDescription
idstring (uuid) in path requiredSchedule ID.

Request body ScheduleUpdate

Replace a schedule created through the API: request body
FieldDescription
taskstring required
cronstring required
timezonestring | nullAbsent: UTC.
external_idstring | nullAbsent: cleared.

Responses

  • 200OK Schedule
  • 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead. Error
  • 401Missing or wrong bearer token. Error
  • 404The resource does not exist. Error
  • 409The request conflicts with current state, or is fenced by a newer attempt epoch, lease or owner. Error
  • 422The JSON body did not match the request schema string
Fields of Schedule
Schedule fields
FieldDescription
idstring (uuid) requiredThe payload's scheduleId.
environmentstring requireddev, staging or prod; never a preview.
source"declared" | "api" requireddeclared: a task's schedule in the current deployment, synced by every promotion. api: created through POST /v1/schedules.
taskstring required
cronstring required
timezonestring requiredAn IANA time zone.
external_idstring | null requiredThe payload's externalId (API schedules only).
deduplication_keystring | null requiredThe key that created it (API schedules only).
deployment_idstring | null requiredFor a declared schedule, the deployment that declares it; null for an API schedule, which runs the current deployment.
activeboolean requiredFalse while paused.
next_atstring | null requiredThe next undecided tick; null while paused or retired.
last_tick_atstring | null requiredThe last tick that fired a run: the next run's lastTimestamp.
last_run_idstring | null requiredThe run that tick fired.
created_atstring (date-time) required
updated_atstring (date-time) required
retired_atstring | null requiredWhen it was deleted (API) or dropped by a promotion (declared). A retired schedule never fires.

Delete a schedule created through the API#

DELETE/v1/schedules/{id}

Auth: Operator token or Environment API key

It never fires again. Its runs stay; the schedule and its ticks are removed after the retention period. A declared schedule is a 409. A schedule outside an API key's environment, a deleted one and a retired one are a 404, the same as a missing one.

Parameters

Delete a schedule created through the API: parameters
FieldDescription
idstring (uuid) in path requiredSchedule ID.

Responses

  • 200OK Schedule
  • 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead. Error
  • 401Missing or wrong bearer token. Error
  • 404The resource does not exist. Error
  • 409The request conflicts with current state, or is fenced by a newer attempt epoch, lease or owner. Error
Fields of Schedule
Schedule fields
FieldDescription
idstring (uuid) requiredThe payload's scheduleId.
environmentstring requireddev, staging or prod; never a preview.
source"declared" | "api" requireddeclared: a task's schedule in the current deployment, synced by every promotion. api: created through POST /v1/schedules.
taskstring required
cronstring required
timezonestring requiredAn IANA time zone.
external_idstring | null requiredThe payload's externalId (API schedules only).
deduplication_keystring | null requiredThe key that created it (API schedules only).
deployment_idstring | null requiredFor a declared schedule, the deployment that declares it; null for an API schedule, which runs the current deployment.
activeboolean requiredFalse while paused.
next_atstring | null requiredThe next undecided tick; null while paused or retired.
last_tick_atstring | null requiredThe last tick that fired a run: the next run's lastTimestamp.
last_run_idstring | null requiredThe run that tick fired.
created_atstring (date-time) required
updated_atstring (date-time) required
retired_atstring | null requiredWhen it was deleted (API) or dropped by a promotion (declared). A retired schedule never fires.

Resume a schedule#

POST/v1/schedules/{id}/activate

Auth: Operator token or Environment API key

Either kind. It fires from its next tick after now: the paused span never fires. Idempotent. A schedule outside an API key's environment, a deleted one and a retired one are a 404, the same as a missing one.

Parameters

Resume a schedule: parameters
FieldDescription
idstring (uuid) in path requiredSchedule ID.

Responses

  • 200OK Schedule
  • 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead. Error
  • 401Missing or wrong bearer token. Error
  • 404The resource does not exist. Error
Fields of Schedule
Schedule fields
FieldDescription
idstring (uuid) requiredThe payload's scheduleId.
environmentstring requireddev, staging or prod; never a preview.
source"declared" | "api" requireddeclared: a task's schedule in the current deployment, synced by every promotion. api: created through POST /v1/schedules.
taskstring required
cronstring required
timezonestring requiredAn IANA time zone.
external_idstring | null requiredThe payload's externalId (API schedules only).
deduplication_keystring | null requiredThe key that created it (API schedules only).
deployment_idstring | null requiredFor a declared schedule, the deployment that declares it; null for an API schedule, which runs the current deployment.
activeboolean requiredFalse while paused.
next_atstring | null requiredThe next undecided tick; null while paused or retired.
last_tick_atstring | null requiredThe last tick that fired a run: the next run's lastTimestamp.
last_run_idstring | null requiredThe run that tick fired.
created_atstring (date-time) required
updated_atstring (date-time) required
retired_atstring | null requiredWhen it was deleted (API) or dropped by a promotion (declared). A retired schedule never fires.

Pause a schedule#

POST/v1/schedules/{id}/deactivate

Auth: Operator token or Environment API key

Either kind; a declared schedule stays paused across promotions. Idempotent. A schedule outside an API key's environment, a deleted one and a retired one are a 404, the same as a missing one.

Parameters

Pause a schedule: parameters
FieldDescription
idstring (uuid) in path requiredSchedule ID.

Responses

  • 200OK Schedule
  • 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead. Error
  • 401Missing or wrong bearer token. Error
  • 404The resource does not exist. Error
Fields of Schedule
Schedule fields
FieldDescription
idstring (uuid) requiredThe payload's scheduleId.
environmentstring requireddev, staging or prod; never a preview.
source"declared" | "api" requireddeclared: a task's schedule in the current deployment, synced by every promotion. api: created through POST /v1/schedules.
taskstring required
cronstring required
timezonestring requiredAn IANA time zone.
external_idstring | null requiredThe payload's externalId (API schedules only).
deduplication_keystring | null requiredThe key that created it (API schedules only).
deployment_idstring | null requiredFor a declared schedule, the deployment that declares it; null for an API schedule, which runs the current deployment.
activeboolean requiredFalse while paused.
next_atstring | null requiredThe next undecided tick; null while paused or retired.
last_tick_atstring | null requiredThe last tick that fired a run: the next run's lastTimestamp.
last_run_idstring | null requiredThe run that tick fired.
created_atstring (date-time) required
updated_atstring (date-time) required
retired_atstring | null requiredWhen it was deleted (API) or dropped by a promotion (declared). A retired schedule never fires.

Page through a schedule's decided ticks#

GET/v1/schedules/{id}/ticks

Auth: Operator token or Environment API key

Newest first. Ticks are kept for the event retention period, and the latest fired tick always. A schedule outside an API key's environment, a deleted one and a retired one are a 404, the same as a missing one.

Parameters

Page through a schedule's decided ticks: parameters
FieldDescription
idstring (uuid) in path requiredSchedule ID.
limitinteger in queryTicks per page, 1..200.
cursorstring in queryA page's next_cursor, for the page after it. A malformed cursor is a 400.

Responses

  • 200OK TickPage
  • 400The request was invalid: a validation error, or a malformed path, query or JSON body. Extractor rejections (malformed JSON, a bad UUID) carry a text/plain body instead. Error
  • 401Missing or wrong bearer token. Error
  • 404The resource does not exist. Error
Fields of TickPage
TickPage fields
FieldDescription
ticksScheduleTick[] requiredNewest first.
next_cursorstring | null required?cursor= this value for the next page; null on the last.