> ## Documentation Index
> Fetch the complete documentation index at: https://docs.60db.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Rerun Simulation

> Run the same stories again (against a draft, or the agent as it is now) and compare with the first run

> [!NOTE]
>
> AI Simulation needs an active **Pro** or **Business** plan. On another plan, every simulation endpoint returns `403 POLICY_DENY`.

Run the same stories again and compare the new run with this run (the baseline). This is how to check a fix: a new simulation writes new stories, so its pass rate says nothing about a fix.

Send `draft_id` to run a draft of this run, or `agent: "current"` to run the agent as it is now. With `agent: "current"`, 60db copies the agent's live instructions into a fresh draft and re-runs the stories of the **original** run (a re-run of a re-run does not multiply calls). Only the instructions are current: voice and tools stay as they were when the run was made. While another simulation runs, the re-run waits in the queue (`state: "queued"`). It spends credits like a new run and goes through the same balance check and start rate limit.

## Request

### Headers

**Authorization** `string` *required*

Bearer token with your API key (scope `agents`)

**Content-Type** `string` *required*

application/json

### Path

**runId** `string` *required*

The simulation run `run_id` (UUID) from [Start a simulation](https://docs.60db.ai/api-reference/agents/start-simulation.md)

### Body

**draft\_id** `string`

The draft made from this run. Required unless `agent` is sent

**agent** `string`

`current`: run the agent as it is now. Do not send `draft_id` with it. `repeats` defaults to 3

**max\_credits** `number`

The credit ceiling. Default: the estimate for all calls. The run stops when it reaches this many credits and ends in the state `stopped_budget` with a partial report. Must be more than 0

**estimated\_credits\_per\_call** `number`

Required with `max_credits`. Your estimate of the credits one simulated call uses. Must be more than 0. 60db checks your balance for the lower of `max_credits` and `estimated_credits_per_call` × the number of calls before anything is queued

**repeats** `integer`

1 to 10. Copies of every story, so one call does not decide a story. Default 1, or 3 with `agent: "current"`

**priority** `string` (default: manual)

`manual`, or `ci`. `ci` is only for API keys. Dashboard sessions that send `ci` get `400`

**max\_concurrency** `integer`

1 to 20. How many simulated calls run at once

**max\_calls** `integer`

At least 1. Stop after this many calls

**max\_minutes** `integer`

At least 1. Stop after this many minutes of calls

**baseline\_run\_id** `string`

A run to compare with

## Response

**201 Created**.

```json theme={null}
{ "run_id": "6f1c1e2a-3333-4000-8000-000000000002", "baseline_run_id": "6f1c1e2a-3333-4000-8000-000000000001", "draft_id": "d_8f2", "total": 27, "state": "running" }
```

`state` is `running`, or `queued` with `queue_position` (1 = next) while another simulation runs.

## Errors

| Status | Code | Meaning |
| - | - | - |
| 400 | `VALIDATION_ERROR` | A field is missing or wrong, or both `draft_id` and `agent` were sent |
| 402 | `INSUFFICIENT_CREDITS` | The balance cannot cover the run |
| 403 | `POLICY_DENY` | Your role cannot run simulations, the workspace is not on an active Pro or Business plan, or the API key lacks the `agents` scope |
| 404 | `RUN_NOT_FOUND` | No such run, or the draft was not made from this run |
| 409 | `RUN_NOT_STARTED` | The run itself is still waiting in the queue |

## Example

```bash cURL theme={null}
curl -X POST https://api.60db.ai/agents/simulations/RUN_ID/rerun \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"draft_id": "d_8f2", "max_credits": 20, "estimated_credits_per_call": 0.5}'
```

```bash Check a fix theme={null}
curl -X POST https://api.60db.ai/agents/simulations/RUN_ID/rerun \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"agent": "current"}'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.