Skip to main content

Bulk Delete Sales Orders (Tracked)

DELETE 

/api/sales-orders/tracked

Bulk deletes sales orders with progress tracking. Dispatches a background job and returns a tracked_job_log_id to poll via the tracked job log endpoints.

Required scope: orders:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Authentication: Requires Bearer token.

Request body (scope: one of ids or filters is required):

  • ids (array of int, required without filters): Explicit sales order IDs to delete.
  • filters (object, required without ids): Resolves to a list of sales order IDs via the same Spatie QueryBuilder pipeline the V2 sales-orders list/export use. Two shapes are accepted:
    • Grouped filters (current list): { \"filter_groups\": \"<base64-encoded JSON tree>\" }. The decoded tree looks like {\"conjunction\":\"and\",\"children\":[{\"type\":\"condition\",\"condition\":{\"column\":\"order_status\",\"operator\":\"is\",\"value\":\"open\"}}]}.
    • legacy filter set (JSON string) for older clients.
  • apply_to_all (bool, optional): When true the action targets every order matching the active filters rather than an explicit ids list.

Behavior:

  • Returns the tracked job log ID immediately; deletion runs asynchronously.
  • Sending filters as the grouped filter_groups object is fully supported (previously returned a 500).

Requires permission: sales_orders.delete

Request

Responses

OK

Response Headers
    Content-Type