# Discard draft

`DELETE https://postcraft.io/api/v1/templates/{id}/draft`

Throws away unpublished changes, leaving the published copy untouched. The discarded states stay in the template's history. Succeeds when there is no draft. Bearer tokens must match the template and must not be readonly.

## Authentication

Send one of these headers:

- `x-api-key: <key>`: Long-lived account credential. Create one from the dashboard.
- `Authorization: Bearer <token>`: Short-lived presigned token scoped to a single template (minted via /presigned-url).

## Parameters

| Name | In | Type | Required | Description |
| ---- | -- | ---- | -------- | ----------- |
| `id` | path | string | yes |  |

## Responses

### 200

Draft discarded, or there was none.

| Field | Type | Required | Description |
| ----- | ---- | -------- | ----------- |
| `updatedAt` | string | yes |  |
| `hasDraftChanges` | boolean | yes |  |

### Errors

Every error answers with `{ "error": { "code": string, "message": string } }`.

| Status | Meaning |
| ------ | ------- |
| 400 | Invalid input. |
| 401 | Missing or invalid credential. |
| 403 | Authenticated but not allowed. |
| 404 | Not found. |
| 413 | Payload exceeds size limit. |
| 422 | Template render failed. |
| 429 | Rate limited. |

The whole API as an OpenAPI document: https://postcraft.io/api/v1/openapi.json
