{"openapi":"3.1.0","info":{"title":"TESI Marketplace search","version":"0.2.0","description":"Read-only product search, catalog comparisons and garment sizing."},"servers":[{"url":"/marketplace/"}],"paths":{"/api/search":{"post":{"operationId":"tesi_marketplace_search","description":"Compare packaging cases by dimensions, quantity, destination and budget. Use merchantOnly to exclude simulated offers. A simulated_merchant_checkout result is example data. For current U.S. store links across categories, use tesi_shop_find_products when available.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"query":{"type":"string","maxLength":150,"description":"Product terms, for example padded mailers."},"category":{"type":"string","enum":["mailers","boxes","labels","tape"]},"material":{"type":"string","description":"Exact material, for example recycled paper."},"widthIn":{"type":"number","minimum":0.25,"maximum":1000,"description":"Exact listed width in inches."},"lengthIn":{"type":"number","minimum":0.25,"maximum":1000,"description":"Exact listed length in inches."},"minInsideWidthIn":{"type":"number","minimum":0.25,"maximum":1000,"description":"Required usable width in inches, including buyer clearance. Uses the merchant’s stated minimum when available."},"minInsideLengthIn":{"type":"number","minimum":0.25,"maximum":1000,"description":"Required usable length in inches, including buyer clearance. Uses the merchant’s stated minimum when available."},"quantity":{"type":"integer","minimum":1,"maximum":100000,"default":1},"exactQuantity":{"type":"boolean","default":false,"description":"Exclude cases that require buying more than requested."},"country":{"type":"string","pattern":"^[A-Z]{2}$","default":"US"},"shipToState":{"type":"string","enum":["AK","AL","AR","AZ","CA","CO","CT","DC","DE","FL","GA","HI","IA","ID","IL","IN","KS","KY","LA","MA","MD","ME","MI","MN","MO","MS","MT","NC","ND","NE","NH","NJ","NM","NV","NY","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VA","VT","WA","WI","WV","WY"],"description":"U.S. shipping state. Include for offers with approved regional shipping."},"merchantOnly":{"type":"boolean","default":false,"description":"Restrict results and budget explanations to the registered merchant catalog."},"maxCents":{"type":"integer","minimum":1,"maximum":100000000,"description":"Maximum item-plus-shipping subtotal in US cents, before tax."},"maxDays":{"type":"integer","minimum":1,"maximum":90},"limit":{"type":"integer","minimum":1,"maximum":24,"default":12},"explainEmpty":{"type":"boolean","default":false,"description":"Explain why a budget, shipping state, interior measurement, case quantity or seller quote requirement prevents a match. Leaves the results empty."}}}}}},"responses":{"200":{"description":"Comparison result","content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"enum":["catalog","local_demo"]},"ranking":{"const":"item_plus_shipping_usd"},"results":{"type":"array","items":{"type":"object","properties":{"offerId":{"type":"string"},"merchantId":{"type":"string"},"merchant":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"widthIn":{"type":"number"},"lengthIn":{"type":"number"},"requestedQuantity":{"type":"integer","minimum":0},"quantity":{"type":"integer","minimum":0},"packs":{"type":"integer","minimum":0},"packCount":{"type":"integer","minimum":0},"subtotalCents":{"type":"integer","minimum":0},"itemCents":{"type":"integer","minimum":0},"shippingCents":{"type":"integer","minimum":0},"currency":{"const":"USD"},"checkoutMode":{"enum":["simulated_merchant_checkout","merchant_product_page","shopify_legacy_cart","shopify_ucp_permalink"]},"sourceUpdatedAt":{"type":"string","format":"date-time"},"reviewPath":{"type":"string","format":"uri-reference"},"reviewUrl":{"type":"string","format":"uri"},"offerExpiresAt":{"type":"string","format":"date-time"},"freeShippingMinCents":{"type":"integer","minimum":0},"volumePackCents":{"type":"integer","minimum":0},"maxDirectPacks":{"type":"integer","minimum":0},"productFingerprint":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["offerId","merchant","sku","name","requestedQuantity","quantity","packs","packCount","subtotalCents","currency","checkoutMode","reviewPath"]}},"whyEmpty":{"oneOf":[{"type":"object","properties":{"code":{"const":"above_budget"},"maxCents":{"type":"integer","minimum":0},"lowestSubtotalCents":{"type":"integer","minimum":0},"currency":{"const":"USD"},"checkoutMode":{"enum":["simulated_merchant_checkout","merchant_product_page","shopify_legacy_cart","shopify_ucp_permalink"]}},"required":["code","maxCents","lowestSubtotalCents","currency","checkoutMode"]},{"type":"object","properties":{"code":{"const":"shipping_state_required"}},"required":["code"]},{"type":"object","properties":{"code":{"const":"usable_interior_unconfirmed"},"minInsideWidthIn":{"type":"number"},"minInsideLengthIn":{"type":"number"}},"required":["code"],"anyOf":[{"required":["minInsideWidthIn"]},{"required":["minInsideLengthIn"]}]},{"type":"object","properties":{"code":{"const":"case_quantity_mismatch"},"requestedQuantity":{"type":"integer","minimum":0},"quantity":{"type":"integer","minimum":0},"packCount":{"type":"integer","minimum":0},"checkoutMode":{"enum":["simulated_merchant_checkout","merchant_product_page","shopify_legacy_cart","shopify_ucp_permalink"]}},"required":["code","requestedQuantity","quantity","packCount","checkoutMode"]},{"type":"object","properties":{"code":{"const":"seller_quote_required"}},"required":["code"]}]},"shopLinksAvailable":{"const":true}},"required":["mode","ranking","results"]}}}},"400":{"description":"Invalid comparison request"},"403":{"description":"Request origin outside the marketplace"},"413":{"description":"Request body too large"},"415":{"description":"JSON request required"}}}},"/api/search/list":{"post":{"operationId":"tesi_marketplace_search_list","description":"Search up to twenty purchasing list lines in one call. Sends back ranked offers and review links for each line alongside any missing or invalid lines.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["items"],"properties":{"items":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"object","additionalProperties":false,"required":["id","search"],"properties":{"id":{"type":"string","pattern":"^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$"},"search":{"type":"object","additionalProperties":false,"properties":{"query":{"type":"string","maxLength":150,"description":"Product terms, for example padded mailers."},"category":{"type":"string","enum":["mailers","boxes","labels","tape"]},"material":{"type":"string","description":"Exact material, for example recycled paper."},"widthIn":{"type":"number","minimum":0.25,"maximum":1000,"description":"Exact listed width in inches."},"lengthIn":{"type":"number","minimum":0.25,"maximum":1000,"description":"Exact listed length in inches."},"minInsideWidthIn":{"type":"number","minimum":0.25,"maximum":1000,"description":"Required usable width in inches, including buyer clearance. Uses the merchant’s stated minimum when available."},"minInsideLengthIn":{"type":"number","minimum":0.25,"maximum":1000,"description":"Required usable length in inches, including buyer clearance. Uses the merchant’s stated minimum when available."},"quantity":{"type":"integer","minimum":1,"maximum":100000,"default":1},"exactQuantity":{"type":"boolean","default":false,"description":"Exclude cases that require buying more than requested."},"country":{"type":"string","pattern":"^[A-Z]{2}$","default":"US"},"shipToState":{"type":"string","enum":["AK","AL","AR","AZ","CA","CO","CT","DC","DE","FL","GA","HI","IA","ID","IL","IN","KS","KY","LA","MA","MD","ME","MI","MN","MO","MS","MT","NC","ND","NE","NH","NJ","NM","NV","NY","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VA","VT","WA","WI","WV","WY"],"description":"U.S. shipping state. Include for offers with approved regional shipping."},"merchantOnly":{"type":"boolean","default":false,"description":"Restrict results and budget explanations to the registered merchant catalog."},"maxCents":{"type":"integer","minimum":1,"maximum":100000000,"description":"Maximum item-plus-shipping subtotal in US cents, before tax."},"maxDays":{"type":"integer","minimum":1,"maximum":90},"limit":{"type":"integer","minimum":1,"maximum":6,"default":3},"explainEmpty":{"type":"boolean","default":false,"description":"Explain why a budget, shipping state, interior measurement, case quantity or seller quote requirement prevents a match. Leaves the results empty."}}}}}}}}}}},"responses":{"200":{"description":"Comparison result","content":{"application/json":{"schema":{"type":"object","properties":{"counts":{"type":"object","properties":{"offers_found":{"type":"integer","minimum":0},"no_offers":{"type":"integer","minimum":0},"invalid_search":{"type":"integer","minimum":0}},"required":["offers_found","no_offers","invalid_search"]},"items":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"enum":["offers_found","no_offers"]},"mode":{"enum":["catalog","local_demo"]},"ranking":{"const":"item_plus_shipping_usd"},"results":{"type":"array","items":{"type":"object","properties":{"offerId":{"type":"string"},"merchantId":{"type":"string"},"merchant":{"type":"string"},"sku":{"type":"string"},"name":{"type":"string"},"widthIn":{"type":"number"},"lengthIn":{"type":"number"},"requestedQuantity":{"type":"integer","minimum":0},"quantity":{"type":"integer","minimum":0},"packs":{"type":"integer","minimum":0},"packCount":{"type":"integer","minimum":0},"subtotalCents":{"type":"integer","minimum":0},"itemCents":{"type":"integer","minimum":0},"shippingCents":{"type":"integer","minimum":0},"currency":{"const":"USD"},"checkoutMode":{"enum":["simulated_merchant_checkout","merchant_product_page","shopify_legacy_cart","shopify_ucp_permalink"]},"sourceUpdatedAt":{"type":"string","format":"date-time"},"reviewPath":{"type":"string","format":"uri-reference"},"reviewUrl":{"type":"string","format":"uri"},"offerExpiresAt":{"type":"string","format":"date-time"},"freeShippingMinCents":{"type":"integer","minimum":0},"volumePackCents":{"type":"integer","minimum":0},"maxDirectPacks":{"type":"integer","minimum":0},"productFingerprint":{"type":"string","pattern":"^[a-f0-9]{64}$"}},"required":["offerId","merchant","sku","name","requestedQuantity","quantity","packs","packCount","subtotalCents","currency","checkoutMode","reviewPath"]}},"whyEmpty":{"oneOf":[{"type":"object","properties":{"code":{"const":"above_budget"},"maxCents":{"type":"integer","minimum":0},"lowestSubtotalCents":{"type":"integer","minimum":0},"currency":{"const":"USD"},"checkoutMode":{"enum":["simulated_merchant_checkout","merchant_product_page","shopify_legacy_cart","shopify_ucp_permalink"]}},"required":["code","maxCents","lowestSubtotalCents","currency","checkoutMode"]},{"type":"object","properties":{"code":{"const":"shipping_state_required"}},"required":["code"]},{"type":"object","properties":{"code":{"const":"usable_interior_unconfirmed"},"minInsideWidthIn":{"type":"number"},"minInsideLengthIn":{"type":"number"}},"required":["code"],"anyOf":[{"required":["minInsideWidthIn"]},{"required":["minInsideLengthIn"]}]},{"type":"object","properties":{"code":{"const":"case_quantity_mismatch"},"requestedQuantity":{"type":"integer","minimum":0},"quantity":{"type":"integer","minimum":0},"packCount":{"type":"integer","minimum":0},"checkoutMode":{"enum":["simulated_merchant_checkout","merchant_product_page","shopify_legacy_cart","shopify_ucp_permalink"]}},"required":["code","requestedQuantity","quantity","packCount","checkoutMode"]},{"type":"object","properties":{"code":{"const":"seller_quote_required"}},"required":["code"]}]},"shopLinksAvailable":{"const":true}},"required":["id","status","mode","ranking","results"]},{"type":"object","properties":{"id":{"type":"string"},"status":{"const":"invalid_search"},"error":{"type":"string"},"message":{"type":"string"}},"required":["id","status","error","message"]}]}}},"required":["counts","items"]}}}},"400":{"description":"Invalid comparison request"},"403":{"description":"Request origin outside the marketplace"},"413":{"description":"Request body too large"},"415":{"description":"JSON request required"}}}},"/api/fit":{"post":{"operationId":"tesi_garment_fit","description":"Compare a reference shirt with product charts and stock observations. Search the private catalog, pass product links, or supply a report. Optionally cap the item price in a named currency. Returns sourced matches and eligibility reasons. No network requests or purchases.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"market":{"type":"string","pattern":"^[A-Z]{2}$"},"budget":{"type":"object","properties":{"amount":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,7})(?:\\.[0-9]{1,6})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"}},"required":["amount","currency"]},"reference":{"type":"object","properties":{"kind":{"const":"flat_garment"},"unit":{"type":"string","enum":["cm","in"]},"width":{"type":"number"},"length":{"type":"number"},"method":{"type":"string","enum":["underarm_width_back_length","chest_1cm_below_underarm_shoulder_length","chest_1in_below_armhole_shoulder_length"],"default":"underarm_width_back_length"},"tolerance":{"type":"object","properties":{"width":{"type":"number"},"length":{"type":"number"}},"required":["width","length"]}},"required":["kind","unit","width","length","tolerance"]},"query":{"type":"string","minLength":1,"maxLength":150,"description":"Search the registered catalog for product, retailer, color or SKU terms."},"links":{"type":"array","minItems":1,"maxItems":12,"items":{"type":"string"}},"mode":{"type":"string","enum":["evidence","demo"]},"maxMatches":{"type":"integer","minimum":1,"maximum":20,"description":"Return only this many ranked matches with product evidence and counts."},"products":{"type":"array","minItems":1,"maxItems":40,"items":{"type":"object","properties":{"productId":{"type":"string"},"market":{"type":"string","pattern":"^[A-Z]{2}$"},"merchant":{"type":"string"},"title":{"type":"string"},"color":{"type":"string"},"url":{"type":"string"},"chart":{"anyOf":[{"type":"object","properties":{"productId":{"type":"string"},"market":{"type":"string","pattern":"^[A-Z]{2}$"},"kind":{"type":"string"},"unit":{"type":"string","enum":["cm","in"]},"url":{"type":"string"},"location":{"type":"string"},"method":{"type":"string","description":"Match the publication’s measuring points. Use underarm_width_back_length for underarm width and back length. Use chest_1cm_below_underarm_shoulder_length for width 1 cm below armhole, shoulder-to-hem length. Use chest_1in_below_armhole_shoulder_length for width 1 in below armhole, shoulder-to-hem length. Use unverified if the chart does not specify its method."},"variationCm":{"type":"number","minimum":0,"maximum":25,"description":"Variation below or above the published measurements, in cm, only when the retailer states it."},"rows":{"type":"array","maxItems":32,"items":{"type":"object","properties":{"size":{"type":"string"},"width":{"type":["number","null"]},"length":{"type":["number","null"]},"conflictingMeasurements":{"type":"array","maxItems":2,"uniqueItems":true,"items":{"enum":["width","length"]},"description":"Mark conflicting dimensions and leave their values empty until the retailer clarifies."}},"required":["size"]}}},"required":["productId","market","kind","unit","url","rows"]},{"type":"null"}]},"stock":{"type":"array","maxItems":80,"items":{"type":"object","properties":{"productId":{"type":"string"},"market":{"type":"string","pattern":"^[A-Z]{2}$"},"color":{"type":"string"},"size":{"type":"string"},"variantId":{"type":"string"},"observedAt":{"type":"string","format":"date-time"},"url":{"type":"string"},"status":{"type":"string","enum":["in_stock","out_of_stock","unknown"]},"price":{"type":"object","properties":{"amount":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,7})(?:\\.[0-9]{1,6})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"}},"required":["amount","currency"]},"priceConflict":{"type":"boolean"}},"required":["productId","market","color","size","variantId","observedAt","status","url"]}},"checkoutPause":{"type":"object","properties":{"url":{"type":"string"},"observedAt":{"type":"string","format":"date-time"},"scheduledReopenAt":{"type":"string","format":"date-time"},"reopenedAt":{"type":"string","format":"date-time"}},"required":["url","observedAt","scheduledReopenAt"]}},"required":["productId","market","merchant","title","color","url"]}}},"required":["market","reference"],"oneOf":[{"required":["query"],"not":{"anyOf":[{"required":["links"]},{"required":["products"]},{"required":["mode"]}]}},{"required":["links"],"not":{"anyOf":[{"required":["query"]},{"required":["products"]},{"required":["mode"]}]}},{"required":["products"],"not":{"anyOf":[{"required":["query"]},{"required":["links"]}]}}]}}}},"responses":{"200":{"description":"Comparison result","content":{"application/json":{"schema":{"type":"object","properties":{"matches":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"color":{"type":"string"},"size":{"type":"string"}},"required":["productId","color","size"]}},"comparisons":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"color":{"type":"string"},"status":{"type":"string"}},"required":["productId","color","status"]}}},"required":["matches","comparisons"]}}}},"400":{"description":"Invalid comparison request"},"403":{"description":"Request origin outside the marketplace"},"413":{"description":"Request body too large"},"415":{"description":"JSON request required"}}}},"/api/fit/stock-plan":{"post":{"operationId":"tesi_garment_stock_plan","description":"Group missing or conflicting availability and price checks by registered product page for a browser worker. Accept a catalog query or registered product links. Returned tasks omit buyer measurements and budgets. Creates no jobs and changes no stock.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"market":{"type":"string","pattern":"^[A-Z]{2}$"},"budget":{"type":"object","properties":{"amount":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,7})(?:\\.[0-9]{1,6})?$"},"currency":{"type":"string","pattern":"^[A-Z]{3}$"}},"required":["amount","currency"]},"reference":{"type":"object","properties":{"kind":{"const":"flat_garment"},"unit":{"type":"string","enum":["cm","in"]},"width":{"type":"number"},"length":{"type":"number"},"method":{"type":"string","enum":["underarm_width_back_length","chest_1cm_below_underarm_shoulder_length","chest_1in_below_armhole_shoulder_length"],"default":"underarm_width_back_length"},"tolerance":{"type":"object","properties":{"width":{"type":"number"},"length":{"type":"number"}},"required":["width","length"]}},"required":["kind","unit","width","length","tolerance"]},"query":{"type":"string","minLength":1,"maxLength":150,"description":"Search the registered catalog for product, retailer, color or SKU terms."},"links":{"type":"array","minItems":1,"maxItems":12,"items":{"type":"string"}}},"required":["market","reference"],"additionalProperties":false,"oneOf":[{"required":["query"]},{"required":["links"]}]}}}},"responses":{"200":{"description":"Comparison result","content":{"application/json":{"schema":{"type":"object","properties":{"tasks":{"type":"array","items":{"type":"object","properties":{"sourceId":{"type":"string"},"productId":{"type":"string"},"url":{"type":"string"},"size":{"type":"string"},"reason":{"type":"string"}},"required":["sourceId","productId","url","size","reason"]}},"pages":{"type":"array","items":{"type":"object"}}},"required":["tasks","pages"]}}}},"400":{"description":"Invalid comparison request"},"403":{"description":"Request origin outside the marketplace"},"413":{"description":"Request body too large"},"415":{"description":"JSON request required"}}}},"/api/shop-links":{"post":{"operationId":"tesi_shop_find_products","description":"Search participating Shopify stores for a U.S. shopper. Give the product name or model and keep the shopper’s constraints. Use size for an exact size and maxCents for a USD item-price limit. A successful call supplies a short list with direct seller links, prices and variant options, or says when none could be verified. Show the matches to the shopper. If none match, ask before relaxing a requirement. Shopify receives the product terms and any applicable filters. Use no personal information. The seller confirms shipping, tax and final price. This tool makes no cart or purchase.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["query"],"properties":{"query":{"type":"string","minLength":1,"maxLength":150,"description":"Product terms, for example USB-C charging cable, 6 ft."},"maxCents":{"type":"integer","minimum":0,"maximum":9007199254740991,"description":"Optional inclusive maximum listed item price in USD cents. Excludes shipping and tax. For example, 2500 means $25.00."},"size":{"type":"string","minLength":1,"maxLength":20,"description":"Exact listed size such as 8, US 8.5, EU 42, or XL. Include the sizing system when the shopper specifies it."}}}}}},"responses":{"200":{"description":"Comparison result","content":{"application/json":{"schema":{"type":"object","properties":{"source":{"const":"Shopify Shop MCP"},"market":{"const":"US"},"status":{"enum":["matches","no_matches"]},"noMatchReason":{"type":"string"},"checkedAt":{"type":"string","format":"date-time"},"messages":{"type":"array","items":{"type":"object","properties":{"type":{"enum":["warning","error"]},"content":{"type":"string"}},"required":["type","content"]}},"links":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"seller":{"type":"string"},"url":{"type":"string","format":"uri"},"sponsored":{"type":"boolean"},"price":{"description":"Listed item price in USD cents, when available. Shipping and tax are separate.","anyOf":[{"type":"object","properties":{"amount":{"type":"integer","minimum":0},"currency":{"const":"USD"}},"required":["amount","currency"]},{"type":"null"}]},"options":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"}},"required":["name","label"]}}},"required":["title","seller","url","price","options"]}}},"required":["source","market","checkedAt","messages","links"]}},"text/plain":{"schema":{"type":"string"}}}},"400":{"description":"Invalid comparison request"},"403":{"description":"Request origin outside the marketplace"},"413":{"description":"Request body too large"},"415":{"description":"JSON request required"},"502":{"description":"Shopify lookup unavailable"},"503":{"description":"Shopify lookup rate limited"}}}}}}