Skip to main content

Apply Open-to-Buy Across Supplier Builds

POST 

/api/inventory-forecasting/otb-guardrail

Check finished per-supplier forecast builds against ONE Open-to-Buy plan budget. Each supplier build constrained by an Open-to-Buy plan returns an otb_build_id; send every one of them here after the last supplier finishes. Lines are funded across all suppliers in one pass (by the cash priority order when buying capacity is set up, otherwise supplier by supplier in line order); a breaching line is flagged exceeds_otb, or in trim mode the first breaching line is trimmed to fit; a line priced in a currency with no exchange rate is held back as no_exchange_rate (never trimmed; skip_reason names the currency); lines with a logged buyer override are kept (overridden).

Required scope: purchase-orders:write

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

Authentication: Requires Bearer token.

Body:

  • build_ids (required, array of 1-500 distinct UUIDs): otb_build_id values from Build Forecast (Single Supplier) or the completed Get Job Status result. A supplier built twice counts once (the last id wins).
  • pricing_tier_ids (optional, object of supplier id => supplier pricing tier id or null): suppliers the buyer re-priced on another tier after the build. Their lines are checked at that tier's price and currency instead of the build's (null = the product's first tier). Each tier must exist.

The plan, guardrail mode and MOQ setting are taken from the builds themselves.

Response: one entry per supplier with the recomputed summary and every line's guardrail-affected fields (supplier_product_id, final_quantity, line_total, skip_reason, otb_status within|trimmed|overridden|exceeds_otb|no_exchange_rate, otb_trimmed_from_quantity, otb_override_id). Apply these over the supplier builds you already have.

Returns 422 when a build has expired (rebuild it) or when the builds use different Open-to-Buy settings.

Request​

Responses​

OK

Response Headers
    Content-Type