Improved

Per-position error details documented on close-all-positions endpoints

Documents the per-position result returned when closing all open positions. The 207 response contains one entry per position: when status is 200, body is the closing Order; for any other status, body is the error object explaining why that position was not closed.

  • Adds a ClosePositionError schema describing the per-position rejection payload.
  • Adds a documented 422 response for request-level failures, with an example for an invalid cancel_orders value. Request-level failures return a single error and no per-position results.
  • Documents optional fields the server can include on the shared Error schema: symbol, existing_qty, held_for_orders, and available.
  • Documents code on the Error schema as the Alpaca error code (usually the HTTP status followed by a five-digit suffix) and message as the human-readable rejection reason.
  • Adds partial-close response examples.

No wire change: the response shape is what the API already returns, and the new properties are optional.

Broker API

  • DELETE /v1/trading/accounts/{account_id}/positions

Trading API

  • DELETE /v2/positions