Skip to content

Reference

Runs

Start runs, read them, cancel them, follow them live and send them events. An environment API key can call every route on this page.

On this page

These are the routes the SDKs call. With an environment API key, every run is in the key's environment: the environment field and parameter may be left out, and naming another environment answers 404.

SDKRoute
tasks.triggerPOST /v1/runs
tasks.batchTriggerPOST /v1/runs/batch
runs.retrieve, runs.pollGET /v1/runs/{id}
runs.listGET /v1/runs
runs.cancelPOST /v1/runs/{id}/cancel
runs.reschedulePOST /v1/runs/{id}/reschedule
runs.retryFromFailurePOST /v1/runs/{id}/retry-from-failure
runs.subscribeGET /v1/runs/{id}/stream
auth.createPublicTokenPOST /v1/public-tokens
useRealtimeRun, with a public tokenGET /v1/runs/{id} and GET /v1/runs/{id}/stream
None yetPOST /v1/runs/{id}/events

List runs#

GET/v1/runs

Auth: Operator token or Environment API key

One page of runs, every run including children, newest first, as Trigger.dev's runs.list pages them. The operator sees every environment unless it names one; an API key sees only its own. Filters combine: source, status, task and tag each keep runs matching any of their values, and from, to or period bound the creation time. Page with after (pagination.next) or before (pagination.previous). Control planes from before run tags answered a bare array of runs.

Parameters

List runs: parameters
FieldDescription
limitinteger in queryHow many runs, 1..200.
environmentstring in queryOnly runs of this environment. An unknown environment, or another than an API key's own, is a 404.
sourcestring in queryComma-separated sources: api, dashboard, test, replay, child, schedule, hook. Keeps runs whose source field is any of them, by the same rules as GET /v1/dashboard/runs. An unknown source is a 400.
statusstring in queryComma-separated statuses: delayed, queued, running, waiting, completed, failed, cancelled. An unknown one is a 400.
taskstring in queryComma-separated task IDs, each at most 128 bytes.
tagstring in queryComma-separated tags: runs with any of them, as Trigger.dev's filter[tag]. Each tag is taken exactly as written, spaces included, so a tag with a comma in it cannot be named. At most 100.
fromstring (date-time) in queryRuns created at or after this RFC 3339 time.
tostring (date-time) in queryRuns created before this RFC 3339 time.
periodstring in queryRuns created within this duration before now, such as 30m, 6h, 1d or 7d (w, d, h or hr, m, s), as Trigger.dev's period. With from it is a 400.
afterstring (uuid) in queryThe page after (older than) this run: a page's pagination.next. A run not in the listed environment is a 400. With before it is a 400.
beforestring (uuid) in queryThe page before (newer than) this run: a page's pagination.previous.

Responses

  • 200OK RunListPage
  • 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 RunListPage
RunListPage fields
FieldDescription
dataListedRun[] requiredNewest first by (created_at, id).
paginationRunPagination requiredTrigger.dev's pagination: run IDs to page with.

Start a run#

POST/v1/runs

Auth: Operator token or Environment API key

Queues a registered task, deduplicated by idempotency_key within its environment among top-level runs. The API checks accepted submissions before resolving the current deployment: a matching retry returns 202 even after promotion, archive, or when its pinned deployment is no longer current. Task, normalized input, placement and resolved machine definition must match the accepted run; a supplied deployment_id must also match. Changed reuse is 409. New requests resolve their environment's current deployment; unknown deployment is 404, and environment keys may not select another deployment. An unknown machine, or a size larger than the environment allows for the placement, is 400 (this run asks for more CPU or memory than ...). A run no capacity can take yet may be accepted with a bounded capacity_wait (Waiting for compute). Variables are snapshotted for retries and children. A payload may be at most 3 MiB of JSON; one over 512 KiB is stored out of line, and the run's details return it whole. New submissions apply a normalized-input-plus-pinned-variable first-envelope estimate against 16 MiB, including the longest supported constrained update-channel reason. Awaited calls and new trigger children use the same check; trigger overflow is refused per frame. The runner rechecks the actual envelope. Future workflow history growth is not covered by first-envelope admission. With delay or debounce the run is created delayed: it holds no queue slot until its time, when the next wake pass queues it. A debounce folds the trigger into the open delayed run of the task with its key in the environment, which this answers with, pushing its start back; a trailing debounce also replaces its input. An idempotency_key that starts with hook: is 400: lifecycle hook runs use those keys.

Request body SubmitRequest

Start a run: request body
FieldDescription
taskstring requiredA task ID registered in the deployment.
inputany JSONAny JSON value (default null). Numbers must be finite and integers JavaScript-safe; integral floats are normalized to integers. Bounded in size.
placementPlacementDefault private-first.
idempotency_keystring required1..128 bytes. Resubmitting the same key with the same request returns the existing run, with cached true; the same key with a changed request is a 409, unless idempotency_key_match is task.
deployment_idstring | nullPin the run to this registered deployment. Default: the deployment the control plane serves.
machinestring | nullRun on this machine preset (micro, small, small-2x, medium, medium-2x, large or large-2x) instead of the task's own size. Retries keep it, and the run's definition records it as compute.machine. An unknown name, or a size no pool the placement permits could ever hold, is a 400.
queuestring | nullWait in this queue instead of the task's own, as Trigger.dev v4's trigger option { queue: "name" }: the ID of a queue the run's deployment declares, a declared name or task/<task id> for a task's own queue. The run obeys that queue's limit and retries keep it. A queue the deployment does not declare is a 400.
concurrency_keystring | nullA concurrency key, as Trigger.dev v4's trigger option concurrencyKey: the run's queue limit applies to the runs triggered with this key, apart from other keys and from runs without one, with no cap across keys. 1 to 128 bytes of UTF-8 with no whitespace at either end and no control, invisible format (Unicode Cf) or line or paragraph separator characters, otherwise a 400. Keys keep their case and compare byte for byte. Retries keep it, and an idempotent retry with another key is a 409.
environmentstring | nullThe environment to run in (dev, staging, prod or preview/<branch>); the run uses that environment's current deployment unless deployment_id pins another. Default: an API key's own environment, else the one the control plane serves. An unknown environment, or another than an API key's own, is a 404; an archived preview, or one with no current deployment, is a 409.
idempotency_key_ttl_msintegerHow long the run holds its idempotency key, in milliseconds, as Trigger.dev's idempotencyKeyTTL: once that long has passed since the run was accepted, the key starts a new run instead of returning this one, whatever its status. 1 second to 365 days. Omitted: for good. The Trigger.dev dialect sends it with every key; Bok Joy's own SDKs do not.
release_key_on_failurebooleanThe run releases its idempotency key if it fails, as on Trigger.dev: the same key then starts a new run. A completed or cancelled run keeps it until its TTL. The Trigger.dev dialect sends it with every key; Bok Joy's own SDKs do not. Default false.
delaystring | nullTrigger.dev's delay: the run is created delayed and starts at this time, a duration from now ("30s", "1h30m", "2d", "1w") or a time ("2026-10-12T09:00:00Z", with an offset, or a date; a time without an offset is UTC). A time that has passed starts it at once, and a time after the end of year 9999 is a 400. A value that is neither is a 400 (Trigger.dev ignores it). With debounce, the first trigger's start.
debounceDebounceOptions | nullCollapses triggers of this task with one key into one delayed run (see DebounceOptions). The idempotency key is checked first: a key a run still holds returns that run and folds nothing, and a key its run released (idempotency_key_ttl_ms, release_key_on_failure or a reset) holds nothing. With delay, delay sets the first run's start and must not have passed.
tagsstring[]Trigger.dev v4's tags: up to 10 labels to find the run by (GET /v1/runs?tag=), such as org_42. Each is 1 to 128 characters without NUL, otherwise a 400. A tag given twice is kept once, where it first appears. An idempotent retry is not compared on them: it returns the run with its own tags. A debounced trigger in trailing mode replaces the run's tags with its own when it names any. Default: none.
metadataobjectTrigger.dev's trigger-time metadata: the run's metadata document starts as this object, so its attempts read it (ctx.metadata) and add to it, and GET /v1/runs/{id} and the run stream show it. Each key is 1 to 128 bytes without NUL and each value wire-safe JSON, and the whole document at most 65536 bytes of compact JSON (the limit for metadata a run sets), otherwise a 400. An empty object is none. An idempotent retry is not compared on it: it returns the run with its own. A debounced trigger in trailing mode replaces the run's metadata with its own when it names any. A workflow's attempts start their metadata empty and rebuild it as they replay, so they do not see it.
idempotency_key_match"request" | "task"What a run already holding the key must share with this request to answer it. request (the default): the whole request, and a changed one is a 409. task: only the task, as Trigger.dev returns the run its key names whatever the payload or options; the answer is marked cached. A key held by a run of another task is a 409 either way, as a key names one run per environment. The Trigger.dev dialect (@bokjoy/sdk/trigger) sends task with every key.
public_tokenbooleanAnswer with public_access_token: a public access token that reads this run alone (not its children) in its environment for an hour, as Trigger.dev's trigger handle carries one. Minted for an API key, which must stay unrevoked for the token to read, or for the operator. Left out of the answer when the control plane cannot mint tokens (no secrets key, or the development operator token) or the caller is a person's token; the run is accepted either way. Default false.

Responses

  • 202Accepted. The new run, the existing run for a repeated idempotency key (cached true), or the delayed run a debounce folded this trigger into, with the public access token the request asked for. AcceptedRun
  • 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

Start up to 1,000 runs at once, all or none#

POST/v1/runs/batch

Auth: Operator token or Environment API key

Each entry is a POST /v1/runs body without environment, which the batch names once (default: an API key's own environment, else the one the control plane serves). The batch is one transaction: every entry is accepted or none is. Each entry is deduplicated by its own idempotency_key exactly as a single submission is, so retrying a batch returns the same runs, and an entry accepted earlier, alone or in another batch, is returned as it was, before any deployment is resolved. Keys must be distinct within a batch. A refused entry refuses the whole batch with that entry's status (400, 404 or 409, as for POST /v1/runs) and an error starting with its index, for example runs[3]: invalid request: task is not registered in deployment. An empty batch, more than 1,000 entries, a repeated key or an entry naming environment is a 400. Runs are returned in entry order.

Request body BatchSubmitRequest

Start up to 1,000 runs at once, all or none: request body
FieldDescription
runsSubmitRequest[] required1..1000 submissions, each a POST /v1/runs body without environment, with distinct idempotency keys.
environmentstring | nullThe environment every entry runs in (dev, staging, prod or preview/<branch>). Default: an API key's own environment, else the one the control plane serves. Another than an API key's own is a 404.

Responses

  • 202Accepted. Every entry's run, new or the existing one for its key, in entry order. BatchSubmitResponse
  • 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 BatchSubmitResponse
BatchSubmitResponse fields
FieldDescription
runsAcceptedRun[] requiredOne run per entry, in entry order.

Get a run with its attempts, journal and usage#

GET/v1/runs/{id}

Auth: Operator token or Environment API key or Public access token

An ID a trigger inside a task returned for a trigger its debounce folded into another run (RunAlias) answers that run, under that run's ID. A run outside an API key's environment is a 404. A public access token reads the customer-safe PublicRun: no input, attempts, journal, usage or error text, and no output for a hook run. A run it does not grant is a 403, whether or not it exists. Answers to a public token carry Access-Control-Allow-Origin: * and expose Retry-After, and OPTIONS on this path answers a CORS preflight without a credential. A public token's reads are rate limited per token and per environment (429).

Parameters

Get a run with its attempts, journal and usage: parameters
FieldDescription
idstring (uuid) in path requiredRun ID.
follow_releasedboolean in queryRead the ID as an in-task trigger's handle. A trigger returns the ID its key derives, the key's first run, even after that run let the key go (it failed, its TTL passed, or the key was reset) and a later run took it. With true, such a run answers for the last run its key moved to, the one doing the work, or for the run a later trigger with the key joined when that trigger was folded into a debounced run, and its RunDetails names that run. Every other run, and a public access token's read, answers for the run itself. The runs.retrieve and runs.poll of @bokjoy/sdk/trigger send it.

Responses

  • 200OK. A RunDetails for the operator token or an API key; a PublicRun for a public access token. RunDetails | PublicRun
  • 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
  • 403The credential is valid but may not read this resource. Error
  • 404The resource does not exist. Error
  • 429A public access token's reads are over their rate (64 at once and 4 a second per token, 256 at once and 128 a second for one environment's tokens). Retry after Retry-After seconds, which a page can read. Error
Fields of RunDetails
RunDetails fields
FieldDescription
runRunRecord required
attemptsAttemptRecord[] required
journalJournalEntry[] required
usageUsageEntry[] required
retriesstring (uuid)[] requiredThe runs that retry this one from failure, oldest first.
hooksRunHooks requiredHow the run's lifecycle hooks ran (docs/hooks.md): end null and attempts empty for a run without hooks.
aliasesRunAlias[] requiredThe IDs that also name this run, oldest first.
metadataobject | null requiredThe run's metadata, as its attempts set and appended it (ctx.metadata, Trigger.dev's metadata); null when none was set. Trigger.dev's runs.retrieve returns it as metadata.

Send a named event to a run#

POST/v1/runs/{id}/events

Auth: Operator token or Environment API key

Events persist even when sent before the workflow waits for them. Sending to a finished run, or reusing an event_id with a different event, is a 409. A run outside an API key's environment is a 404.

Parameters

Send a named event to a run: parameters
FieldDescription
idstring (uuid) in path requiredRun ID.

Request body EventRequest

Send a named event to a run: request body
FieldDescription
event_idstring required1..128 bytes. Deduplication key: resending the same event is a no-op; the same ID with a different event is a 409.
namestring required1..128 bytes. The name a workflow waits for.
payloadany JSONAny JSON value (default null), normalized like run input.

Responses

  • 200OK EventAccepted
  • 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 EventAccepted
EventAccepted fields
FieldDescription
acceptedboolean required

Cancel a run and its unfinished descendants#

POST/v1/runs/{id}/cancel

Auth: Operator token or Environment API key

No request body is read. Owned processes terminate asynchronously; external side effects cannot be undone. Every unfinished run below it is cancelled too, except hook runs, which run its lifecycle hooks whatever happens to it; cancel a hook run by its own ID. A finished run is left as it is and reported with cancelled false. A run outside an API key's environment is a 404.

Parameters

Cancel a run and its unfinished descendants: parameters
FieldDescription
idstring (uuid) in path requiredRun ID.

Responses

  • 200OK CancelResponse
  • 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 CancelResponse
CancelResponse fields
FieldDescription
statusRunStatus requireddelayed: triggered with a delay or a debounce and waiting for its time (delay_until), as Trigger.dev's DELAYED. It holds no queue slot and no compute, and it becomes queued at its time. It can be cancelled or rescheduled meanwhile.
cancelledboolean requiredTrue when the run is now cancelled; false when it had already finished.
notestring required

Retry a failed workflow run from where it failed#

POST/v1/runs/{id}/retry-from-failure

Auth: Operator token or Environment API key

Starts a new run of a failed workflow's task with its input, placement, machine, concurrency key and (when its trigger chose one) queue, in its environment on that environment's current deployment, linked to the original by retry_of. It starts with the original's recorded results for the steps before the first that did not succeed: completed calls, sleeps that passed, received events and batches whose children all came back ok. From that step on everything runs again: a failed call, a wait that timed out, and of a batch only the items whose child failed or was cancelled. A replay that takes a reused step differently, or no longer takes it, runs that step and every later one again. The retry names the chain's first run (first_run_id), from which the SDKs make run-scoped idempotency keys, so a key the failed run's steps waited or triggered with finds the child it started: one that succeeded, or has not finished, is taken whatever its input, and one that failed or was cancelled is run again as a new child with the retry's input. The original is unchanged. The body is optional. A run that is not a failed workflow, a hook run included, is a 409; a plain task has no steps, so replay it instead. With retry_count, a run retried since the caller read it is a 409 too. A run outside an API key's environment is a 404.

Parameters

Retry a failed workflow run from where it failed: parameters
FieldDescription
idstring (uuid) in path requiredRun ID.

Request body RetryFromFailureRequest

Retry a failed workflow run from where it failed: request body
FieldDescription
idempotency_keystringA retry under the same key for the same run returns the run it started, a cancelled one too, and starts nothing; to retry again after a cancel, use another key. Default: a fresh one.
retry_countintegerThe run's retry_count (GET /v1/dashboard/runs) as the caller read it, cancelled retries included. When set, the request starts nothing and answers 409 if the run has another number of retries now, or one that was not cancelled, unless its idempotency_key already started a retry that was not cancelled, which it returns. The console sends it, so a page read before someone else retried the run never starts a second retry or gets back one that was cancelled since.

Responses

  • 202Accepted RetryFromFailure
  • 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 RetryFromFailure
RetryFromFailure fields
FieldDescription
retry_ofstring (uuid) requiredThe failed run, which is unchanged.
runRunRecord required
reused_stepsinteger requiredThe original's steps the retry starts with as its history: every step before the first that did not succeed.
rerun_frominteger | null requiredThe index of the first step that runs again; null when every step succeeded and the workflow failed after its last.
reused_resultsinteger requiredWhen that step is a batch, how many of its children came back ok. The retry keeps those results and starts children only for the other items.

Follow a run and its descendants live (WebSocket)#

GET/v1/runs/{id}/stream

Auth: Operator token or Environment API key or Public access token

A WebSocket upgrade (RFC 6455). Send an operator token, or an environment API key for a run in its own environment, as Authorization: Bearer; offer bokjoy.stream.v1. Messages are StreamMessage JSON. Without cursor, send a repeatable-read snapshot, then retained eligible events in commit order. With cursor=N, resume after N unless retention deleted tree events above N, in which case send a replacement snapshot whose cursor covers deleted events; pruning is checked again before end. Snapshots list at most 500 runs with a nominal 4 MiB target, always keeping the root even when oversized. Queries follow descendants through 64 levels below the followed run, as deep as any new run may be (serve --max-run-depth bounds triggered and called children alike). A tree created before calls were bounded can be one level deeper: its snapshot is truncated and its stream never ends as settled. End means the whole tree is terminal, no attempt is running or cancel-requested, and its newest retained event was delivered; cleanup-pending attempts do not block end. This is not general termination proof or exactly-once consumer acknowledgement. Replacement snapshots preserve retained state within snapshot/depth bounds, not deleted event history. After error the server closes; reconnect with the last received cursor. Pings are every 15 seconds; 45 seconds of client silence closes the socket. Change detection polls; delivery latency is not guaranteed. An out-of-environment run answers 404 before upgrade. See PROTOCOL.md, Run stream. A public access token may follow a run it names or one below it, sent as Authorization: Bearer or, from a browser, as the subprotocol bokjoy.token.<token> offered beside bokjoy.stream.v1 (the server selects bokjoy.stream.v1 and never echoes the token). A run it does not grant is a 403 before upgrade. Its stream carries the customer-safe view: snapshots list no attempts and no error text, and events are only run.created, run.status (without error), run.delayed (delay_until and previous), metadata and milestone, with attempt_id null. The token's expiry is checked before every message and its API key on every ping and before any message once 15 seconds passed since the last check: the stream closes with code 1008 when the token expires, and sends nothing more from 15 seconds after its API key was revoked, and reconnecting with it is then a 401. Public streams have their own budget, so they never take the place of an API key's or the operator's: at most 4 open on one run with one token, 128 for one environment's tokens and 512 in all, and opens at most 32 at once and 2 a second per token, 128 at once and 32 a second per environment. Past any of these the stream is accepted and closed at once with code 1013 (try again later) and a reason naming the limit, which a browser can read.

Parameters

Follow a run and its descendants live (WebSocket): parameters
FieldDescription
idstring (uuid) in path requiredRun ID: the root of the followed tree (it may itself be a child).
cursorinteger in queryResume after this event sequence (a seq or cursor from an earlier message) instead of starting with a snapshot. The stream still starts with one when event retention deleted events of the tree after it.

Responses

  • 101Switching Protocols: the run stream. Each WebSocket text frame is a StreamMessage (components.schemas.StreamMessage).
  • 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
  • 403The credential is valid but may not read this resource. Error
  • 404The resource does not exist. Error
  • 426Upgrade Required: the run exists, but the request was not a WebSocket upgrade (for example a plain GET). Error
  • 429A public access token's stream opens are over their rate, on a request that is not a WebSocket upgrade. An upgrade past any public limit is accepted and closed at once with code 1013 and the reason instead. Error
  • 503This control plane already holds 256 open run streams of API keys and the operator token; retry shortly. Error

Mint a read-only access token for the browser#

POST/v1/public-tokens

Auth: Operator token or Environment API key

Trigger.dev's auth.createPublicToken on the wire. The token reads the named runs, and every run below them, on GET /v1/runs/{id} and its stream, until it expires, and nothing else. It is bound to the caller's environment (an API key's own; the operator's environment field, else the one the control plane serves), and an API key's token stops working when the key is revoked (at once for reads, within 15 seconds for an open stream). Each named run must exist in that environment, else 404, as for a run that does not exist. 1 to 32 distinct runs (repeats are dropped). Give expires_in (seconds) or expires_at (Unix seconds), not both; the default is 15 minutes and the most 24 hours, else 400. Other scopes (tasks, tags, batches, write) are not supported and refused as unknown fields (422). Nothing is stored: the token is signed with the control plane's public token key (DC_PUBLIC_TOKEN_KEY, else one derived from its secrets key), never with the operator token, so changing that key ends every public token. Minting answers 503 when the control plane has no signing key, or while its operator token is the built-in development one.

Request body PublicTokenRequest

Mint a read-only access token for the browser: request body
FieldDescription
scopesobject required
expires_inintegerSeconds from now. Default 900.
expires_atintegerUnix seconds, at most 24 hours from now.
environmentstringOperator token only: the environment of the runs. An API key's own is implied, and naming another is a 404.

Responses

  • 200The token, shown only here. PublicToken
  • 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
  • 403The credential is valid but may not read this resource. Error
  • 404The resource does not exist. Error
  • 422The JSON body did not match the request schema string
  • 503This control plane cannot mint public access tokens: it has no secrets key or DC_PUBLIC_TOKEN_KEY, or its operator token is the built-in development one. The answer does not say which; the control plane's log does. Error
Fields of PublicToken
PublicToken fields
FieldDescription
tokenstring requiredbjp_<claims>_<signature>. Hand it to the browser.
environmentstring required
runsstring (uuid)[] required
expires_atstring (date-time) required

Move a delayed run to another time#

POST/v1/runs/{id}/reschedule

Auth: Operator token or Environment API key

Trigger.dev's runs.reschedule: the run starts at delay instead, earlier or later. A delay that cannot be read, or a time that has passed, is a 400; a run that is not delayed is a 409 (Trigger.dev answers 400). Answers with the run as GET /v1/runs/{id} does, and its stream carries a run.delayed event. A run outside an API key's environment is a 404.

Parameters

Move a delayed run to another time: parameters
FieldDescription
idstring (uuid) in path requiredRun ID.

Request body RescheduleRequest

Move a delayed run to another time: request body
FieldDescription
delaystring requiredA duration from now or a time, as a trigger's delay.

Responses

  • 200OK RunDetails
  • 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 RunDetails
RunDetails fields
FieldDescription
runRunRecord required
attemptsAttemptRecord[] required
journalJournalEntry[] required
usageUsageEntry[] required
retriesstring (uuid)[] requiredThe runs that retry this one from failure, oldest first.
hooksRunHooks requiredHow the run's lifecycle hooks ran (docs/hooks.md): end null and attempts empty for a run without hooks.
aliasesRunAlias[] requiredThe IDs that also name this run, oldest first.
metadataobject | null requiredThe run's metadata, as its attempts set and appended it (ctx.metadata, Trigger.dev's metadata); null when none was set. Trigger.dev's runs.retrieve returns it as metadata.

Reset an idempotency key#

POST/v1/idempotency-keys/reset

Auth: Operator token or Environment API key

Trigger.dev's idempotencyKeys.reset(task, key): every run of the task in the environment that holds the key lets it go now, so the next trigger with the key starts a new run. Without parent_run_id the key is the environment's: the run submitted with it, and every run on its chain in the environment's scope (the children in-task triggers and waits started with it there), a retry from failure's replacement of a cancelled child included. With parent_run_id, as Trigger.dev's parentRunId, the key is that run's: the children its in-task triggers started with the key in its scope, across its retry from failure's chain, and the child a wait keyed with it shares, under the key idempotencyKeys.create(key) makes in that run (SHA-256 hex of the key, '-' and the first run's ID). A key held only by children in parent runs' scopes is refused with 422 without parent_run_id, rather than released under every parent. Each run that let it go records key_released_at, and released_to once a run takes the key. A run that already let it go is left as it is. A public access token is refused with 403.

Request body IdempotencyKeyResetRequest

Reset an idempotency key: request body
FieldDescription
taskstring requiredThe task's ID.
keystring requiredThe key as the runs were started with it: a submission's idempotency_key, or the key an in-task trigger or a wait passed.
environmentstring | nullThe environment. Default: an API key's own, or the control plane's for the operator token. An API key may name only its own.
parent_run_idstring | nullThe run whose scope the key is in, as Trigger.dev's parentRunId: for a key an in-task trigger or a wait inside that run passed as a plain string. Required for a key held only in parent runs' scopes.

Responses

  • 200What the reset released. IdempotencyKeyReset
  • 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
  • 403The credential is valid but may not read this resource. Error
  • 404parent_run_id names no run in the environment, or the API key names another environment. Error
  • 422The JSON body did not match the request schema (text), or the key is held only by children in-task triggers started with it in their parent run's scope and parent_run_id is missing (JSON, naming parent_run_id); nothing was released. Error
Fields of IdempotencyKeyReset
IdempotencyKeyReset fields
FieldDescription
taskstring required
keystring required
environmentstring required
parent_run_idstring (uuid)The run whose scope the key was reset in, when the request named one.
releasedinteger requiredHow many runs let the key go; 0 when no run held it.