Skip to main content

Create Fulfillment Order

POST 

/api/fulfillment-orders

Creates a new FulfillmentOrder + its line budgets in a single transaction. Each line's remaining_quantity is initialized to quantity.

Overfulfilment guard. For every line, the manager row-locks the parent SalesOrderLine and validates that SUM(quantity) across all non-cancelled FOs for that SOL + the new requested quantity does not exceed SalesOrderLine.quantity. Violations return 422.

Request body fields:

  • sales_order_id (required, integer, must exist) — parent SO.
  • warehouse_id (required, integer, must exist) — the warehouse this FO will be routed to. Cannot be changed once the FO leaves Open/Unsubmitted (see Move endpoint).
  • lines (required, array, min 1) — one entry per SOL being budgeted from this warehouse.
  • lines.*.sales_order_line_id (required, integer, must exist) — SOL ID.
  • lines.*.quantity (required, integer, min 1) — units to budget for this SOL from this warehouse.
  • external_id (nullable, string, max 128) — external provider's FO/shipment ID once submitted.
  • external_type (nullable, string, max 64) — provider type discriminator (e.g. "shipfusion", "3pl").
  • integration_instance_id (nullable, integer, must exist) — integration instance for the provider.

Returns 201 with the eager-loaded FO + lines + warehouse on success, 422 on overfulfilment, 404 if the feature flag is off.

Request

Responses

Successful response