{
  "openapi": "3.0.3",
  "info": {
    "title": "Wardrobe Connect",
    "version": "1.0.0",
    "description": "Find clothes you can buy that match a look you like. Describe the item or give a picture of it (for example a Pinterest pin or a saved Instagram post) and get matching eBay listings, new and pre-owned, in the user's country and currency, with prices including shipping, plus search links for other clothing shops. Every answer has a ready-to-read `say` line. For second-hand and local options, pass `facebook_marketplace_query` to the Facebook connector's Marketplace search. Read only, no account, nothing stored.",
    "contact": { "email": "hello@askmizan.com" }
  },
  "servers": [{ "url": "https://wardrobeconnect.pages.dev" }],
  "paths": {
    "/v1/find": {
      "get": {
        "operationId": "findClothes",
        "summary": "Find clothes that match a description",
        "description": "Use when the user describes a piece of clothing they want (\"black pleated wide-leg trousers\", \"cream cable-knit jumper like the one I saved\"). Returns eBay listings in the Clothing, Shoes and Accessories category, cheapest first, plus search links for other shops and a Facebook Marketplace search phrase.",
        "parameters": [
          { "name": "q", "in": "query", "required": true, "description": "A clear description of the item: colour, type, fabric or style, brand if known.", "schema": { "type": "string", "example": "black pleated wide-leg trousers" } },
          { "name": "size", "in": "query", "required": false, "description": "The user's size, for example M, XL, 10, 32.", "schema": { "type": "string" } },
          { "name": "max_price", "in": "query", "required": false, "description": "Most the user wants to pay, in their local currency, shipping included.", "schema": { "type": "number" } },
          { "name": "condition", "in": "query", "required": false, "description": "new, used (pre-owned) or any. Default any.", "schema": { "type": "string", "enum": ["any", "new", "used"] } },
          { "name": "country", "in": "query", "required": false, "description": "Two-letter country code. Defaults to where the request comes from. Supported: US, GB, IE, CA, AU, DE, FR, IT, ES.", "schema": { "type": "string" } }
        ],
        "responses": { "200": { "description": "Matches", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Result" } } } }, "400": { "description": "No description given" } }
      }
    },
    "/v1/find-by-image": {
      "get": {
        "operationId": "findClothesByImage",
        "summary": "Find clothes that look like a picture",
        "description": "Use when the user shares or points at a picture of an outfit or item (a Pinterest pin, a saved post, a photo). Give the image's direct https link. Returns visually similar eBay listings. Adding a short description in q helps if the picture shows more than one item.",
        "parameters": [
          { "name": "image_url", "in": "query", "required": true, "description": "Direct https link to a JPEG, PNG or WebP picture, 6 MB at most.", "schema": { "type": "string" } },
          { "name": "q", "in": "query", "required": false, "description": "Which item in the picture, for example \"the camel coat\". Also used as a fallback text search.", "schema": { "type": "string" } },
          { "name": "size", "in": "query", "required": false, "schema": { "type": "string" } },
          { "name": "max_price", "in": "query", "required": false, "schema": { "type": "number" } },
          { "name": "condition", "in": "query", "required": false, "schema": { "type": "string", "enum": ["any", "new", "used"] } },
          { "name": "country", "in": "query", "required": false, "schema": { "type": "string" } }
        ],
        "responses": { "200": { "description": "Similar items", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Result" } } } }, "400": { "description": "No picture link" }, "422": { "description": "The picture could not be opened" } }
      }
    },
    "/v1/health": { "get": { "operationId": "health", "summary": "Service status", "responses": { "200": { "description": "OK" } } } }
  },
  "components": {
    "schemas": {
      "Result": {
        "type": "object",
        "properties": {
          "say": { "type": "string", "description": "A short answer to read to the user." },
          "looking_for": { "type": "string", "nullable": true },
          "size": { "type": "string", "nullable": true },
          "max_price": { "type": "number", "nullable": true },
          "condition": { "type": "string" },
          "currency": { "type": "string" },
          "matches": { "type": "array", "items": { "$ref": "#/components/schemas/Listing" } },
          "shop_searches": { "type": "object", "additionalProperties": { "type": "string" }, "description": "Search links for other clothing shops in the user's country." },
          "facebook_marketplace_query": { "type": "string", "nullable": true, "description": "Pass this to the Facebook connector's Marketplace search for second-hand and local options." },
          "note": { "type": "string" },
          "disclosure": { "type": "string" }
        }
      },
      "Listing": {
        "type": "object",
        "properties": {
          "title": { "type": "string" },
          "price": { "type": "number", "description": "Price including standard shipping." },
          "item_price": { "type": "number" },
          "shipping": { "type": "number" },
          "currency": { "type": "string" },
          "condition": { "type": "string" },
          "image": { "type": "string", "nullable": true },
          "seller_feedback": { "type": "string", "nullable": true },
          "url": { "type": "string" }
        }
      }
    }
  }
}
