{"components":{"schemas":{"OrderLine":{"description":"Identify the product by variant_gid, sku or barcode.","properties":{"barcode":{"type":"string"},"qty":{"minimum":1,"type":"integer"},"sku":{"type":"string"},"variant_gid":{"type":"string"}},"required":["qty"],"type":"object"},"ReceiveLine":{"description":"Identify the PO line by line_id, sku or variant_gid.","properties":{"line_id":{"type":"integer"},"qty":{"minimum":1,"type":"integer"},"sku":{"type":"string"},"unit_cost":{"type":"number"},"variant_gid":{"type":"string"}},"required":["qty"],"type":"object"}},"securitySchemes":{"bearerAuth":{"scheme":"bearer","type":"http"}}},"info":{"description":"Purchase orders, reorder suggestions, receiving and stock for a Shopify store running Backroom. Authenticate with `Authorization: Bearer <api key>`; the key is generated in Backroom \u2192 Settings \u2192 API & AI assistants. All quantities are units; costs are in the store's currency.","title":"Backroom API","version":"1.0.0"},"openapi":"3.1.0","paths":{"/api/v1/locations":{"get":{"responses":{"200":{"description":"Locations"}},"summary":"Active inventory locations"}},"/api/v1/me":{"get":{"responses":{"200":{"description":"Store info"}},"summary":"Store, locations and reorder settings"}},"/api/v1/products/search":{"get":{"parameters":[{"in":"query","name":"q","required":true,"schema":{"type":"string"}},{"in":"query","name":"limit","schema":{"default":25,"type":"integer"}}],"responses":{"200":{"description":"Matching variants with stock on hand"}},"summary":"Find products by name, SKU, barcode or vendor"}},"/api/v1/purchase-orders":{"get":{"parameters":[{"in":"query","name":"status","schema":{"default":"open","enum":["open","all","draft","ordered","partial","received","closed","cancelled"],"type":"string"}},{"in":"query","name":"limit","schema":{"default":50,"type":"integer"}}],"responses":{"200":{"description":"Purchase orders"}},"summary":"List purchase orders"},"post":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"expected_at":{"format":"date","type":"string"},"lines":{"items":{"$ref":"#/components/schemas/OrderLine"},"type":"array"},"location_gid":{"type":"string"},"mark_ordered":{"description":"Create as Ordered instead of Draft","type":"boolean"},"notes":{"type":"string"},"reference":{"type":"string"},"supplier_id":{"description":"Optional; inferred from the products' vendor when omitted","type":"integer"}},"required":["lines"],"type":"object"}}},"required":true},"responses":{"201":{"description":"The created purchase order"}},"summary":"Create a purchase order"}},"/api/v1/purchase-orders/from-suggestions":{"post":{"requestBody":{"content":{"application/json":{"schema":{"properties":{"location_gid":{"type":"string"},"mark_ordered":{"type":"boolean"},"supplier_id":{"description":"Only this supplier","type":"integer"}},"type":"object"}}}},"responses":{"201":{"description":"Created purchase orders"}},"summary":"Create one purchase order per supplier from the current suggestions"}},"/api/v1/purchase-orders/{id}":{"get":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Purchase order"}},"summary":"Purchase order with lines"}},"/api/v1/purchase-orders/{id}/receive":{"post":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"lines":{"items":{"$ref":"#/components/schemas/ReceiveLine"},"type":"array"},"location_gid":{"description":"Defaults to the PO's location","type":"string"},"nonce":{"description":"Idempotency key; a repeat with the same nonce is rejected","type":"string"},"notes":{"type":"string"},"receive_all":{"description":"Receive every outstanding unit; lines are ignored","type":"boolean"},"reference":{"description":"Delivery note / invoice number","type":"string"},"update_costs":{"description":"Also write unit costs to Shopify","type":"boolean"}},"type":"object"}}},"required":true},"responses":{"200":{"description":"Receipt recorded and Shopify updated"},"502":{"description":"Receipt recorded but the Shopify update failed; retry from the app"}},"summary":"Receive a delivery: records quantities and updates Shopify inventory at the location"}},"/api/v1/purchase-orders/{id}/status":{"post":{"parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"action":{"enum":["order","close","cancel","reopen","delete"],"type":"string"}},"required":["action"],"type":"object"}}},"required":true},"responses":{"200":{"description":"Updated purchase order"}},"summary":"Change status"}},"/api/v1/stock/summary":{"get":{"parameters":[{"description":"Location gid, or 'all'","in":"query","name":"location","schema":{"type":"string"}}],"responses":{"200":{"description":"Summary"}},"summary":"Counts of items out of stock / to reorder and the suggested spend"}},"/api/v1/suggestions":{"get":{"parameters":[{"in":"query","name":"location","schema":{"type":"string"}},{"in":"query","name":"supplier_id","schema":{"type":"integer"}},{"description":"Include items that do not need ordering","in":"query","name":"all","schema":{"enum":["1"],"type":"string"}}],"responses":{"200":{"description":"Suggestions"}},"summary":"What to reorder, grouped by supplier (the Fill shelves page)"}},"/api/v1/suppliers":{"get":{"responses":{"200":{"description":"Suppliers"}},"summary":"Suppliers with lead times"}}},"security":[{"bearerAuth":[]}],"servers":[{"url":"https://restocker-production-2027.up.railway.app"}]}
