> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tradara.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Archive and unarchive an account

> Hide one account from the trader list, or put it back, without closing the account.

A firm API key (`X-Tradara-Api-Key`) can call both routes. The key needs `accounts:write` and can only act on accounts in its firm. Traders cannot archive or unarchive their own account.

Archive hides the account from the trader account list (`GET /v1/accounts/me` omits it) and keeps the record. Cash, fills, and history stay on the same `account_id`. [Replace account](https://docs.tradara.com/prop-firm/provisioning/replace-account.md) is the route that closes an account and mints a new one.

## Archive

```http theme={null}
POST /v1/accounts/{account_id}/archive
```

`operationId: archiveAccount`

No request body.

Tradara flattens the account first: it cancels working orders and submits offset orders for open positions, the same way [flatten](https://docs.tradara.com/prop-firm/operations/flatten-and-cancel.md) does. It then sets `status` to `archived`, stores the previous status in `status_before_archive`, and sets `archived_at`. Lockout fields are left as they are.

```bash theme={null}
curl -X POST "$TRADARA_BASE_URL/v1/accounts/$ACCOUNT_ID/archive" \
  -H "X-Tradara-Api-Key: $TRADARA_API_KEY"
```

### Response — `200 OK`

```json theme={null}
{
  "item": {
    "id": "5b1c8a2e-9f2d-4d3c-b6f0-2b6c5b6e1f9a",
    "account_name": "ONYXEV1234",
    "status": "archived",
    "status_before_archive": "active",
    "archived_at": "2026-10-30T16:00:00Z"
  },
  "flatten": {
    "cancelled_count": 1,
    "closed_count": 1,
    "cancel_errors": [],
    "close_errors": []
  }
}
```

`item` is the account row after the status change. `flatten` is the cancel/close summary. `closed_count` is offset orders submitted, not fills confirmed. A non-empty `cancel_errors` or `close_errors` array means the flatten was incomplete and the account is still archived. Read [open positions](https://docs.tradara.com/prop-firm/operations/read-orders-positions.md) until the book is flat.

Calling archive again on an account that is already `archived` flattens again and returns `200` with that same row.

Firm WebSocket and webhooks emit `accounts.updated` and `accounts.status_changed` with `status: archived`. When the account has no lockout reason, `status_change_reason` is `status_update`.

> [!WARNING]
>
> Flatten runs before the status check. A closed account is rejected with `409` after that flatten attempt. Use [replace](https://docs.tradara.com/prop-firm/provisioning/replace-account.md) when the account should be closed.

## Unarchive

```http theme={null}
POST /v1/accounts/{account_id}/unarchive
```

`operationId: unarchiveAccount`

No request body.

Restores `status` from `status_before_archive`. When that value is empty, status becomes `active`. Clears `status_before_archive` and `archived_at`, and returns the account to the trader account list. This call does not flatten, and it does not change balances or lockout.

```bash theme={null}
curl -X POST "$TRADARA_BASE_URL/v1/accounts/$ACCOUNT_ID/unarchive" \
  -H "X-Tradara-Api-Key: $TRADARA_API_KEY"
```

### Response — `200 OK`

```json theme={null}
{
  "item": {
    "id": "5b1c8a2e-9f2d-4d3c-b6f0-2b6c5b6e1f9a",
    "account_name": "ONYXEV1234",
    "status": "active",
    "status_before_archive": null,
    "archived_at": null
  }
}
```

There is no `flatten` object on this response.

An account that is not `archived` is returned unchanged with `200`. A failed account that was archived comes back as `failed`. Clear that with [unbreach](https://docs.tradara.com/prop-firm/operations/unbreach-account.md) when the trader should be active again.

Firm WebSocket and webhooks emit `accounts.updated` and `accounts.status_changed` with the restored `status`.

## Errors

| HTTP | Meaning |
| - | - |
| `400` | `account_id` is not a UUID. |
| `403` | The caller is the trader rather than a firm operator. |
| `404` | Account is not in your firm, or the API key lacks `accounts:write`. |
| `409` | Archive of a closed account (`closed accounts cannot be archived`). |
| `502` | Archive could not cancel orders and flatten positions. The account status is unchanged. Retry. |
| `503` | Orders service is not configured, so archive cannot flatten. The account status is unchanged. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.