# Delete a mailbox

Soft-deletes a mailbox with a 7-day retention window for recovery. Pass purge=true to immediately queue the mailbox for permanent deletion.

## `DELETE /api/v1/identities/{identityId}`

### Path parameters

- `identityId` (string, required) — Identity ULID identifier

### Query parameters

- `purge` ("true" | "false") — Set to 'true' to permanently purge the mailbox immediately without a 7-day retention window. A system key's, or redundant on a mailbox created ephemeral (#483); from an account key on any other mailbox it is refused 403 system_credentials_required — the window is the undo a leaked key must not be able to waive

### Responses

**200** — Deletion outcome and undo window timestamps

`application/json` → MailboxDeleteResult

- `deleted` (boolean, required) — True if the mailbox was deleted
- `restorable` (boolean, required) — True if the mailbox can still be restored
- `purged` (boolean) — True if the mailbox was permanently purged immediately
- `restorableUntil` (integer <int64>) — Timestamp until which restore is allowed in epoch seconds

**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 (purge=true from an account key on a mailbox not created ephemeral, #483) | account_credentials_required — a DOMAIN-SCOPED api key named a mailbox that is also routed on a domain outside its scope. Restore rebinds the mailbox's primary address, so deleting one primaried elsewhere could not be undone without writing a route on a domain this key does not hold; the account's own key may delete it

`application/json` → ErrorBody

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

`application/json` → ErrorBody

**409** — mailbox_is_group_persona — this identity is a group's persona (its archive and sending identity); delete the group route instead, which tears the persona down with it

`application/json` → ErrorBody

**503** — temporary_failure (with Retry-After): under the object directory, the account's identity census could not be updated just now, so the write that would move it was not made; retry the same request after the Retry-After window

`application/json` → ErrorBody

### Example request

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

## TypeScript SDK

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

```ts
const mailboxDeleteResult = await openemail.identities.delete(identityId)
```
