# Delete envelope

`DELETE /v1/accounts/{accountId}/envelopes/{envelopeId}`

Delete an envelope once every document of it is closed: certificated, declined, cancelled, expired or failed. Before that it answers `409` with code `EnvelopeOpen`: cancel it first. The envelope is gone: it is no longer listed and reads `404`, and a create retried with its `Idempotency-Key` no longer answers it. Its documents stay as ordinary documents, with their certificates, downloads and webhooks; `GET /v1/documents/{documentId}?expand=envelope_id` reads null for them.

**Authentication:** Bearer access token (`Authorization: Bearer ...`) or API key (`X-Api-Key` header).

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `accountId` | path | string | yes | Workspace account ID. |
| `envelopeId` | path | string | yes | The envelope ID. |

## Responses

### 200 — Envelope deleted

```json
{
    "data": [],
    "status": 200,
    "message": ""
}
```

### 403 — An OAuth app's token lacks `documents:write` (`InsufficientScope`). Also a member deactivated in the workspace, a workspace scheduled for deletion, or an OAuth token of another workspace.

```json
{
    "status": 400,
    "code": "PlanRestricted",
    "message": "Bad request.",
    "data": null,
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```

### 404 — The requested resource does not exist.

```json
{
    "status": 400,
    "message": "Bad request.",
    "data": null,
    "code": "PlanRestricted",
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```

### 409 — A document of the envelope is still open (`EnvelopeOpen`).

```json
{
    "status": 400,
    "code": "PlanRestricted",
    "message": "Bad request.",
    "data": null,
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```

### 401 — Missing or invalid credentials.

```json
{
    "status": 400,
    "message": "Bad request.",
    "data": null,
    "code": "PlanRestricted",
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```

### 500 — Unexpected server error.

```json
{
    "status": 400,
    "message": "Bad request.",
    "data": null,
    "code": "PlanRestricted",
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```
