POST
/
api
/
v1
/
runs
/
{runId}
/
reschedule
import { runs } from "@trigger.dev/sdk/v3";

const handle = await runs.reschedule("run_1234", { delay: new Date("2024-06-29T20:45:56.340Z") });
{
  "id": "run_1234",
  "status": "PENDING_VERSION",
  "taskIdentifier": "my-task",
  "version": 20240523.1,
  "idempotencyKey": "idempotency_key_1234",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "isTest": false,
  "startedAt": "2023-11-07T05:31:56Z",
  "finishedAt": "2023-11-07T05:31:56Z",
  "delayedUntil": "2023-11-07T05:31:56Z",
  "ttl": "1h42m",
  "expiredAt": "2023-11-07T05:31:56Z",
  "tags": [
    "user_5df987al13",
    "org_c6b7dycmxw"
  ],
  "metadata": {
    "foo": "bar"
  },
  "costInCents": 0.00292,
  "baseCostInCents": 0.0025,
  "durationMs": 491,
  "depth": 0,
  "batchId": "batch_1234",
  "triggerFunction": "trigger",
  "payload": {
    "foo": "bar"
  },
  "payloadPresignedUrl": "https://r2.cloudflarestorage.com/packets/yubjwjsfkxnylobaqvqz/dev/run_p4omhh45hgxxnq1re6ovy/payload.json?X-Amz-Expires=300&X-Amz-Date=20240625T154526Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=10b064e58a0680db5b5e077be2be3b2a%2F20240625%2Fauto%2Fs3%2Faws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=88604cb993ffc151b4d73f2439da431d9928488e4b3dcfa4a7c8f1819",
  "output": {
    "foo": "bar"
  },
  "outputPresignedUrl": "https://r2.cloudflarestorage.com/packets/yubjwjsfkxnylobaqvqz/dev/run_p4omhh45hgxxnq1re6ovy/payload.json?X-Amz-Expires=300&X-Amz-Date=20240625T154526Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=10b064e58a0680db5b5e077be2be3b2a%2F20240625%2Fauto%2Fs3%2Faws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=88604cb993ffc151b4d73f2439da431d9928488e4b3dcfa4a7c8f1819",
  "relatedRuns": {
    "root": {
      "id": "run_1234",
      "status": "PENDING_VERSION",
      "taskIdentifier": "my-task",
      "version": 20240523.1,
      "idempotencyKey": "idempotency_key_1234",
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z",
      "isTest": false,
      "startedAt": "2023-11-07T05:31:56Z",
      "finishedAt": "2023-11-07T05:31:56Z",
      "delayedUntil": "2023-11-07T05:31:56Z",
      "ttl": "1h42m",
      "expiredAt": "2023-11-07T05:31:56Z",
      "tags": [
        "user_5df987al13",
        "org_c6b7dycmxw"
      ],
      "metadata": {
        "foo": "bar"
      },
      "costInCents": 0.00292,
      "baseCostInCents": 0.0025,
      "durationMs": 491,
      "depth": 0,
      "batchId": "batch_1234",
      "triggerFunction": "trigger"
    },
    "parent": {
      "id": "run_1234",
      "status": "PENDING_VERSION",
      "taskIdentifier": "my-task",
      "version": 20240523.1,
      "idempotencyKey": "idempotency_key_1234",
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z",
      "isTest": false,
      "startedAt": "2023-11-07T05:31:56Z",
      "finishedAt": "2023-11-07T05:31:56Z",
      "delayedUntil": "2023-11-07T05:31:56Z",
      "ttl": "1h42m",
      "expiredAt": "2023-11-07T05:31:56Z",
      "tags": [
        "user_5df987al13",
        "org_c6b7dycmxw"
      ],
      "metadata": {
        "foo": "bar"
      },
      "costInCents": 0.00292,
      "baseCostInCents": 0.0025,
      "durationMs": 491,
      "depth": 0,
      "batchId": "batch_1234",
      "triggerFunction": "trigger"
    },
    "children": [
      {
        "id": "run_1234",
        "status": "PENDING_VERSION",
        "taskIdentifier": "my-task",
        "version": 20240523.1,
        "idempotencyKey": "idempotency_key_1234",
        "createdAt": "2023-11-07T05:31:56Z",
        "updatedAt": "2023-11-07T05:31:56Z",
        "isTest": false,
        "startedAt": "2023-11-07T05:31:56Z",
        "finishedAt": "2023-11-07T05:31:56Z",
        "delayedUntil": "2023-11-07T05:31:56Z",
        "ttl": "1h42m",
        "expiredAt": "2023-11-07T05:31:56Z",
        "tags": [
          "user_5df987al13",
          "org_c6b7dycmxw"
        ],
        "metadata": {
          "foo": "bar"
        },
        "costInCents": 0.00292,
        "baseCostInCents": 0.0025,
        "durationMs": 491,
        "depth": 0,
        "batchId": "batch_1234",
        "triggerFunction": "trigger"
      }
    ]
  },
  "schedule": {
    "id": "sched_1234",
    "externalId": "user_1234",
    "deduplicationKey": "dedup_key_1234",
    "generator": {
      "type": "CRON",
      "expression": "0 0 * * *",
      "description": "Every day at midnight"
    }
  },
  "attempts": [
    {
      "id": "attempt_1234",
      "status": "PENDING",
      "error": {
        "message": "Something went wrong",
        "name": "Error",
        "stackTrace": "Error: Something went wrong"
      },
      "createdAt": "2023-11-07T05:31:56Z",
      "updatedAt": "2023-11-07T05:31:56Z",
      "startedAt": "2023-11-07T05:31:56Z",
      "completedAt": "2023-11-07T05:31:56Z"
    }
  ]
}

Authorizations

Authorization
string
header
required

Use your project-specific Secret API key. Will start with tr_dev_, tr_prod, tr_stg, etc.

You can find your Secret API key in the API Keys section of your Trigger.dev project dashboard.

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/v3";

configure({ accessToken: "tr_dev_1234" });

Path Parameters

runId
string
required

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

Body

application/json

Response

200
application/json
Successful request

The response is of type object.