# Stop a run you started

> Stop an eligible run using the idempotency key it was started with.

Source: https://docs.fous.com/api-reference/cancelQuery

`POST /v1/query/cancel`

Stops the run that was started with this Idempotency-Key and X-Fous-Stoppable: 1 (a Studio run). A stop recorded before the run is charged wins: the run ends, uncharged, and its own stream says so; one recorded after loses.

Authentication: `Authorization: Bearer $FOUS_API_KEY`.

## Request body

Required. JSON.

- `idempotency_key` (string, required)

## Response 202

Stop recorded

- `success` (true, required)
- `data` (object, required)
  - `status` ("stopping", required)

## Errors

Every error uses the Error schema: branch on `error.code`. Codes are listed at https://docs.fous.com/guides/errors.

- 400
- 401 (headers: WWW-Authenticate)
- 402
- 403
- 404
- 408
- 409
- 410
- 413
- 422
- 429 (headers: Retry-After)
- 500
- 502
- 503 (headers: Retry-After)
- 504

## Example request

```bash
curl 'https://api.fous.com/v1/query/cancel' \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"idempotency_key":"your-original-run-key"}'
```
