> For the complete documentation index, see [llms.txt](https://diffio.ai/llms.txt). This page is also available as HTML at https://diffio.ai/docs/api-reference/delete-transcript-draft/.

# Delete the transcript draft

Deletes a generation's saved transcript draft and advances `revision` so stale saves from before the delete are rejected.

DELETE `https://api.diffio.ai/v2/projects/{project_id}/generations/{generation_id}/transcript/draft`

- Key scope: `generations:write`
- Auth header: `Authorization: Bearer <apiKey>`
- Body: None

## Request

Pass `project_id` and `generation_id` in the path, and optional `revision` in the query string.

### Path parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `project_id` | string | Yes | Unique identifier of the project. |
| `generation_id` | string | Yes | Unique identifier of the generation within the project. |

### Query parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `revision` | string | No | Optional opaque `revision` last read; refuses the delete with `409` (`revision_conflict`) if a newer draft was saved since. |

### Headers

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `Diffio-End-User` | string | No | Optional end-user identifier (up to 128 characters). Scopes the request to that end user's projects; omit to act across the whole account. |

## Example request

**Python**

```python
import os
from diffio import DiffioClient

key = os.environ["DIFFIO_API_KEY"]
client = DiffioClient(api_key=key)

deleted = client.transcripts.delete_draft(
    "62f62565-049f-5e7e-bbd2-9de0cf7ddbfe",
    "ce832a32-a1ce-516a-b8bd-75457bd8517f",
    revision="1",
)
```

**Node.js**

```javascript
import { DiffioClient } from "diffio"

const client = new DiffioClient({
  apiKey: process.env.DIFFIO_API_KEY,
})

const deleted =
  await client.transcripts.deleteDraft(
    "62f62565-049f-5e7e-bbd2-9de0cf7ddbfe",
    "ce832a32-a1ce-516a-b8bd-75457bd8517f",
    { revision: "1" },
  )
```

**cURL**

```bash
curl -X DELETE "https://api.diffio.ai/v2/projects/62f62565-049f-5e7e-bbd2-9de0cf7ddbfe/generations/ce832a32-a1ce-516a-b8bd-75457bd8517f/transcript/draft?revision=1" \
  -H "Authorization: Bearer $DIFFIO_API_KEY"
```

## Response

Returns `deleted: true` and the current post-delete `revision`.

Success: `200`

### Response fields

| Field | Type | Present | Description |
| --- | --- | --- | --- |
| `object` | string | Always | Resource type, always `"transcript_draft"`. |
| `project_id` | string | Always | Identifier of the parent project. |
| `generation_id` | string | Always | Identifier of the generation. |
| `deleted` | boolean | Always | Always `true`. |
| `revision` | string | Always | Revision representing the deleted state (unchanged when nothing was saved); pass to the next save. |

## Example response (200)

**Successful response**

```json
{
  "object": "transcript_draft",
  "project_id": "62f62565-049f-5e7e-bbd2-9de0cf7ddbfe",
  "generation_id": "ce832a32-a1ce-516a-b8bd-75457bd8517f",
  "deleted": true,
  "revision": "2"
}
```

## Return codes

- `200` Draft deleted (or already absent) and the current `revision` is returned.
- `400` `revision` query parameter is not one a draft answer gave, or `Diffio-End-User` exceeds 128 characters. [`invalid_parameter`](https://diffio.ai/docs/api-reference/errors/#invalid_parameter) [`invalid_header`](https://diffio.ai/docs/api-reference/errors/#invalid_header)
- `403` Key is inactive or lacks `generations:write`. [`permission_denied`](https://diffio.ai/docs/api-reference/errors/#permission_denied)
- `404` Project not found, or generation not found. [`project_not_found`](https://diffio.ai/docs/api-reference/errors/#project_not_found) [`generation_not_found`](https://diffio.ai/docs/api-reference/errors/#generation_not_found)
- `409` Query `revision` does not match the current draft revision, reported in `details.current_revision`. [`revision_conflict`](https://diffio.ai/docs/api-reference/errors/#revision_conflict)
- **`401` `405` Same on every endpoint**

  - `401` Missing API key (code missing_api_key), or invalid API key (code invalid_api_key).
  - `405` HTTP method not supported on this path; check the Allow header (code method_not_allowed).

### Example error response

Errors are JSON: an `error` object with `code`, `message` and `request_id`. An unrecognized key returns `401`:

**Error response**

```json
{
  "error": {
    "code": "invalid_api_key",
    "message": "Invalid API key.",
    "request_id": "dead773b60e148fd9e22d680a22fa701"
  }
}
```

## Notes

- Deleting when no draft is saved still succeeds with `200` (`deleted: true`) unless a stale `revision` query parameter was passed.
- Deleting a draft records a tombstone revision so an older editor session saving with a pre-delete `revision` receives `409` (`revision_conflict`).

## Related pages

- Previous: [Save the transcript draft](https://diffio.ai/docs/api-reference/save-transcript-draft/): Save an editor's JSON draft state (up to 900,000 bytes) for a generation's transcript.
- Next: [Ask the edit assistant](https://diffio.ai/docs/api-reference/create-transcript-assistant-turn/): Start an asynchronous edit-assistant chat turn on a finished Pro generation's transcript.

- [Full API guide](https://diffio.ai/docs/developers/full-api-guide/): Every topic, limit and concept in one index.
- [Billing](https://diffio.ai/docs/overview/administration/billing/): Starter credit, metering and invoices.
