# Delete an account

Soft-deletes an account, starting a grace period before final data purge.

## `DELETE /api/v1/accounts/{accountId}`

### Path parameters

- `accountId` (string, required) — Account ULID identifier

### Query parameters

- `purge` ("true" | "false") — Set to 'true' to purge immediately bypassing the grace window (system callers only)

### Responses

**200** — Account deletion initiated successfully

`application/json` → AccountDeleteResult

- `deleted` (boolean, required) — True if the account was soft-deleted
- `deletedAt` (integer <int64>, required) — Soft-deletion timestamp in epoch seconds
- `id` (string, required) — Account ULID identifier
- `purgeAt` (integer <int64>, required) — Timestamp when the account and its data will be permanently wiped in epoch seconds
- `restorable` (boolean, required) — True if the account can still be restored before purgeAt

**400** — validation_failed

`application/json` → ErrorOrValidation

**401** — unauthorized: the bearer credential is missing, malformed, expired, or revoked. Carries a `WWW-Authenticate: Bearer` challenge

`application/json` → ErrorBody

**403** — system_credentials_required — only a system caller may pass ?purge=true

`application/json` → ErrorBody

**404** — Account not found or not accessible to this principal

`application/json` → ErrorBody

**409** — transition_in_progress — retry after the lifecycle transition settles

`application/json` → ErrorBody

**410** — account_purged — account has already been permanently purged

`application/json` → ErrorBody

**502** — upstream_unavailable — lifecycle transition or purge scheduling unavailable

`application/json` → ErrorBody

**503** — temporary_failure: the platform's storage could not answer just now; retry after the Retry-After window. Any operation can answer this. A write that got it may have been applied, so retry it with the same idempotency key where it takes one, or read the state back first (see Transient failures in the API description)

`application/json` → ErrorBody

### Example request

```bash
curl -X DELETE 'https://api.open.email/api/v1/accounts/{accountId}' \
  -H 'Authorization: Bearer oek_…'
```

## TypeScript SDK

[`openemail.accounts.delete`](/docs/sdks/typescript/accounts/delete)

```ts
const accountDeleteResult = await openemail.accounts.delete(accountId)
```
