# Delete Run

- **Method:** `POST`
- **Path:** `/api/v1/runs/{run_id}/delete`
- **Operation ID:** `delete_run`
- **Tags:** runs

Delete one of your runs, for good: its traces, screenshots, video and checkpoints, its own documents
(the spec, the artifact), and its record - the run, its sessions, issues, verdicts, opportunities and
retests. Every route then answers the run with the 404 an unknown run gets.

Your own tenant's runs and no other: another tenant's run is that same 404, so a delete neither reaches
nor confirms a run that is not yours. Asking again answers what the first delete did, so a retry is safe.
A run that is still running, or has a retest still running, is a 409 and nothing is deleted: cancel it
and delete it once it has stopped. What the run was billed stays in your usage.

## Effective servers

- `https://api.saram.sh`

  Saram

## Authentication

- **HTTPBearer**: HTTP bearer

  a Saram API key (`sk_saram_<env>_...`) or a person's AuthKit access token, as `Authorization: Bearer <credential>`. Both are told apart by shape and produce the same principal.

## Path parameters

- **`run_id` (required)**: `string`

## Responses

### 200 The run is deleted, now or by an earlier request.

**Content type:** `application/json`

schema: `RunDeleted`, no additional properties

A run its owner deleted: its evidence, its recordings, and its record - the run, its sessions, issues,
verdicts, opportunities, retests and artifact - are gone, and every route now answers the run with the 404
an unknown run gets. Asking again answers this same body, so a retried delete is safe.

What is kept is what the run was billed: the usage ledger outlives a deleted run as it outlives expired
evidence, so a month's usage still counts it.

- **`deleted_at` (required)**: `string`, format: `date-time`

  When it was deleted: the first time it was asked, however often since.
- **`objects_deleted` (required)**: `integer`

  How many stored objects went with it - traces, screenshots, video, checkpoints and the run's own documents. 0 for a run that had not recorded anything.
- **`run_id` (required)**: `string`

  The run that was deleted.

**Example:**

```json
{
  "run_id": "",
  "deleted_at": "",
  "objects_deleted": 1
}
```

### 403 the API key lacks the required scope

### 409 the run, or a retest of it, is still running: nothing is deleted under something still writing to it. Cancel it and delete it once it has stopped

### 422 Validation Error

**Content type:** `application/json`

schema: `HTTPValidationError`

- **`detail`**: `array`

  **Items:**

  schema: `ValidationError`
  - **`loc` (required)**: `array of (string | integer)`
  - **`msg` (required)**: `string`
  - **`type` (required)**: `string`
  - **`ctx`**: `object`
  - **`input`**: `any`

**Example:**

```json
{
  "detail": [
    {
      "loc": [
        ""
      ],
      "msg": "",
      "type": "",
      "input": null,
      "ctx": {}
    }
  ]
}
```

## Schemas

- `HTTPValidationError` — shown above.
- `RunDeleted` — shown above.
- `ValidationError` — shown above.
