When to use this. A style’s supplier facilities are its supply-chain selections: for each
facility type your organisation tracks (Sewing, Fabric Mill, Wet Processing, …) you record the
one supplier facility that handles it for that style. Use these endpoints to read and maintain
those selections: the link between a style and the physical locations producing it.
The workflow
Each selection maps a facility type to a supplier facility on a single style. Facility types are defined per organisation; supplier facilities are the physical locations that hang off your sub-suppliers. A supplier facility can only be selected under a facility type it actually carries, so identify the facility first, then attach it to the style, then read the result back.1
Find the supplier facility
GET /api/facilities lists the supplier facilities available to your organisation. Note the
id of the facility you want and the facility type it carries: you attach it under that type.2
Assign facilities to the style (full replace)
PUT /api/styles/{styleId}/supplier-facilities replaces the style’s whole selection set in one
transaction. The body is an array of { facilityTypeId, supplierFacilityId } items; an item with
state: "deleted" drops that facility-type selection instead of keeping it. To work across many
styles at once, put styleId on each item: POST /api/style-supplier-facilities creates new
selections and returns 409 if a style already has a selection for that facility type, while
PUT /api/style-supplier-facilities creates each selection if it is absent or, with
state: "deleted", removes it.3
Read the selections
GET /api/styles/{styleId}/supplier-facilities returns one row per facility type the style has a
selection for, with the resolved facility. For an organisation-wide view, filter
GET /api/style-supplier-facilities by styleId, facilityTypeId, or supplierFacilityId.Walkthrough
Replace a style’s supplier-facility selections.PUT /api/styles/{styleId}/supplier-facilities is a
full replace of the set: the array you send becomes the style’s complete selection list, and any
facility type you omit is cleared. An item with state: "deleted" is also accepted and drops that
facility type from the new set. The body takes facilityTypeId and supplierFacilityId per item,
not the GET row shape, so build it from the facilityType.id and facility.id of each row you
read rather than sending the GET response back.
address, zipCodeOrCity, and country are always present
and are null when not recorded.
Field reference
The fields that matter most when reading or writing a style’s supplier-facility selections:Roles & permissions
Writing supplier-facility selections requires thestyles permission on a designer (brand)
account, typically CompanyAdmin or CompanyUser, and is authorised as a style update. Reading is
supplier-collaborative: a supplier organisation the style is assigned to can read the style’s
selections, but only the style’s own designer organisation can change them. A supplier principal that
attempts a write receives a 403, as does any caller referencing a style in another organisation; a
style that exists nowhere returns 404.
When things go wrong
Errors use the standard envelope (status: "error", a code, and error.details[]). Bulk writes are
all-or-nothing: a single bad row rolls the whole request back, and per-item failures carry an
[i].field path (e.g. [2].supplierFacilityId). A supplier facility that does not carry the requested
facility type is rejected with 422 unprocessable_error.facility_does_not_carry_type. See
Errors & responses for the full list of codes and how to resolve them.
What to call next
Styles
Create and maintain the styles these selections hang off.
Facilities
Create and maintain the supplier facilities you select here.
Sub-suppliers
Facilities belong to sub-suppliers: map your supply chain first.
List facilities
Find selectable supplier facilities:
GET /api/facilities.