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 is the route that closes an account and mints a new one.
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 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.
Response — 200 OK
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 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.
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.
Response — 200 OK
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 when the trader should be active again.
Firm WebSocket and webhooks emit accounts.updated and accounts.status_changed with the restored status.

