Improved
Error details documented on the close all positions endpoint
November 3rd, 2026
Broker API
Documents the per-position result returned when closing all positions for an account. The wire contract is unchanged.
- The 207 response now describes both outcomes: when a result's
statusis200,bodyis the Order created to close the position; for any otherstatus,bodyis the error object explaining why that position was not closed. - Adds a documented 422 response for a request-level failure such as an invalid
cancel_ordersvalue, returned as a singleErrorwith code40010001before any per-position results. - Clarifies that request-level failure responses contain no per-position results, and that positions that fail to close are reported in the 207 response.
- Documents
Error.code(Alpaca error code, usually the HTTP status followed by a five-digit suffix) andError.message, and lists the optional fields the server can include on a rejected close:symbol,existing_qty,held_for_orders, andavailable.
Affected Endpoints
DELETE /v1/trading/accounts/{account_id}/positions