# cancel_test

> Cancel a test while it is still in review, before its ads run, with everything paid refunded.

**POST /api/agent/tests/{id}/cancel · MCP tool cancel_test · Free**
`cancel_test` stops a test that is still `in_review`. Everything paid, the $29 launch fee included, goes back to the paying wallet in USDC on Base. A sandbox test paid test money, so nothing is owed for it.

## Parameters

| Name | Type | Description |
|---|---|---|
| `id` | string | **Required.** The test's id. |
| `access_token` | string | Needed when the test was paid without a key. Over REST, send it as the `X-Test-Token` header or `?token=`. |

With a key, the key needs the `test` scope.

## Request

```bash title="With a key"
curl -X POST -H "Authorization: Bearer deca_sk_…" \
  https://app.decalabs.ai/api/agent/tests/TEST_ID/cancel
```

```bash title="With its access token"
curl -X POST -H "X-Test-Token: deca_tt_…" \
  https://app.decalabs.ai/api/agent/tests/TEST_ID/cancel
```

```json title="MCP"
{ "name": "cancel_test", "arguments": { "id": "TEST_ID", "access_token": "deca_tt_…" } }
```

## Response

The test, now `cancelled`, with the refund owed:

```json
{
  "test": {
    "id": "…",
    "state": "cancelled",
    "refund": { "usd": 629, "tx": null, "status": "owed" },
    "next": "Cancelled before it was made. Everything paid, the launch fee included, is refunded to the paying wallet.",
    "…": "…"
  }
}
```

Calling it again on a cancelled test answers `409 cannot_cancel`; the test stays cancelled.

## After review

A test past review answers `409 cannot_cancel`. Once its ads are being made or are running, write to [hello@decalabs.ai](mailto:hello@decalabs.ai) to stop it: the ad budget not spent is refunded.

Source: https://app.decalabs.ai/docs/tools/cancel-test
