{
  "openapi": "3.0.3",
  "info": {
    "title": "AMH Fitting Room — seller catalogue index",
    "version": "1.0.0",
    "description": "Indexed, searchable copy of a seller's real catalogue (Shopify storefronts). Use /index/items to find real products with real prices, in-stock sizes and product URLs; use /look to turn chosen items into one shareable link with a cart behind it. Never invent products: every id here maps to a live product page."
  },
  "servers": [
    {
      "url": "https://artificialmindhive.com/api/tryon"
    }
  ],
  "paths": {
    "/index/shops": {
      "get": {
        "operationId": "listStores",
        "summary": "Discover connected stores without knowing a store domain",
        "responses": {
          "200": {
            "description": "{ok, shops:[{shop,name,platform,status,item_count,indexed_at}]}"
          }
        }
      }
    },
    "/index": {
      "get": {
        "operationId": "getCatalogStatus",
        "summary": "Is this store indexed, and what is in it",
        "parameters": [
          {
            "name": "shop",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Store domain, e.g. dndoutfitterswv.com"
          }
        ],
        "responses": {
          "200": {
            "description": "status, platform (shopify|import), counts by zone (head/top/legs/feet/bag/accessory), by who (men/women/kids/unisex) and by kind; newCount"
          }
        }
      },
      "post": {
        "operationId": "indexStore",
        "summary": "Index (or refresh) a Shopify store's catalogue",
        "parameters": [
          {
            "name": "shop",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Store domain, e.g. dndoutfitterswv.com"
          }
        ],
        "responses": {
          "200": {
            "description": "indexed counts"
          },
          "422": {
            "description": "not a Shopify storefront"
          }
        }
      }
    },
    "/index/items": {
      "get": {
        "operationId": "searchCatalog",
        "summary": "Search a store's indexed catalogue",
        "parameters": [
          {
            "name": "shop",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Store domain, e.g. dndoutfitterswv.com"
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "free text: 'square toe boots', 'flannel shirt'"
          },
          {
            "name": "zone",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "head",
                "top",
                "legs",
                "feet",
                "bag",
                "accessory"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "comma list of tee|shirt|sweater|jacket|dress|swim|pants|shorts|hat|beanie|backpack|bag|wallet|shoes|socks|sunglasses|keychain|accessory"
          },
          {
            "name": "new",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "new arrivals only"
          },
          {
            "name": "who",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "men",
                "women",
                "kids",
                "unisex",
                "any"
              ]
            }
          },
          {
            "name": "color",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "min price USD"
          },
          {
            "name": "max",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "max price USD"
          },
          {
            "name": "in_stock",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 12,
              "maximum": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "{ total, items:[{id,title,type,zone,who,price,image,url,colors,in_stock,sizes_in_stock,variant_for_cart}] }"
          }
        }
      }
    },
    "/index/item": {
      "get": {
        "operationId": "getCatalogItem",
        "summary": "One product in full (all images, description, every size)",
        "parameters": [
          {
            "name": "shop",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Store domain, e.g. dndoutfitterswv.com"
          },
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "product"
          },
          "404": {
            "description": "unknown id"
          }
        }
      }
    },
    "/look": {
      "post": {
        "operationId": "saveLook",
        "summary": "Store an outfit (one person or a whole family) temporarily and get one link with a cart",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "shop",
                  "people"
                ],
                "properties": {
                  "shop": {
                    "type": "string"
                  },
                  "note": {
                    "type": "string"
                  },
                  "ttlHours": {
                    "type": "integer",
                    "default": 24,
                    "maximum": 168
                  },
                  "source": {
                    "type": "string",
                    "description": "who built it, e.g. 'gemini'"
                  },
                  "people": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "label",
                        "items"
                      ],
                      "properties": {
                        "label": {
                          "type": "string",
                          "example": "dad"
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "variant": {
                                    "type": "string"
                                  }
                                }
                              }
                            ]
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "{ id, url, expires_at }"
          }
        }
      }
    },
    "/look/{id}": {
      "get": {
        "operationId": "getLook",
        "summary": "Read a stored look: people, items, prices, cart_url",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "look"
          },
          "404": {
            "description": "expired or unknown"
          }
        }
      }
    }
  }
}