Bulk Mark Sales Orders as Draft
POST/api/sales-orders/mark-as-draft
Reverts multiple sales orders back to draft. Reverting an order deletes its payments and fulfillments, reverses its inventory movements and cost layers, tears down its fulfillment routing, removes its accounting transaction, and resets order/fulfillment/payment statuses (including clearing any cancellation).
orders:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Requires Bearer token.
Request body (one of ids or filters is required):
- ids (array of integers, required without filters): Sales order IDs to revert.
- filters (required without ids): Filter payload resolved against the sales-orders list — accepts the grouped
filter_groupsshape (base64-encoded JSON, same as the V2 sales-orders list) as well as the legacy JSON-string filter set. - archived (integer, optional, default 0): Used with
filters— set to 1 to include archived orders when resolving IDs.
Behavior:
- Orders awaiting tracking cannot be reverted (remove their fulfillments first); closed orders cannot be reverted.
- Returns 200 when all orders revert; 200 with per-order
warnings(keyed by order ID) when only some revert; 400 when none were found or all failed.
Requires permission: sales_orders.update
Request
Responses
- 200
- 400
- 401
- 403
- 422
- 429
OK
Response Headers
Bad Request
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Validation failed — the body is a field → messages map (Laravel shape) or the platform envelope with a stable machine-readable code. Fix the payload and resubmit.
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.