Skip to Content

Replay run

Required accessRuns: writewrite:runsAny key with this access, from API keys
POST
/api/v1/runs/{runId}/replay

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.

Authorization

secretKey
headerAuthorizationBearer <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" });

Path Parameters

runId*string

The ID of an run, starts with run_. The run ID will be returned when you trigger a run on a task.

Request Body

application/json
  1. body
payload?unknown

The payload for the new run. Omit it to reuse the original run's payload.

payloadType?string

How 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.

Value in"application/json""application/super+json"
metadata?

Metadata for the new run. Omit it to reuse the original run's metadata.

tags?|array<>
queue?string

The name of an existing queue in the environment to run on.

concurrencyKey?string

The concurrency key for the new run.

machine?string

The machine preset for the new run.

Value in"micro""small-1x""small-2x""medium-1x""medium-2x""large-1x""large-2x"
version?string

Lock the new run to this deployed version, for example 20250101.1. Defaults to the current version.

region?string

The region to run in. Defaults to the original run's region.

delay?string

Delay 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?string

An idempotency key for the new run. A repeated request with the same key returns the same run.

Lengthlength <= 2048
idempotencyKeyTTL?string

How long the idempotency key is valid, as a duration (1h).

maxAttempts?integer

The maximum number of attempts for the new run.

Range1 <= value
maxDuration?number

The maximum duration of the new run in seconds.

priority?number

Priority offset in seconds. Higher values are dequeued sooner.

Response Body

Successful request

application/json
  1. response
id?string

The ID of the new run.

Example Request
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",});
Example Response
{  "id": "string"}

Was this page helpful?

Last updated

Edit on GitHub