---
title: "v2_delete_runs_run_id | Python SDK | AEO API"
description: "Request cancellation for a job, managed run or audit. Pass the qualified run ID and an optional reason."
url: "https://aeoapi.dev/docs/sdks/python/v2-delete-runs-run-id"
canonical: "https://aeoapi.dev/docs/sdks/python/v2-delete-runs-run-id"
last_updated: "2026-11-30"
---

# v2_delete_runs_run_id

Request cancellation for a job, managed run or audit. Pass the qualified run ID and an optional reason.

See the REST reference for [`DELETE /v2/runs/{run_id}`](https://aeoapi.dev/docs/api-reference#delete-v2-runs-run_id).

## Signature

```
v2_delete_runs_run_id(
    run_id: str,
    *,
    reason: str | None = None,
    idempotency_key: str | None = None,
) -> Response[Any]
```

## Parameters

**`run_id`**

Qualified run ID, including its prefix. Copy it from the run response.

**`reason`**

Why you are cancelling the run, in 1 to 500 characters.

**`idempotency_key`**

Value for Idempotency-Key. For requests that require this header, the SDK generates a UUID if you omit it. Send the original value if your application repeats the same write.

## Return value

A job cancellation returns HTTP 202 and the job record in response.data. Read its state to check whether it has stopped.

## Errors

- AeoApiError includes the HTTP status, error code and request ID. An invalid key raises UnauthenticatedError. Check the key’s scopes if you receive ForbiddenError.
- Invalid arguments can raise ValueError or TypeError before the SDK sends a request.
- AeoTransportError means the request could not reach the API after any allowed retries, or the response could not be read as JSON.
- PreconditionFailedError means the revision has changed. Read the current record before editing it again.
- For a conflict, read the error message before repeating the write. Check the saved record for a competing edit or a repeated request.

## Python example

```
import os
from aeo_sdk import AeoClient

with AeoClient(os.environ["AEO_API_KEY"], base_url=os.environ["AEO_API_BASE_URL"]) as client:
    response = client.v2_delete_runs_run_id(
        run_id='job:00000000-0000-4000-8000-000000000001',
        reason='Requested by the report owner',
    )
    print(response.body)
```

## Async example

```
import asyncio
import os
from aeo_sdk import AsyncAeoClient

async def main():
    async with AsyncAeoClient(os.environ["AEO_API_KEY"], base_url=os.environ["AEO_API_BASE_URL"]) as client:
        response = await client.v2_delete_runs_run_id(
            run_id='job:00000000-0000-4000-8000-000000000001',
            reason='Requested by the report owner',
        )
        print(response.body)

asyncio.run(main())
```

## Requests by feature

### AI answer collection and runs

- [Cancel a job](https://aeoapi.dev/docs/features/ai-answer-collection-and-runs/delete-runs-run-id-job)
- [Cancel a managed run](https://aeoapi.dev/docs/features/ai-answer-collection-and-runs/delete-runs-run-id-managed)

### Site audits and page checks

- [Cancel an audit](https://aeoapi.dev/docs/features/site-audits-and-page-checks/delete-runs-run-id-audit)

See [Python client setup](https://aeoapi.dev/docs/sdks/python) for the environment variables, response properties and retry settings.
