Bulk Generate RMAs from Orders
POST/api/rmas/bulk/generate-from-orders
Dispatch a tracked background job that creates one RMA per selected (or all-matching) sales order, from each order's fulfilled, not-already-RMA'd lines. Returns a tracked_job_log_id immediately; progress shows via the tracked job log endpoints.
returns:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Requires Bearer token.
Fields:
- sales_order_ids (required without apply_to_all): explicit list of sales order IDs
- apply_to_all (optional bool): when true, resolve target orders from the sales-orders list filters instead of an explicit list
- filters (optional): the sales-orders list filters to resolve when apply_to_all is true
- warehouse_id (optional): default warehouse for generated RMAs; per order, the order's fulfillment warehouse is preferred when resolvable
- status (optional): draft | approved (default draft) — when approved, each generated RMA is approved
- rma_date (optional date): date for the generated RMAs
- skip_existing_open (optional bool, default true): skip orders that already have a non-terminal (open) RMA
Per-order outcomes (created / skipped / failed) and the created RMA list are stored on the tracked job log for the details dialog. The completion watcher matches the job name "Generate RMAs from Orders".
Request
Responses
- 200
- 401
- 403
- 422
- 429
OK
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.
Unprocessable Entity
Response Headers
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.