Replay run
Creates a new run with the same payload and options as the original run, in the same environment. Send a body to override the payload, metadata, or trigger options for the new run. The body is optional; an empty body replays the run unchanged.
secretKeyAuthorizationBearer <token>Use a named environment API key. It starts with tr_dev_sk_, tr_prod_sk_, tr_stg_sk_, etc.
Create a named API key in the API Keys section of your Trigger.dev project dashboard. Choose the narrowest access preset that supports your integration.
Our TypeScript SDK will default to using the value of the TRIGGER_SECRET_KEY environment variable if it is set. If you are using the SDK in a different environment, you can set the key using the configure function.
import { configure } from "@trigger.dev/sdk";configure({ accessToken: "tr_dev_sk_1234" });runId*stringThe ID of an run, starts with run_. The run ID will be returned when you trigger a run on a task.
application/json- body
payload?unknownThe payload for the new run. Omit it to reuse the original run's payload.
payloadType?stringHow payload is encoded. Defaults to application/json. With application/super+json, payload must be a SuperJSON string, which keeps types like Date and BigInt. The SDK sends this automatically.
"application/json""application/super+json"metadata?Metadata for the new run. Omit it to reuse the original run's metadata.
tags?|array<>queue?stringThe name of an existing queue in the environment to run on.
concurrencyKey?stringThe concurrency key for the new run.
machine?stringThe machine preset for the new run.
"micro""small-1x""small-2x""medium-1x""medium-2x""large-1x""large-2x"version?stringLock the new run to this deployed version, for example 20250101.1. Defaults to the current version.
region?stringThe region to run in. Defaults to the original run's region.
delay?stringDelay the new run, as a duration (1h30m) or an ISO 8601 date.
ttl?|How long the new run can stay queued before it expires, as a duration string (10m) or a number of seconds.
idempotencyKey?stringAn idempotency key for the new run. A repeated request with the same key returns the same run.
length <= 2048idempotencyKeyTTL?stringHow long the idempotency key is valid, as a duration (1h).
maxAttempts?integerThe maximum number of attempts for the new run.
1 <= valuemaxDuration?numberThe maximum duration of the new run in seconds.
priority?numberPriority offset in seconds. Higher values are dequeued sooner.
Successful request
application/json- response
id?stringThe ID of the new run.
import { runs } from "@trigger.dev/sdk";const handle = await runs.replay("run_1234");const withOverrides = await runs.replay("run_1234", { payload: { userId: "user_456" }, tags: ["replayed"], delay: "10m",});{ "id": "string"}Was this page helpful?
Last updated
Edit on GitHub