# Restore a deleted mailbox

Restores a soft-deleted mailbox from trash within its 7-day retention window. Re-binds the primary address if still available.

## `POST /api/v1/identities/{identityId}/restore`

### Path parameters

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

### Responses

**200** — Restore result and restored mailbox details

`application/json` → MailboxRestoreResult

- `accountId` (string | null, required) — Account ID, or null
- `addressChanged` (boolean, required) — True if the primary address had to be cleared because it was claimed while deleted
- `id` (string, required) — Mailbox ULID
- `primaryAddress` (string | null, required) — Restored primary address, or null
- `quotaBytes` (integer | null, required) — Storage quota in bytes, or null
- `restored` (boolean, required) — True if the mailbox was restored

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

`application/json` → ErrorBody

**404** — No restorable mailbox found

`application/json` → ErrorBody

**409** — not_deleted — mailbox is active or already restored

`application/json` → ErrorBody

**410** — gone — retention window elapsed or mailbox was permanently purged

`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 POST 'https://api.open.email/api/v1/identities/{identityId}/restore' \
  -H 'Authorization: Bearer oek_…'
```

## TypeScript SDK

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

```ts
const mailboxRestoreResult = await openemail.identities.restore(identityId)
```
