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.
| SDK | Route |
|---|---|
schedules.create | POST /v1/schedules |
schedules.list | GET /v1/schedules |
schedules.retrieve | GET /v1/schedules/{id} |
schedules.update | PUT /v1/schedules/{id} |
schedules.del (Python: schedules.delete) | DELETE /v1/schedules/{id} |
schedules.activate, schedules.deactivate | POST /v1/schedules/{id}/activate, POST /v1/schedules/{id}/deactivate |
| None yet | GET /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
| Field | Description |
|---|---|
environmentstring in query | Default: 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 query | Only this task's schedules. |
limitinteger in query | Schedules per page, 1..200. |
cursorstring in query | A page's next_cursor, for the page after it. A malformed cursor is a 400. |
pageinteger in query | A numbered page, from 1. A page past the last is empty; its pagination still counts the schedules. |
per_pageinteger in query | Schedules 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
| Field | Description |
|---|---|
schedulesSchedule[] required | Live 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. |
paginationPagination | A 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
| Field | Description |
|---|---|
taskstring required | A task of the environment's current deployment; another is a 400. |
cronstring required | Five fields, as TaskSchedule.cron. A bad cron is a 400. |
timezonestring | null | An IANA time zone. Absent: UTC. An unknown one is a 400. |
external_idstring | null | The payload's externalId: 1..128 bytes, no NUL. |
deduplication_keystring | null | With 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 | null | Default: 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
| Field | Description |
|---|---|
idstring (uuid) required | The payload's scheduleId. |
environmentstring required | dev, staging or prod; never a preview. |
source"declared" | "api" required | declared: a task's schedule in the current deployment, synced by every promotion. api: created through POST /v1/schedules. |
taskstring required | |
cronstring required | |
timezonestring required | An IANA time zone. |
external_idstring | null required | The payload's externalId (API schedules only). |
deduplication_keystring | null required | The key that created it (API schedules only). |
deployment_idstring | null required | For a declared schedule, the deployment that declares it; null for an API schedule, which runs the current deployment. |
activeboolean required | False while paused. |
next_atstring | null required | The next undecided tick; null while paused or retired. |
last_tick_atstring | null required | The last tick that fired a run: the next run's lastTimestamp. |
last_run_idstring | null required | The run that tick fired. |
created_atstring (date-time) required | |
updated_atstring (date-time) required | |
retired_atstring | null required | When 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
| Field | Description |
|---|---|
idstring (uuid) in path required | Schedule 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
| Field | Description |
|---|---|
scheduleSchedule required | A schedule: declared by a task in the current deployment, or created through POST /v1/schedules. |
upcomingstring (date-time)[] required | The next 5 ticks from next_at; empty while paused. |
ticksScheduleTick[] required | The 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
| Field | Description |
|---|---|
idstring (uuid) in path required | Schedule ID. |
Request body ScheduleUpdate
| Field | Description |
|---|---|
taskstring required | |
cronstring required | |
timezonestring | null | Absent: UTC. |
external_idstring | null | Absent: 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
| Field | Description |
|---|---|
idstring (uuid) required | The payload's scheduleId. |
environmentstring required | dev, staging or prod; never a preview. |
source"declared" | "api" required | declared: a task's schedule in the current deployment, synced by every promotion. api: created through POST /v1/schedules. |
taskstring required | |
cronstring required | |
timezonestring required | An IANA time zone. |
external_idstring | null required | The payload's externalId (API schedules only). |
deduplication_keystring | null required | The key that created it (API schedules only). |
deployment_idstring | null required | For a declared schedule, the deployment that declares it; null for an API schedule, which runs the current deployment. |
activeboolean required | False while paused. |
next_atstring | null required | The next undecided tick; null while paused or retired. |
last_tick_atstring | null required | The last tick that fired a run: the next run's lastTimestamp. |
last_run_idstring | null required | The run that tick fired. |
created_atstring (date-time) required | |
updated_atstring (date-time) required | |
retired_atstring | null required | When 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
| Field | Description |
|---|---|
idstring (uuid) in path required | Schedule 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
| Field | Description |
|---|---|
idstring (uuid) required | The payload's scheduleId. |
environmentstring required | dev, staging or prod; never a preview. |
source"declared" | "api" required | declared: a task's schedule in the current deployment, synced by every promotion. api: created through POST /v1/schedules. |
taskstring required | |
cronstring required | |
timezonestring required | An IANA time zone. |
external_idstring | null required | The payload's externalId (API schedules only). |
deduplication_keystring | null required | The key that created it (API schedules only). |
deployment_idstring | null required | For a declared schedule, the deployment that declares it; null for an API schedule, which runs the current deployment. |
activeboolean required | False while paused. |
next_atstring | null required | The next undecided tick; null while paused or retired. |
last_tick_atstring | null required | The last tick that fired a run: the next run's lastTimestamp. |
last_run_idstring | null required | The run that tick fired. |
created_atstring (date-time) required | |
updated_atstring (date-time) required | |
retired_atstring | null required | When 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
| Field | Description |
|---|---|
idstring (uuid) in path required | Schedule 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
| Field | Description |
|---|---|
idstring (uuid) required | The payload's scheduleId. |
environmentstring required | dev, staging or prod; never a preview. |
source"declared" | "api" required | declared: a task's schedule in the current deployment, synced by every promotion. api: created through POST /v1/schedules. |
taskstring required | |
cronstring required | |
timezonestring required | An IANA time zone. |
external_idstring | null required | The payload's externalId (API schedules only). |
deduplication_keystring | null required | The key that created it (API schedules only). |
deployment_idstring | null required | For a declared schedule, the deployment that declares it; null for an API schedule, which runs the current deployment. |
activeboolean required | False while paused. |
next_atstring | null required | The next undecided tick; null while paused or retired. |
last_tick_atstring | null required | The last tick that fired a run: the next run's lastTimestamp. |
last_run_idstring | null required | The run that tick fired. |
created_atstring (date-time) required | |
updated_atstring (date-time) required | |
retired_atstring | null required | When 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
| Field | Description |
|---|---|
idstring (uuid) in path required | Schedule 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
| Field | Description |
|---|---|
idstring (uuid) required | The payload's scheduleId. |
environmentstring required | dev, staging or prod; never a preview. |
source"declared" | "api" required | declared: a task's schedule in the current deployment, synced by every promotion. api: created through POST /v1/schedules. |
taskstring required | |
cronstring required | |
timezonestring required | An IANA time zone. |
external_idstring | null required | The payload's externalId (API schedules only). |
deduplication_keystring | null required | The key that created it (API schedules only). |
deployment_idstring | null required | For a declared schedule, the deployment that declares it; null for an API schedule, which runs the current deployment. |
activeboolean required | False while paused. |
next_atstring | null required | The next undecided tick; null while paused or retired. |
last_tick_atstring | null required | The last tick that fired a run: the next run's lastTimestamp. |
last_run_idstring | null required | The run that tick fired. |
created_atstring (date-time) required | |
updated_atstring (date-time) required | |
retired_atstring | null required | When 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
| Field | Description |
|---|---|
idstring (uuid) in path required | Schedule ID. |
limitinteger in query | Ticks per page, 1..200. |
cursorstring in query | A 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
| Field | Description |
|---|---|
ticksScheduleTick[] required | Newest first. |
next_cursorstring | null required | ?cursor= this value for the next page; null on the last. |