# Delete a draft document (move it to the Trash)

> DELETE /api/v1/documents/{id}: Delete a draft document (move it to the Trash).

`DELETE https://appliflo.com/api/v1/documents/{id}`

Moves a draft document to the workspace Trash. It disappears from every list and read (404 from then on) and can be restored in the web app for 30 days, after which it is permanently deleted with its fields and files. Only drafts can be deleted: a document with any envelope that is not a draft (sent, completed, sealed, voided...) is refused with 409 and is never deleted. An API key acts as a workspace integration, so it may delete only documents that no person uploaded (documents created through the API); a person's upload returns 403. Permanent deletion is not available on the API.

Send your API key in the `Authorization: Bearer` header. Every response is JSON: `{ success, data, error }`.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `id` | path | yes | Document id |

## Responses

| Status | Description |
| --- | --- |
| 200 | Moved to the Trash. |
| 401 | Missing or invalid API key, or `api_key_expired` for a key past its expiry. |
| 403 | The API key's workspace does not have access to this resource, or `insufficient_scope` (with `required_scope`) for a key without the scope this route needs. |
| 404 | Resource not found in this workspace. |
| 409 | Only drafts can be deleted: this document has been sent for signature. |
| 422 | Request failed validation. |
| 500 | Internal error. |

## 200 response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `success` | true | yes |  |
| `data` | object | yes |  |
| `data.id` | string | yes |  |
| `data.name` | string | yes |  |
| `data.deleted_at` | string | yes | Format: date-time |
| `data.days_left` | integer | yes | Days until the document is permanently deleted (30 on a fresh delete) |

See also: [Errors](https://dev.appliflo.com/guides/errors), [Rate limits](https://dev.appliflo.com/guides/rate-limits), [Idempotency](https://dev.appliflo.com/guides/idempotency).
