---
title: "Cancel a queued run and refund its credit (queued only)"
method: POST
path: "/v1/backtests/{id}/cancel"
---

# Cancel a queued run and refund its credit (queued only)

`POST /v1/backtests/{id}/cancel`

## Request

- Base URL: `https://app.texttoquant.com/api`
- URL: `https://app.texttoquant.com/api/v1/backtests/{id}/cancel`
- Auth: one of:
  - API key in header `x-api-key`
  - HTTP bearer

Cancels a run that is still queued and refunds the credit it was metered at enqueue. A run already computing is not stopped (status: running); a finished run is never refunded (status: completed).

## Path parameters

- `id` string, uuid, required

## Response `200`

Success

- object
  - `success` true, required
  - `data` object, required
    - `analysisId` string
    - `status` 'cancelled' | 'running' | 'completed' | 'failed' | 'not_found'
    - `refunded` boolean
    - `reason` string

---

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