{"openapi":"3.1.0","info":{"title":"Pricemaster API","version":"1.0","summary":"Read and manage your workspace: products and their facts, competitor offers and your opinion of them, pricing rules (create, edit, enable, order, assign), tags, minimum margins, store push results, and manual price pushes with rollback.","description":"Base URL `https://api.pricemaster.ai/v1`. Authenticate with `Authorization: Bearer pmk_live_…`. A key belongs to exactly one workspace; every response is scoped to it. Every price is an object `{ex_tax, inc_tax}` as decimal strings; the envelope carries the currency and tax rate. Lists are keyset-paged with `limit` and `cursor`. Errors are `{error:{code,message,details?,request_id}}`. Full guide: https://pricemaster.ai/docs/api","contact":{"name":"Pricemaster support","email":"info@pricemaster.ai","url":"https://pricemaster.ai/docs/api"}},"servers":[{"url":"https://api.pricemaster.ai/v1"}],"tags":[{"name":"Workspace","description":"The key and its workspace."},{"name":"Products","description":"Your products: identity, cost, prices, stock, tags, rule."},{"name":"Market","description":"Competitor offers, price history, sellers and the engine's recommendation."},{"name":"Rules","description":"Pricing rules: read, create, edit, enable/disable, reorder, delete, assign products, simulate."},{"name":"Tags","description":"Workspace tags: read, create, rename, delete, and change which products carry a manual tag."},{"name":"Margins","description":"Minimum margins: the default floor, cost bands and product-group tables."},{"name":"Pushes","description":"Store push operations: read results, send prices by hand (rule prices for chosen products, one exact price, or the whole workspace), roll a push back. Never automatic pushing."},{"name":"Meta","description":"Health and this document."}],"x-rate-limits":{"read":{"perMinute":600,"perDay":100000},"write":{"perMinute":120,"perDay":20000},"engine":{"perMinute":60,"perDay":10000},"history":{"perMinute":300,"perDay":50000}},"x-error-codes":{"unauthorised":"No usable API key was sent. Send `Authorization: Bearer pmk_live_…`.","key_revoked":"The key has been revoked.","key_expired":"The key has passed its expiry date.","api_disabled":"The API is switched off for the moment (maintenance).","api_not_enabled":"The API is not enabled for this workspace. Ask Pricemaster to switch it on.","workspace_disabled":"The workspace is disabled.","insufficient_scope":"The key does not carry the scope this endpoint needs.","writes_not_enabled":"Write access is not enabled for this workspace.","pushes_not_enabled":"Price pushes by API are not enabled for this workspace.","push_refused":"The store push gate refused the request (the message says why: store not live, trial limit, push in flight, nothing to send…).","module_not_enabled":"The feature this endpoint reads is not enabled for the workspace.","ip_not_allowed":"The request came from an address outside the key's allow-list.","bad_request":"The request is malformed or a parameter is invalid.","not_found":"No such resource in this workspace.","conflict":"The Idempotency-Key was already used with a different request body.","rule_locked":"The rule is part of a running A/B test and cannot be changed until the test ends.","validation_failed":"The request is well-formed but a value is not acceptable (the message says why).","rate_limited":"Too many requests. Wait for the window to reset and retry.","server_error":"Something went wrong on our side. Quote the request id to support."},"paths":{"/health":{"get":{"operationId":"health","tags":["Meta"],"summary":"Liveness check (no key needed).","security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"service":{"type":"string"},"version":{"type":"string"},"ts":{"type":"string","format":"date-time"}}}}}}}}},"/openapi.json":{"get":{"operationId":"openapi","tags":["Meta"],"summary":"This document (no key needed).","security":[],"responses":{"200":{"description":"OpenAPI 3.1 JSON"}}}},"/postman.json":{"get":{"operationId":"postman","tags":["Meta"],"summary":"Postman collection of every endpoint, generated from this document (no key needed).","description":"Import the URL in Postman (Import → Link). Bearer auth is wired to the collection variable `api_key`; set it to your key and start with Workspace → GET /me.","security":[],"responses":{"200":{"description":"Postman Collection v2.1 JSON"}}}},"/me":{"get":{"operationId":"me","tags":["Workspace"],"summary":"The key and the one workspace it unlocks.","description":"Works with any valid key regardless of scopes. Use it to confirm a key, see its scopes, and read the workspace's currency, tax rate and modules.","security":[{"apiKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":null}},"/products":{"get":{"operationId":"listProducts","tags":["Products"],"summary":"List products.","description":"Keyset-paged on id. With `updated_since` the order becomes (updated_at, id) so a poller can fetch changes since its last run. `expand=rule,tags` adds the pricing rule and tags per product.","security":[{"apiKey":["products:read"]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Page size."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page's next_cursor."},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Free text over SKU, title and barcode."},{"name":"sku","in":"query","required":false,"schema":{"type":"string"},"description":"Exact SKU (case and punctuation insensitive)."},{"name":"gtin","in":"query","required":false,"schema":{"type":"string"},"description":"Barcode (EAN/UPC/GTIN, any length; zero-padded to 14)."},{"name":"tag","in":"query","required":false,"schema":{"type":"string"},"description":"Only products carrying this tag name."},{"name":"brand","in":"query","required":false,"schema":{"type":"string"},"description":"Exact brand (case insensitive)."},{"name":"psin","in":"query","required":false,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Only products matched to this global product id."},{"name":"enabled","in":"query","required":false,"schema":{"type":"boolean"},"description":"Filter on enabled."},{"name":"monitor_only","in":"query","required":false,"schema":{"type":"boolean"},"description":"Filter on monitor-only."},{"name":"updated_since","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Only products changed at or after this time; switches the ordering to (updated_at, id)."},{"name":"expand","in":"query","required":false,"schema":{"type":"string"},"description":"Comma list of `rule`, `tags`."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductList"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"products:read"}},"/products/{id}":{"get":{"operationId":"getProduct","tags":["Products"],"summary":"One product with its tags and pricing rule.","security":[{"apiKey":["products:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Product id."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductOne"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"products:read"},"patch":{"operationId":"updateProduct","tags":["Products"],"summary":"Update product facts.","description":"Changes cost, price (what your store charges now: an observation, NOT a push), special_price, rrp, map_price, stock, enabled, monitor_only. Money inputs are ex tax when given as a number; `{\"ex_tax\":…}` or `{\"inc_tax\":…}` objects are accepted. Needs the workspace's API-writes setting. Send an Idempotency-Key header to make retries safe. Every change is written to the workspace audit log.","security":[{"apiKey":["products:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Product id."},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Optional. 8–128 chars. A repeat with the same key and body returns the first answer."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductPatch"},"example":{"cost":62.5,"stock":14}}}},"responses":{"200":{"description":"The product after the update.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductOne"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"products:write"}},"/products/by-sku/{sku}":{"get":{"operationId":"getProductBySku","tags":["Products"],"summary":"Look a product up by SKU.","security":[{"apiKey":["products:read"]}],"parameters":[{"name":"sku","in":"path","required":true,"schema":{"type":"string"},"description":"SKU, URL-encoded. Case and punctuation insensitive."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductOne"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"products:read"}},"/products/{id}/price-history":{"get":{"operationId":"productPriceHistory","tags":["Products"],"summary":"Your own daily price for a product.","security":[{"apiKey":["products:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Product id."},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Start date (ISO-8601). Default: 90 days before `to`."},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"End date (ISO-8601). Default: today. The range may span at most 400 days."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnPriceHistory"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"products:read"}},"/products/{id}/offers":{"get":{"operationId":"productOffers","tags":["Market"],"summary":"Competitor offers for a product.","description":"One offer per seller: the same market view the pricing engine and the product page use. Sellers and listings the workspace has switched off, and dead or quarantined pages, are already excluded. `difference_ex_tax` is their price minus yours.","security":[{"apiKey":["market:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Product id."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Offers"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"market:read"}},"/products/{id}/offers/{listing_id}/history":{"get":{"operationId":"offerHistory","tags":["Market"],"summary":"Daily price history of one competitor listing.","description":"The listing must be among the product's current offers (see /offers); anything else is 404.","security":[{"apiKey":["market:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Product id."},{"name":"listing_id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Listing id from /offers."},{"name":"from","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"Start date (ISO-8601). Default: 90 days before `to`."},{"name":"to","in":"query","required":false,"schema":{"type":"string","format":"date"},"description":"End date (ISO-8601). Default: today. The range may span at most 400 days."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferHistory"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"market:read"}},"/products/{id}/recommendation":{"get":{"operationId":"productRecommendation","tags":["Market"],"summary":"What the product's rule would set right now.","description":"Runs the pricing engine for this one product with its winning rule and today's offers. Read-only: nothing is sent to the store. `explanation` is the engine's calculation log. Rate bucket `engine`.","security":[{"apiKey":["market:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Product id."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Recommendation"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"market:read"}},"/sellers/{id}":{"patch":{"operationId":"setSellerEnabled","tags":["Market"],"summary":"Switch a competitor on or off for this workspace.","description":"The workspace's own opinion only; the shared seller record is untouched. 404 when the seller has no offers on your products.","security":[{"apiKey":["market:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Seller id from /sellers."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean"}}},"example":{"enabled":false}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SellerToggle"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"market:write"}},"/products/{id}/offers/{listing_id}/override":{"put":{"operationId":"setOfferOverride","tags":["Market"],"summary":"Exclude, prefer or clear one competitor offer on one product.","description":"`disabled` leaves the offer out of pricing for this product, `preferred` marks the listing you trust for that seller, `clear` restores normal. `scope` is `seller` (every listing of the seller on this product; the default for disabled/clear) or `listing`. Never changes the shared listing or its match.","security":[{"apiKey":["market:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Product id."},{"name":"listing_id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Listing id from /offers."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["state"],"properties":{"state":{"type":"string","enum":["disabled","preferred","clear"]},"scope":{"type":"string","enum":["seller","listing"]}}},"example":{"state":"disabled","scope":"seller"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OfferOverride"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"market:write"}},"/products/{id}/offers/{listing_id}/rescrape":{"post":{"operationId":"requestRescrape","tags":["Market"],"summary":"Ask for a fresh read of one competitor page now.","description":"Queues the page for an immediate read (the product page's ⟳). Poll with GET. Rate-limited per listing by Pricemaster; bucket `engine`.","security":[{"apiKey":["market:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Product id."},{"name":"listing_id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Listing id from /offers."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Rescrape"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"market:write"},"get":{"operationId":"rescrapeStatus","tags":["Market"],"summary":"Poll a requested read.","security":[{"apiKey":["market:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Product id."},{"name":"listing_id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Listing id."},{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"The `checked_at` you already have; the answer says whether a newer reading exists."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Rescrape"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"market:read"}},"/sellers":{"get":{"operationId":"listSellers","tags":["Market"],"summary":"Sellers with offers on your products.","description":"One row per seller with a live listing on a product you sell, with your on/off setting. Cached for up to 10 minutes.","security":[{"apiKey":["market:read"]}],"parameters":[{"name":"enabled","in":"query","required":false,"schema":{"type":"boolean"},"description":"Only sellers switched on (true) or off (false) for the workspace."},{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Filter on name or domain."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sellers"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"market:read"}},"/rules":{"get":{"operationId":"listRules","tags":["Rules"],"summary":"List pricing rules.","security":[{"apiKey":["rules:read"]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Page size."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page's next_cursor."},{"name":"enabled","in":"query","required":false,"schema":{"type":"boolean"},"description":"Filter on enabled."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleList"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"rules:read"},"post":{"operationId":"createRule","tags":["Rules"],"summary":"Create a pricing rule.","description":"Same steps as the Rules page: validated engine-shaped `settings`, creep-cap check before any write (422 validation_failed), the new rule lands at the TOP of its ladder (priority 1; `priority` places it elsewhere), a revision is recorded, products are assigned from `targeting`. Nothing is pushed to the store.","security":[{"apiKey":["rules:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleCreate"},"example":{"name":"DeWalt: 1% below cheapest","strategy":"follow","enabled":false,"settings":{"priceEnding":"99","priceEndingDirection":"nearest","follow":{"type":"cheapest_position","cheapestPosition":1,"modifierDirection":"below","modifierValue":1,"modifierType":"percentage","applyMinMargin":true}},"targeting":{"suppliers":["Toolbank"],"tags":["DeWalt"],"tag_match":"any"}}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOne"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"rules:write"}},"/rules/order":{"put":{"operationId":"reorderRules","tags":["Rules"],"summary":"Set the ladder order.","description":"`rule_ids` top first; priorities are rewritten 1..n (lower wins). All ids must belong to ONE ladder (all-channels, or one channel). Rules of that ladder left out keep their number, so send the whole ladder.","security":[{"apiKey":["rules:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["rule_ids"],"properties":{"rule_ids":{"type":"array","items":{"type":"integer","format":"int64","minimum":1},"maxItems":500}}},"example":{"rule_ids":[91,84]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOrder"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"rules:write"}},"/rules/{id}":{"get":{"operationId":"getRule","tags":["Rules"],"summary":"One pricing rule.","security":[{"apiKey":["rules:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Rule id."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOne"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"rules:read"},"patch":{"operationId":"updateRule","tags":["Rules"],"summary":"Edit a rule: name, enabled, priority, strategy + settings, targeting, schedule.","description":"Send only what changes. `{\"enabled\": false}` switches a rule off; `{\"enabled\": true}` on. `settings` replaces the strategy block (validated; app-only settings are carried across). 409 rule_locked while the rule is in a running A/B test.","security":[{"apiKey":["rules:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Rule id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RulePatch"},"example":{"enabled":true}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleOne"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"rules:write"},"delete":{"operationId":"deleteRule","tags":["Rules"],"summary":"Delete a rule and its assignments.","security":[{"apiKey":["rules:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Rule id."}],"responses":{"204":{"description":"Deleted."},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"rule_locked: in a running A/B test.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"rules:write"}},"/rules/{id}/products":{"get":{"operationId":"ruleProducts","tags":["Rules"],"summary":"Products assigned to a rule.","security":[{"apiKey":["rules:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Rule id."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Page size."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page's next_cursor."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleProducts"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"rules:read"},"post":{"operationId":"assignRuleProducts","tags":["Rules"],"summary":"Assign products to a rule by hand (up to 500).","security":[{"apiKey":["rules:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Rule id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductIds"},"example":{"product_ids":[48213,50122]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignResult"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"rules:write"}},"/rules/{id}/products/remove":{"post":{"operationId":"unassignRuleProducts","tags":["Rules"],"summary":"Unassign many products from a rule.","security":[{"apiKey":["rules:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Rule id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductIds"},"example":{"product_ids":[50122]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemoveResult"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"rules:write"}},"/rules/{id}/products/{product_id}":{"delete":{"operationId":"unassignRuleProduct","tags":["Rules"],"summary":"Unassign one product from a rule.","security":[{"apiKey":["rules:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Rule id."},{"name":"product_id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Product id."}],"responses":{"204":{"description":"Removed (or was not assigned)."},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"rules:write"}},"/rules/{id}/simulate":{"post":{"operationId":"simulateRule","tags":["Rules"],"summary":"Run the rule and report what it would set.","description":"Read-only: nothing is sent. Up to 2,000 products (default 500); the first 500 rows are returned, the summary covers them all. Bucket `engine`.","security":[{"apiKey":["rules:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Rule id."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":2000,"default":500},"description":"Products to simulate."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Simulation"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"rules:read"}},"/tags":{"get":{"operationId":"listTags","tags":["Tags"],"summary":"List tags with product counts.","security":[{"apiKey":["tags:read"]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tags"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"tags:read"},"post":{"operationId":"createTag","tags":["Tags"],"summary":"Create a manual tag.","description":"409 conflict when the name exists. Dynamic (criteria-driven) tags are created in the app.","security":[{"apiKey":["tags:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":80},"colour":{"type":["string","null"]}}},"example":{"name":"Clearance","colour":"#d97706"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagOne"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"tags:write"}},"/tags/{id}":{"get":{"operationId":"getTag","tags":["Tags"],"summary":"One tag.","security":[{"apiKey":["tags:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Tag id."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagOne"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"tags:read"},"patch":{"operationId":"updateTag","tags":["Tags"],"summary":"Rename or recolour a tag.","security":[{"apiKey":["tags:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Tag id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":80},"colour":{"type":["string","null"]}}},"example":{"name":"Clearance (Q4)"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagOne"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"tags:write"},"delete":{"operationId":"deleteTag","tags":["Tags"],"summary":"Delete a tag; products keep their other tags.","security":[{"apiKey":["tags:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Tag id."}],"responses":{"204":{"description":"Deleted."},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"tags:write"}},"/tags/{id}/products":{"get":{"operationId":"tagProducts","tags":["Tags"],"summary":"Products carrying a tag.","security":[{"apiKey":["tags:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Tag id."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Page size."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page's next_cursor."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RuleProducts"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"tags:read"},"post":{"operationId":"addTagProducts","tags":["Tags"],"summary":"Add products to a manual tag (up to 500).","description":"422 validation_failed on a dynamic tag.","security":[{"apiKey":["tags:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Tag id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductIds"},"example":{"product_ids":[48213,50122]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagAddResult"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"tags:write"}},"/tags/{id}/products/remove":{"post":{"operationId":"removeTagProducts","tags":["Tags"],"summary":"Take many products off a manual tag.","security":[{"apiKey":["tags:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Tag id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductIds"},"example":{"product_ids":[50122]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemoveResult"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"tags:write"}},"/tags/{id}/products/{product_id}":{"delete":{"operationId":"removeTagProduct","tags":["Tags"],"summary":"Take one product off a manual tag.","security":[{"apiKey":["tags:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Tag id."},{"name":"product_id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Product id."}],"responses":{"204":{"description":"Removed (or was not tagged)."},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"tags:write"}},"/min-margins":{"get":{"operationId":"getMinMargins","tags":["Margins"],"summary":"The default floor, base cost bands and product-group tables.","security":[{"apiKey":["margins:read"]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Margins"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"margins:read"},"patch":{"operationId":"setDefaultMargin","tags":["Margins"],"summary":"Set the account-wide default minimum margin.","security":[{"apiKey":["margins:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["default_percent"],"properties":{"default_percent":{"type":"number","minimum":0,"maximum":100}}},"example":{"default_percent":22}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Margins"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"margins:write"}},"/min-margins/bands":{"post":{"operationId":"addBand","tags":["Margins"],"summary":"Add a cost band, fitted into its table.","description":"Costs ex tax. Bands the new one covers are replaced, bands it cuts into are trimmed, a band it sits inside is split, so bands never overlap. `group_id` targets a product-group table; absent = the base table.","security":[{"apiKey":["margins:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BandCreate"},"example":{"min_cost":0,"max_cost":50,"margin_percent":25}}}},"responses":{"201":{"description":"Created; the whole table follows.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Margins"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"margins:write"}},"/min-margins/bands/{id}":{"patch":{"operationId":"updateBand","tags":["Margins"],"summary":"Edit a band in place.","security":[{"apiKey":["margins:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Band id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BandPatch"},"example":{"margin_percent":27.5}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Margins"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"margins:write"},"delete":{"operationId":"deleteBand","tags":["Margins"],"summary":"Delete a band.","security":[{"apiKey":["margins:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Band id."}],"responses":{"204":{"description":"Deleted."},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"margins:write"}},"/min-margins/groups":{"post":{"operationId":"createMarginGroup","tags":["Margins"],"summary":"Create a product-group table.","description":"Its own bands apply to the products its suppliers/tags select; needs at least one supplier or tag.","security":[{"apiKey":["margins:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroupInput"},"example":{"name":"DeWalt","tags":["DeWalt"]}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Margins"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"margins:write"}},"/min-margins/groups/{id}":{"patch":{"operationId":"updateMarginGroup","tags":["Margins"],"summary":"Edit, reprioritise or switch a product-group table on/off.","security":[{"apiKey":["margins:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Group id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroupPatch"},"example":{"enabled":true,"priority":1}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Margins"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"margins:write"},"delete":{"operationId":"deleteMarginGroup","tags":["Margins"],"summary":"Delete a table and its bands.","security":[{"apiKey":["margins:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Group id."}],"responses":{"204":{"description":"Deleted."},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"margins:write"}},"/pushes":{"get":{"operationId":"listPushes","tags":["Pushes"],"summary":"Store push operations, newest first.","security":[{"apiKey":["pushes:read"]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Page size."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page's next_cursor."},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["dryrun","pending","running","completed","failed","cancelled"]},"description":"Filter on status."},{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Only operations created at or after this time."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushList"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"pushes:read"},"post":{"operationId":"createPush","tags":["Pushes"],"summary":"Send prices to the store now, by hand.","description":"Three modes. `rule`: the products' rule prices for `product_ids` (one rule per call; `rule_id` optional when they share one) → 202 with the operation and the held items. `price`: one exact `price` for `product_id` → 201 once the store confirms. `all`: the whole workspace's rules, as Settings → Push now (`dry_run` previews) → 202 queued. Every mode is a MANUAL push: store gate, trial daily cap and the >50% per-item hold (`force` releases it per request) apply exactly as in the app. 403 pushes_not_enabled without the workspace's API price pushes setting; 422/409 push_refused with the gate's reason. Send an Idempotency-Key.","security":[{"apiKey":["pushes:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushCreate"},"example":{"mode":"all","dry_run":true}}}},"responses":{"201":{"description":"mode price: sent and confirmed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushPriceResult"}}}},"202":{"description":"mode rule / all: accepted; follow the operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushRuleResult"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"push_refused: a push is already in flight, or a trial refuses automation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"push_refused (gate reason in details) or validation_failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"pushes:write"}},"/pushes/{id}/rollback":{"post":{"operationId":"rollbackPush","tags":["Pushes"],"summary":"Put back the prices a push changed.","description":"From the snapshot taken before the push was sent. `preview` reports and sends nothing; `product_ids` limits it to some products; a price the store changed since the push is left alone unless `force`. Slow stores answer 202 pending after 25 s: poll with GET.","security":[{"apiKey":["pushes:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Push id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"preview":{"type":"boolean"},"force":{"type":"boolean"},"product_ids":{"type":"array","items":{"type":"integer","format":"int64","minimum":1}}}},"example":{"preview":true}}}},"responses":{"200":{"description":"Done (or preview).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Rollback"}}}},"202":{"description":"Still working; poll.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Rollback"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"pushes:write"},"get":{"operationId":"rollbackStatus","tags":["Pushes"],"summary":"The result of the last rollback (or preview) asked for on this push.","security":[{"apiKey":["pushes:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Push id."},{"name":"preview","in":"query","required":false,"schema":{"type":"boolean"},"description":"true for the preview's result."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Rollback"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"pushes:read"}},"/pushes/{id}":{"get":{"operationId":"getPush","tags":["Pushes"],"summary":"One push operation with counts.","security":[{"apiKey":["pushes:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Push id."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushOne"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"pushes:read"}},"/pushes/{id}/items":{"get":{"operationId":"pushItems","tags":["Pushes"],"summary":"Per-product results of a push.","security":[{"apiKey":["pushes:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","format":"int64","minimum":1},"description":"Push id."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"description":"Page size."},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page's next_cursor."},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["dryrun","held","sent","applied","push_failed","item_error"]},"description":"Filter on item status."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushItems"}}}},"400":{"description":"Malformed request or invalid parameter (code bad_request).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"No key, unknown key, revoked (key_revoked) or expired (key_expired).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"insufficient_scope, api_not_enabled, writes_not_enabled, module_not_enabled, workspace_disabled or ip_not_allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found in this workspace (also the answer for another workspace's id).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited; honour Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-scope":"pushes:read"}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"pmk_live_…","description":"A workspace API key from Settings → API access. Scopes: `workspace:read` (Read the workspace: name, type, currency, tax rate, modules, trial state and the key's own details (/v1/me).); `products:read` (Read your products: SKU, title, identifiers, cost, prices, stock, tags and market position.); `products:write` (Update product facts: cost, stock, RRP, MAP, enabled and monitor-only. Never sends a price to your store.); `market:read` (Read competitor offers, competitor price history, the sellers tracked for the workspace and price recommendations.); `market:write` (Switch a competitor on or off for the workspace, exclude or prefer a listing on a product, request a fresh read of a competitor page.); `rules:read` (Read pricing rules, their settings and which rule prices each product.); `rules:write` (Create, edit, enable, disable, reorder and delete pricing rules; assign and unassign products. Never sends a price.); `tags:read` (Read the workspace's tags.); `tags:write` (Create, rename, delete manual tags and change which products carry them.); `margins:read` (Read the minimum-margin default, cost bands and product-group tables.); `margins:write` (Change the minimum-margin default, add, edit and delete cost bands and product-group tables.); `pushes:read` (Read store push operations and their per-product results.); `pushes:write` (Send prices to your store by hand (a rule's prices for chosen products, one exact price, or the whole workspace's rules) and roll a push back. Never switches automatic pushing on.)"}},"schemas":{"Money":{"type":"object","required":["ex_tax","inc_tax"],"description":"A price in both tax bases, as decimal strings (2 dp; 4 dp for cost).","properties":{"ex_tax":{"type":"string","examples":["12.34"]},"inc_tax":{"type":"string","examples":["14.81"]}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message","request_id"],"properties":{"code":{"type":"string","enum":["unauthorised","key_revoked","key_expired","api_disabled","api_not_enabled","workspace_disabled","insufficient_scope","writes_not_enabled","pushes_not_enabled","push_refused","module_not_enabled","ip_not_allowed","bad_request","not_found","conflict","rule_locked","validation_failed","rate_limited","server_error"]},"message":{"type":"string"},"details":{},"request_id":{"type":"string"}}}}},"Me":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"key":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"name":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"object","properties":{"scope":{"type":"string"},"description":{"type":"string"}}}}}},"workspace":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"name":{"type":"string"},"type":{"type":"string","enum":["retail","brand"]},"platform":{"type":["string","null"]},"country":{"type":["string","null"]},"currency":{"type":"string"},"tax_rate":{"type":"string"},"modules":{"type":"object","additionalProperties":{"type":"boolean"}},"writes_enabled":{"type":"boolean"},"trial":{"type":["object","null"],"properties":{"active":{"type":"boolean"},"expired":{"type":"boolean"},"day":{"type":"integer"},"total_days":{"type":"integer"},"ends_at":{"type":"string","format":"date-time"},"manual_pushes_remaining_today":{"type":"integer"}}}}}}},"Product":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"sku":{"type":"string"},"title":{"type":"string"},"brand":{"type":["string","null"]},"supplier":{"type":["string","null"]},"gtin":{"type":["string","null"]},"mpn":{"type":["string","null"]},"asin":{"type":["string","null"]},"image_url":{"type":["string","null"]},"category":{"type":["string","null"]},"subcategory":{"type":["string","null"]},"psin":{"type":["integer","null"],"description":"The global product identity this SKU is matched to (shared across Pricemaster; read-only)."},"enabled":{"type":"boolean"},"monitor_only":{"type":"boolean","description":"Tracked and shown, never repriced."},"taxable":{"type":"boolean"},"stock":{"type":["integer","null"]},"cost":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"price":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}],"description":"What your store charges now, as Pricemaster last recorded it."},"special_price":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"rrp":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"map_price":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"market":{"type":"object","properties":{"competitors":{"type":"integer"},"cheapest":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"cheapest_seller":{"type":["string","null"]}}},"rule":{"type":["object","null"],"properties":{"id":{"type":"integer","format":"int64","minimum":1},"name":{"type":"string"}},"description":"With expand=rule or on single-product reads: the rule that prices this product."},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"name":{"type":"string"}}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"ProductList":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null on the last page."},"has_more":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Product"}}}},"ProductOne":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"data":{"$ref":"#/components/schemas/Product"}}},"MoneyInput":{"oneOf":[{"type":"number","description":"ex tax"},{"type":"string","description":"ex tax, numeric"},{"type":"object","properties":{"ex_tax":{"type":["number","string"]},"inc_tax":{"type":["number","string"]}}},{"type":"null","description":"clear the value"}]},"ProductPatch":{"type":"object","minProperties":1,"additionalProperties":false,"properties":{"cost":{"$ref":"#/components/schemas/MoneyInput"},"price":{"$ref":"#/components/schemas/MoneyInput"},"special_price":{"$ref":"#/components/schemas/MoneyInput"},"rrp":{"$ref":"#/components/schemas/MoneyInput"},"map_price":{"$ref":"#/components/schemas/MoneyInput"},"stock":{"type":["integer","null"],"minimum":0},"enabled":{"type":"boolean"},"monitor_only":{"type":"boolean"}}},"OwnPriceHistory":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"product_id":{"type":"integer","format":"int64","minimum":1},"sku":{"type":"string"},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"data":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"price":{"$ref":"#/components/schemas/Money"}}}}}},"Offer":{"type":"object","properties":{"listing_id":{"type":"integer","format":"int64","minimum":1},"seller":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"name":{"type":"string"},"domain":{"type":["string","null"]},"country":{"type":["string","null"]},"currency":{"type":["string","null"]}}},"url":{"type":"string"},"price":{"$ref":"#/components/schemas/Money"},"in_stock":{"type":"boolean"},"via_variant":{"type":"boolean","description":"The price came from a variant on the page, not the page itself."},"variant_sku":{"type":["string","null"]},"delivery_cost":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"difference_ex_tax":{"type":["string","null"],"description":"Their price minus yours, ex tax; negative = cheaper than you."},"last_seen_at":{"type":["string","null"],"format":"date-time"}}},"Offers":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"product_id":{"type":"integer","format":"int64","minimum":1},"sku":{"type":"string"},"psin":{"type":["integer","null"]},"your_price":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"data":{"type":"array","items":{"$ref":"#/components/schemas/Offer"}}}},"OfferHistory":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"product_id":{"type":"integer","format":"int64","minimum":1},"listing_id":{"type":"integer","format":"int64","minimum":1},"seller":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"name":{"type":"string"}}},"url":{"type":"string"},"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"},"data":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"price":{"$ref":"#/components/schemas/Money"},"in_stock":{"type":"boolean"}}}}}},"Recommendation":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"product_id":{"type":"integer","format":"int64","minimum":1},"sku":{"type":"string"},"current_price":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"cost":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"rule":{"type":["object","null"],"properties":{"id":{"type":"integer","format":"int64","minimum":1},"name":{"type":"string"}}},"recommendation":{"type":["object","null"],"properties":{"price":{"$ref":"#/components/schemas/Money"},"store_price":{"type":["string","null"],"description":"The exact figure a push would send, in the store's own tax basis."},"changed":{"type":"boolean"},"direction":{"type":"string","enum":["increase","decrease","none","skip"]},"margin_percent":{"type":["string","null"]},"competitors_considered":{"type":"integer"},"cheapest_in_stock":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]}}},"reason":{"type":["string","null"],"description":"`monitor_only`, `no_rule`, `not_priced`, or the engine's own reason text."},"explanation":{"type":"array","items":{"type":"string"}}}},"Sellers":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"name":{"type":"string"},"domain":{"type":"string"},"country":{"type":"string"},"currency":{"type":"string"},"kind":{"type":"string","enum":["competitor","retailer","own_site"]},"enabled":{"type":"boolean"},"scraped_daily":{"type":"boolean"},"listings":{"type":"integer"},"out_of_stock_listings":{"type":"integer"},"products_covered":{"type":"integer"},"last_seen_at":{"type":["string","null"],"format":"date-time"}}}}}},"Rule":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"name":{"type":"string"},"strategy":{"type":"string","enum":["flat","follow","flash"]},"priority":{"type":["integer","null"]},"enabled":{"type":"boolean"},"channel_id":{"type":["integer","null"]},"applies_to_all_products":{"type":"boolean"},"assigned_products":{"type":"integer"},"targeting":{"type":"object","properties":{"suppliers":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"tag_match":{"type":"string"}}},"schedule":{"type":["object","null"]},"settings":{"type":"object","description":"The rule's configuration exactly as the rule editor saved it (strategy-specific)."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"}}},"RuleList":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null on the last page."},"has_more":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Rule"}}}},"RuleOne":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"data":{"$ref":"#/components/schemas/Rule"}}},"RuleProducts":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null on the last page."},"has_more":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"product_id":{"type":"integer","format":"int64","minimum":1},"sku":{"type":["string","null"]}}}}}},"ProductIds":{"type":"object","required":["product_ids"],"properties":{"product_ids":{"type":"array","items":{"type":"integer","format":"int64","minimum":1},"maxItems":500}}},"AssignResult":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"rule_id":{"type":"integer","format":"int64","minimum":1},"added":{"type":"integer"},"already_assigned":{"type":"integer"}}},"TagAddResult":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"tag_id":{"type":"integer","format":"int64","minimum":1},"added":{"type":"integer"},"already_tagged":{"type":"integer"}}},"RemoveResult":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"removed":{"type":"integer"}}},"RuleOrder":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"ordered":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Rule"}}}},"RuleTargeting":{"type":"object","additionalProperties":false,"description":"Which products the rule applies to. Replaces the stored targeting when sent.","properties":{"suppliers":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"tag_match":{"type":"string","enum":["any","all"]},"apply_to_all":{"type":"boolean","description":"Every product in the workspace; the other filters are ignored."},"segments":{"type":"array","items":{"type":"string","enum":["fast","average","slow","non_mover"]}}}},"RuleSchedule":{"type":["object","null"],"additionalProperties":false,"properties":{"enabled":{"type":"boolean"},"mode":{"type":"string","enum":["one_off","weekly"]},"start":{"type":["string","null"],"format":"date-time"},"end_type":{"type":"string","enum":["no_end","date","stock_level"]},"end":{"type":["string","null"],"format":"date-time"},"end_stock_level":{"type":["integer","null"]},"switch_to_rule_id":{"type":["integer","null"]},"recurring_start_day":{"type":"integer"},"recurring_start_time":{"type":["string","null"]},"recurring_end_day":{"type":"integer"},"recurring_end_time":{"type":["string","null"]}}},"RuleSettings":{"type":"object","additionalProperties":false,"description":"The engine configuration, in the same shape GET returns. Exactly one strategy block, matching `strategy`. Settings only the app may set (creepCapHeld, noCompetitorMaxMargin*, velocity) are refused and carried across unchanged.","properties":{"priceEnding":{"type":"string","enum":["99","95","74","50","00","05","09","none"],"description":"99/95/74/50/00 are pound endings (£12.99); 05 rounds to the nearest 5p step (£12.40, £12.45); 09 to a 9p ending (£12.39, £12.49)."},"priceEndingDirection":{"type":"string","enum":["nearest","up","down"]},"pushToSalePrice":{"type":"boolean","description":"Send the price to the store's sale field (compare-at / sale_price) instead of the normal one."},"flat":{"type":"object","additionalProperties":false,"properties":{"startPoint":{"type":"string","enum":["cost","retail"]},"percentageValue":{"type":"number"},"applyMinMargin":{"type":"boolean"},"applyCreep":{"type":"boolean"},"creepDirection":{"type":"string","enum":["below","match","above"]},"creepValue":{"type":"number"},"creepType":{"type":"string","enum":["value","percentage"]},"creepCapEnabled":{"type":"boolean"},"creepCapMarginPct":{"type":["number","null"]}}},"follow":{"type":"object","additionalProperties":false,"properties":{"type":{"type":"string","enum":["cheapest_position","competitor","market"]},"cheapestPosition":{"type":"integer","minimum":1},"competitorId":{"type":["integer","null"]},"modifierDirection":{"type":"string","enum":["below","match","above"]},"modifierValue":{"type":"number"},"modifierType":{"type":"string","enum":["value","percentage"]},"applyMinMargin":{"type":"boolean"},"applyCreep":{"type":"boolean"},"creepDirection":{"type":"string","enum":["below","match","above"]},"creepValue":{"type":"number"},"creepType":{"type":"string","enum":["value","percentage"]},"creepCapEnabled":{"type":"boolean"},"creepCapMarginPct":{"type":["number","null"]}}},"flash":{"type":"object","additionalProperties":false,"properties":{"negativeMarginPercentageValue":{"type":"number"},"applyCreep":{"type":"boolean"},"creepDirection":{"type":"string","enum":["below","match","above"]},"creepValue":{"type":"number"},"creepType":{"type":"string","enum":["value","percentage"]}}}}},"RuleCreate":{"type":"object","required":["name","strategy"],"additionalProperties":false,"properties":{"name":{"type":"string","maxLength":120},"strategy":{"type":"string","enum":["flat","follow","flash"]},"enabled":{"type":"boolean","default":true},"channel_id":{"type":["integer","null"],"description":"A rule-capable selling channel; absent = the store (all-channels ladder). Fixed at creation."},"priority":{"type":["integer","null"],"description":"Absent = top of the ladder."},"settings":{"$ref":"#/components/schemas/RuleSettings"},"targeting":{"$ref":"#/components/schemas/RuleTargeting"},"schedule":{"$ref":"#/components/schemas/RuleSchedule"}}},"RulePatch":{"type":"object","minProperties":1,"additionalProperties":false,"properties":{"name":{"type":"string","maxLength":120},"enabled":{"type":"boolean"},"priority":{"type":"integer","minimum":1},"strategy":{"type":"string","enum":["flat","follow","flash"],"description":"Needs `settings` for the new strategy."},"settings":{"$ref":"#/components/schemas/RuleSettings"},"targeting":{"$ref":"#/components/schemas/RuleTargeting"},"schedule":{"$ref":"#/components/schemas/RuleSchedule"}}},"Simulation":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"rule_id":{"type":"integer","format":"int64","minimum":1},"summary":{"type":"object","properties":{"products":{"type":"integer"},"changed":{"type":"integer"},"increased":{"type":"integer"},"decreased":{"type":"integer"},"unchanged":{"type":"integer"},"skipped":{"type":"integer"},"out_of_stock":{"type":"integer"}}},"data":{"type":"array","items":{"type":"object","properties":{"product_id":{"type":"integer","format":"int64","minimum":1},"sku":{"type":"string"},"current_price":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"new_price":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"store_price":{"type":["string","null"]},"direction":{"type":"string","enum":["increase","decrease","none","skip"]},"changed":{"type":"boolean"},"margin_percent":{"type":["string","null"]},"competitors":{"type":"integer"},"reason":{"type":["string","null"]}}}}}},"Tag":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"name":{"type":"string"},"colour":{"type":["string","null"]},"dynamic":{"type":"boolean"},"hides_products":{"type":"boolean"},"products":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}},"TagOne":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"data":{"$ref":"#/components/schemas/Tag"}}},"SellerToggle":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"data":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"name":{"type":"string"},"enabled":{"type":"boolean"}}}}},"OfferOverride":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"product_id":{"type":"integer","format":"int64","minimum":1},"listing_id":{"type":"integer","format":"int64","minimum":1},"state":{"type":"string","enum":["disabled","preferred","clear"]},"scope":{"type":"string","enum":["seller","listing"]}}},"Rescrape":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"state":{"type":"string","description":"queued, reading, done, failed, refused …"},"message":{"type":"string"},"checked_at":{"type":["string","null"],"format":"date-time"},"price":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"in_stock":{"type":["boolean","null"]},"http_status":{"type":["integer","null"]}}},"Band":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"group_id":{"type":["integer","null"]},"filter":{"type":"object","properties":{"type":{"type":"string","enum":["default","supplier","flag"]},"value":{"type":["string","null"]}}},"min_cost":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"max_cost":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}],"description":"null = no upper bound"},"margin_percent":{"type":"string"},"min_cash_margin":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}],"description":"Optional £ profit floor: price is raised to max(% floor, cost + this)."},"channel_id":{"type":["integer","null"]},"source":{"type":"string","description":"manual, starter, recommended …"}}},"Margins":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"band_id":{"type":"integer","format":"int64","minimum":1},"group_id":{"type":"integer","format":"int64","minimum":1},"default_percent":{"type":"string"},"bands":{"type":"array","items":{"$ref":"#/components/schemas/Band"}},"groups":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"name":{"type":"string"},"enabled":{"type":"boolean"},"priority":{"type":"integer"},"targeting":{"type":"object","properties":{"suppliers":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"tag_match":{"type":"string","enum":["any","all"]}}},"bands":{"type":"array","items":{"$ref":"#/components/schemas/Band"}}}}}}},"BandCreate":{"type":"object","required":["min_cost","max_cost","margin_percent"],"additionalProperties":false,"properties":{"min_cost":{"type":"number","minimum":0,"description":"ex tax"},"max_cost":{"type":"number","minimum":0,"description":"ex tax"},"margin_percent":{"type":"number","minimum":0,"maximum":100},"min_cash_margin":{"type":["number","null"]},"group_id":{"type":["integer","null"]}}},"BandPatch":{"type":"object","minProperties":1,"additionalProperties":false,"properties":{"min_cost":{"type":["number","null"]},"max_cost":{"type":["number","null"]},"margin_percent":{"type":"number","minimum":0,"maximum":100},"min_cash_margin":{"type":["number","null"]}}},"GroupInput":{"type":"object","required":["name"],"additionalProperties":false,"properties":{"name":{"type":"string","maxLength":120},"suppliers":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"tag_match":{"type":"string","enum":["any","all"]}}},"GroupPatch":{"type":"object","minProperties":1,"additionalProperties":false,"properties":{"name":{"type":"string","maxLength":120},"suppliers":{"type":"array","items":{"type":"string"}},"tags":{"type":"array","items":{"type":"string"}},"tag_match":{"type":"string","enum":["any","all"]},"priority":{"type":"integer","minimum":0},"enabled":{"type":"boolean"}}},"Tags":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"name":{"type":"string"},"colour":{"type":["string","null"]},"dynamic":{"type":"boolean"},"products":{"type":"integer"},"created_at":{"type":"string","format":"date-time"}}}}}},"PushOp":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"status":{"type":"string","enum":["dryrun","pending","running","completed","failed","cancelled"]},"type":{"type":"string"},"triggered_by":{"type":"string","description":"rule_tick = the daily automatic push; manual = a person; cutover = migration."},"store":{"type":"string"},"items":{"type":"object","properties":{"total":{"type":"integer"},"applied":{"type":"integer"},"held":{"type":"integer"},"failed":{"type":"integer"},"in_flight":{"type":"integer"}}},"error":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"started_at":{"type":["string","null"],"format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"}}},"PushList":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null on the last page."},"has_more":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/PushOp"}}}},"PushOne":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"data":{"$ref":"#/components/schemas/PushOp"}}},"PushCreate":{"type":"object","required":["mode"],"properties":{"mode":{"type":"string","enum":["rule","price","all"]},"product_ids":{"type":"array","items":{"type":"integer","format":"int64","minimum":1},"maxItems":500,"description":"mode rule"},"rule_id":{"type":["integer","null"],"description":"mode rule; optional when every product shares one rule"},"product_id":{"type":"integer","format":"int64","minimum":1,"description":"mode price"},"price":{"$ref":"#/components/schemas/MoneyInput"},"force":{"type":"boolean","description":"release the >50% per-item hold"},"dry_run":{"type":"boolean","description":"mode all: compute and send nothing"}}},"PushRuleResult":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"push_id":{"type":["integer","null"]},"rule_id":{"type":["integer","null"]},"sent":{"type":"integer"},"held":{"type":"array","items":{"type":"object","properties":{"product_id":{"type":"integer","format":"int64","minimum":1},"sku":{"type":"string"},"reason":{"type":"string"}}}},"status":{"type":"string"},"items_url":{"type":["string","null"]},"queued":{"type":"boolean"},"dry_run":{"type":"boolean"},"message":{"type":"string"}}},"PushPriceResult":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"push_id":{"type":"integer","format":"int64","minimum":1},"product_id":{"type":"integer","format":"int64","minimum":1},"from_price":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"to_price":{"$ref":"#/components/schemas/Money"},"store_price":{"type":"string","description":"the exact figure sent, in the store's own tax basis"},"status":{"type":"string"}}},"Rollback":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"push_id":{"type":"integer","format":"int64","minimum":1},"pending":{"type":"boolean"},"ok":{"type":"boolean"},"preview":{"type":"boolean"},"rollback_push_id":{"type":["integer","null"]},"restored":{"type":"integer"},"changed_since":{"type":"integer","description":"held back only because the store price moved since the push (force releases)"},"skipped":{"type":"array","items":{"type":"object","properties":{"product_id":{"type":["integer","null"]},"sku":{"type":"string"},"reason":{"type":"string"}}}},"code":{"type":["string","null"]},"message":{"type":["string","null"]}}},"PushItems":{"type":"object","properties":{"currency":{"type":"string","description":"ISO 4217 currency of every price in this response."},"tax_rate":{"type":"string","description":"The workspace's tax rate in percent, 2 dp (e.g. \"20.00\")."},"next_cursor":{"type":["string","null"],"description":"Pass as ?cursor= for the next page; null on the last page."},"has_more":{"type":"boolean"},"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","format":"int64","minimum":1},"product_id":{"type":["integer","null"]},"sku":{"type":"string"},"from_price":{"oneOf":[{"$ref":"#/components/schemas/Money"},{"type":"null"}]},"to_price":{"$ref":"#/components/schemas/Money"},"rule":{"type":["string","null"]},"send_type":{"type":"string","enum":["auto","manual"]},"status":{"type":"string","enum":["dryrun","held","sent","applied","push_failed","item_error"]},"error":{"type":["string","null"]},"at":{"type":"string","format":"date-time"}}}}}}}}}