---
title: "Replay a task run's event"
method: POST
path: "/task_runs/{id}/replay"
tags: ["TaskRuns"]
---

# Replay a task run's event

`POST /task_runs/{id}/replay`

## Request

- Base URL: `https://api.crevio.co/v1`
- URL: `https://api.crevio.co/v1/task_runs/{id}/replay`
- Auth: API key in header `Authorization`

Run the task again on the exact event an earlier run received (its `trigger_event`), not on whatever is newest now. Use it when an event-triggered run failed, was skipped, or did the wrong thing. Starts a new run with `replay_of` set to this run; it skips the task's condition, as Run now does. A real replay does everything the task normally does, sends included, so check what the original run already did first. Pass `test_run: true` to replay it as a test run: writes refused, deliveries captured. 422 `no_trigger_event` if no event started this run, 402 `insufficient_credits` if the account is out of AI credits, 409 if the task already has a run in flight or the account is at its run limit.

## Path parameters

- `id` string, required

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `test_run` boolean: Replay as a test run: real research, but writes are refused and deliveries are captured on the run. Defaults to false.

## Response `202`

Accepted — the replay runs in the background on a new run; poll GET /task_runs/{id}.

- AiTaskRun
  - `id` string, required
  - `object` string, required
  - `task_id` string, required
  - `task_name` string, required
  - `chat_id` string, nullable, required: The run's own conversation (`aichat_...`): what it read, called and said. Read it with `search_chats`.
  - `status` 'pending' | 'running' | 'completed' | 'failed' | 'needs_input' | 'timed_out' | 'unknown' | 'skipped', required
  - `summary` string, nullable, required
  - `error_message` string, nullable, required
  - `test_run` boolean, required
  - `input_tokens` integer, required
  - `output_tokens` integer, required
  - `credits_consumed` integer, required
  - `tool_calls_count` integer, required
  - `duration_ms` integer, nullable, required
  - `started_at` string, date-time, nullable, required
  - `completed_at` string, date-time, nullable, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `skip_reason` 'condition' | 'no_paid_plan_or_credits' | 'no_recent_activity' | 'no_task_activity' | 'no_personal_sources' | 'wake_gate' | 'wake_limit' | 'rate_limited' | 'misfire' | 'task_busy' | 'account_at_capacity' | 'null', nullable, required
  - `skip_count` integer, required
  - `delivery_status` 'delivered' | 'not_delivered' | 'not_requested' | 'unknown', required
  - `completion` 'verified' | 'recorded' | 'recovered' | 'null', nullable, required: How the agent closed a completed run: `verified` (it re-checked the result), `recorded` (it reported without re-checking), or `recovered` (it never reported; `summary` is its last message). Null unless an agent turn completed the run.
  - `trigger_source` 'scheduled' | 'event' | 'manual', required
  - `trigger_event` object, nullable, required: The event that started this run, `{type, data}`, exactly as the run received it; `data` matches the event's webhook payload. Null for a run no event started. POST /task_runs/{id}/replay runs the task again on it.
  - `replay_of` string, nullable, required: The run (`trun_...`) whose event this run replays. Null unless started by POST /task_runs/{id}/replay.
  - `captured_deliveries` unknown[], required
    - unknown
  - `pending_approval_ids` unknown[], required
    - unknown

## Other responses

- `401`: Authentication required
- `402`: Payment required — the account is out of AI credits (`insufficient_credits`).
- `403`: Forbidden
- `404`: Resource not found
- `409`: Conflict — the task already has a run in flight (`task_busy`), the account is at its concurrent run limit (`account_at_capacity`), or the task expired (`expired`).
- `422`: No event started this run (`no_trigger_event`), so there is nothing to replay.
- `429`: Rate limit exceeded — 600 requests per minute per credential. Retry after the number of seconds in `Retry-After`.
- `500`: Internal server error

---

[API](https://skmtc.dev/crevio/apis/crevio-api-v1.md) · [All operations](https://skmtc.dev/crevio/apis/crevio-api-v1/llms.txt) · [OpenAPI document](https://skmtc.dev/crevio/apis/crevio-api-v1/revisions/2219f18ad651?raw)
