Skip to main content

Bulk Place Supplier Availability Holds

POST 

/api/supplier-availability-holds/bulk

Applies one hold to many product × supplier pairs, for example every title from a publisher that is reprinting. Each pair is placed or, when it already has an open hold, revised; pairs without a supplier link, and duplicates, are reported as failed or skipped.

Required scope: suppliers:write

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

Up to 200 pairs are processed immediately and the row results are returned. Larger requests (up to 10,000 pairs) run in the background: the response is 202 with a tracked_job_log_id you can poll at GET /api/tracked-job-logs/{trackedJobLog}.

Body

  • pairs (array, required, 1–10,000): each {product_id, supplier_id} (integers, required).
  • hold (object, required): the hold to apply, with the fields below, each prefixed hold. in validation errors.
  • reason (string, optional, max 48): an active hold reason key (see List Supplier Hold Reasons). Defaults to out_of_stock when neither reason nor reason_code is sent.
  • reason_code (string, optional, max 16): the supplier's own code, matched case-insensitively against each active reason's import_aliases (and key). Use it instead of reason when relaying a supplier's code; it is stored on the hold as received.
  • available_on (date, optional, Y-m-d): when the supplier expects to supply again. Omit or send null for an unknown date. Must not be before today (its window may still be current) and no more than 5 years ahead.
  • date_precision (string, required with available_on): day, month or quarter. With month or quarter the date is stored as the start of that window, and planning waits for the window to end.
  • accepts_orders (boolean, optional, default true): whether the supplier still takes orders meanwhile.
  • note (string, optional, max 2000): required when the reason has requires_note (for example other).
  • hold.update_open_po_line_etas (boolean, optional): also move the ETA of open single-product purchase orders to each hold's earliest arrival.

Response under data (immediate): queued (false), total, placed, revised, unchanged, failed (integers), errors (array of {product_id, supplier_id, message}), hold_ids (integers) and cancelled (boolean).

Authentication: Requires Bearer token.

Requires permission: suppliers.update

Moving open purchase order ETAs: sending hold.update_open_po_line_etas: true also edits purchase orders, so the caller must additionally hold the purchase_orders.update permission (and a token needs the purchase-orders:write scope). Without it the request is refused with 403 before anything is saved. ETAs are moved even when the hold itself is unchanged, and never for a hold whose date is unknown.

Optimistic locking: each pair may carry expected_version and expected_hold_id (that pair's open hold version and id); a stale one fails that row with a conflict message. hold.po_line_ids_excluded lists purchase orders to leave alone when moving ETAs.

Request​

Responses​

OK

Response Headers
    Content-Type