{
 "openapi": "3.1.0",
 "info": {
  "title": "Frame Spotter public API",
  "version": "1.0.0",
  "summary": "Free, read-only data about well-made secondhand eyewear on ShopGoodwill and EBTH auctions.",
  "description": "Frame Spotter checks ShopGoodwill and EBTH twice a day (10 AM and 5 PM Central) for eyeglasses and sunglasses from more than 100 makers, never made in China, and gives each pair an estimated value, a buy-under price, a retail price and a rarity rating. This API is public and read only: no API key, no sign-up, nothing to write. It only covers the pairs anyone can see (the big fashion houses); member pairs, accounts and billing are not part of it. Values are estimates, not appraisals. Frame Spotter sells nothing; bidding and checkout happen on ShopGoodwill or EBTH.\n\nVersioning: this is API v1 (info.version 1.0.0). v1 lives under /api/v1/ and every response carries the header API-Version: 1. The older URLs (/data.json, /brands-data.json, /api/live, /api/board?counts=1) keep working as aliases. Fields may be added at any time, so ignore fields you do not know. A breaking change (a removed or renamed field or endpoint, a changed meaning) is announced on https://www.framespotter.xyz/developers before it happens and ships as a new version path (/api/v2/), and while an old endpoint is being retired it answers with Deprecation and Sunset headers. Nothing is deprecated today.\n\nRate limit: the two JSON endpoints under /api answer at most 60 requests per minute per IP address (HTTP 429 with Retry-After after that). Answers served from the cache do not count.",
  "termsOfService": "https://www.framespotter.xyz/terms",
  "contact": {
   "name": "Frame Spotter",
   "email": "framespotter@protonmail.com",
   "url": "https://www.framespotter.xyz/contact"
  },
  "x-api-lifecycle": {
   "version": "v1",
   "status": "stable",
   "readOnly": true,
   "authentication": "none",
   "versioning": "URL path (/api/v1/) and the API-Version response header",
   "deprecated": [],
   "deprecationPolicy": "Breaking changes are announced at https://www.framespotter.xyz/developers before they happen and ship under a new version path. A retiring endpoint sends Deprecation and Sunset headers.",
   "changelog": "https://www.framespotter.xyz/developers#versioning"
  }
 },
 "security": [],
 "servers": [
  {
   "url": "https://www.framespotter.xyz",
   "description": "Production"
  }
 ],
 "tags": [
  {
   "name": "Board",
   "description": "Live listings and live auction status"
  },
  {
   "name": "Brands",
   "description": "The makers Frame Spotter watches"
  },
  {
   "name": "Markdown",
   "description": "The same pages as Markdown for agents"
  }
 ],
 "externalDocs": {
  "description": "Frame Spotter for developers and agents",
  "url": "https://www.framespotter.xyz/developers"
 },
 "x-rate-limit": {
  "scope": "/api/v1/live and /api/v1/counts",
  "limit": 60,
  "windowSeconds": 60,
  "per": "IP address",
  "exceeded": "429 with Retry-After"
 },
 "paths": {
  "/api/v1/listings": {
   "get": {
    "operationId": "getBoard",
    "tags": [
     "Board"
    ],
    "summary": "Get the live board",
    "description": "Returns every live listing anyone can see (the pairs from the big fashion houses), plus recently closed pairs, with a valuation for each. Rebuilt at 10 AM and 5 PM Central, so there is no gain in polling more than a few times an hour. Pairs that need a membership are not included. Same data as /data.json.",
    "responses": {
     "200": {
      "description": "The public board.",
      "headers": {
       "API-Version": {
        "$ref": "#/components/headers/ApiVersion"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/BoardResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not found. The file is briefly missing only while a deploy is running; retry in a minute."
     }
    }
   }
  },
  "/api/v1/brands": {
   "get": {
    "operationId": "listBrands",
    "tags": [
     "Brands"
    ],
    "summary": "List the watched makers",
    "description": "Returns every eyewear maker Frame Spotter watches, with where it is made, a short history, what it is known for and what to hunt for. Same data as /brands-data.json.",
    "responses": {
     "200": {
      "description": "The makers.",
      "headers": {
       "API-Version": {
        "$ref": "#/components/headers/ApiVersion"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/BrandsResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not found. The file is briefly missing only while a deploy is running; retry in a minute."
     }
    }
   }
  },
  "/api/v1/live": {
   "get": {
    "operationId": "getLiveAuctionStatus",
    "tags": [
     "Board"
    ],
    "summary": "Get live price and bids for public pairs",
    "description": "Looks up the current price, bid count and closing time of pairs on the public board straight from ShopGoodwill or EBTH. Ids for pairs that are not on the public board are left out of the answer. Cached for about a minute. At most 60 requests a minute per IP address. Same as /api/live.",
    "parameters": [
     {
      "name": "uids",
      "in": "query",
      "required": true,
      "style": "form",
      "explode": false,
      "description": "Comma-separated uids from the board, at most 80.",
      "schema": {
       "type": "array",
       "items": {
        "type": "string",
        "pattern": "^(sg|ebth):[0-9]+$"
       },
       "maxItems": 80
      },
      "example": [
       "sg:283557458"
      ]
     }
    ],
    "responses": {
     "200": {
      "description": "An object keyed by uid.",
      "headers": {
       "API-Version": {
        "$ref": "#/components/headers/ApiVersion"
       },
       "RateLimit-Policy": {
        "$ref": "#/components/headers/RateLimitPolicy"
       },
       "RateLimit-Limit": {
        "$ref": "#/components/headers/RateLimitLimit"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/LiveStatusMap"
        }
       }
      }
     },
     "400": {
      "description": "The uids parameter is missing.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     },
     "405": {
      "description": "Only GET and HEAD are allowed.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     },
     "429": {
      "description": "Too many requests from this IP address.",
      "headers": {
       "Retry-After": {
        "$ref": "#/components/headers/RetryAfter"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     }
    }
   }
  },
  "/api/v1/counts": {
   "get": {
    "operationId": "getBoardCounts",
    "tags": [
     "Board"
    ],
    "summary": "Get board counts",
    "description": "Returns only numbers for the whole board: live pairs by access level, rarity and brand. No titles, links or prices. At most 60 requests a minute per IP address. Same as /api/board?counts=1.",
    "responses": {
     "200": {
      "description": "Counts.",
      "headers": {
       "API-Version": {
        "$ref": "#/components/headers/ApiVersion"
       },
       "RateLimit-Policy": {
        "$ref": "#/components/headers/RateLimitPolicy"
       },
       "RateLimit-Limit": {
        "$ref": "#/components/headers/RateLimitLimit"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CountsResponse"
        }
       }
      }
     },
     "405": {
      "description": "Only GET and HEAD are allowed.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     },
     "429": {
      "description": "Too many requests from this IP address.",
      "headers": {
       "Retry-After": {
        "$ref": "#/components/headers/RetryAfter"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ErrorBody"
        }
       }
      }
     }
    }
   }
  },
  "/index.md": {
   "get": {
    "operationId": "getBoardMarkdown",
    "tags": [
     "Markdown"
    ],
    "summary": "Get the board as Markdown",
    "description": "The live board for everyone, grouped by closing day, one line per listing. The home page returns the same Markdown when the request has Accept: text/markdown.",
    "responses": {
     "200": {
      "description": "The board as Markdown text.",
      "content": {
       "text/markdown": {
        "schema": {
         "$ref": "#/components/schemas/MarkdownDocument"
        },
        "example": "# Frame Spotter"
       }
      }
     },
     "404": {
      "description": "Not found. The file is briefly missing only while a deploy is running; retry in a minute."
     }
    }
   }
  },
  "/brands.md": {
   "get": {
    "operationId": "getBrandsMarkdown",
    "tags": [
     "Markdown"
    ],
    "summary": "Get The Brands as Markdown",
    "description": "Every watched maker with where it is made and what to hunt for.",
    "responses": {
     "200": {
      "description": "The makers as Markdown text.",
      "content": {
       "text/markdown": {
        "schema": {
         "$ref": "#/components/schemas/MarkdownDocument"
        },
        "example": "# The Brands | Frame Spotter"
       }
      }
     },
     "404": {
      "description": "Not found. The file is briefly missing only while a deploy is running; retry in a minute."
     }
    }
   }
  }
 },
 "components": {
  "schemas": {
   "ErrorBody": {
    "type": "object",
    "required": [
     "ok",
     "error"
    ],
    "properties": {
     "ok": {
      "type": "boolean",
      "const": false
     },
     "error": {
      "type": "object",
      "required": [
       "code",
       "status",
       "message",
       "hint"
      ],
      "properties": {
       "code": {
        "type": "string",
        "description": "Stable machine-readable code, for example missing_uids, not_found, method_not_allowed."
       },
       "status": {
        "type": "integer",
        "description": "The HTTP status code."
       },
       "message": {
        "type": "string",
        "description": "What went wrong, in plain words."
       },
       "hint": {
        "type": "string",
        "description": "How to fix the request."
       },
       "docs": {
        "type": "string",
        "format": "uri",
        "description": "Where the API is described."
       }
      }
     }
    }
   },
   "Item": {
    "type": "object",
    "description": "One live listing on ShopGoodwill or EBTH.",
    "required": [
     "uid",
     "source",
     "title",
     "url",
     "price",
     "endsAt"
    ],
    "properties": {
     "uid": {
      "type": "string",
      "description": "Stable id, \"sg:<id>\" for ShopGoodwill or \"ebth:<id>\" for EBTH. Use it with getLiveAuctionStatus.",
      "examples": [
       "sg:283557458"
      ]
     },
     "source": {
      "type": "string",
      "enum": [
       "ShopGoodwill",
       "EBTH"
      ]
     },
     "title": {
      "type": "string"
     },
     "url": {
      "type": "string",
      "format": "uri",
      "description": "The auction page. Bidding happens there."
     },
     "price": {
      "type": "number",
      "description": "Current bid in US dollars when the board was built."
     },
     "bids": {
      "type": "integer"
     },
     "buyNow": {
      "type": "number",
      "description": "Buy It Now price, 0 when there is none."
     },
     "endsAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the auction closes (UTC)."
     },
     "brand": {
      "type": "string",
      "description": "The watched maker this pair matched."
     },
     "brandOrigin": {
      "type": [
       "string",
       "null"
      ],
      "description": "Where the maker makes its frames."
     },
     "descOrigin": {
      "type": [
       "string",
       "null"
      ],
      "description": "Where the seller says the pair was made."
     },
     "images": {
      "type": "array",
      "items": {
       "type": "string",
       "format": "uri"
      }
     },
     "lens": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "none",
       "demo",
       "bifocal",
       "progressive",
       "reading",
       "rx",
       "maybe",
       null
      ],
      "description": "Lens notes; most lenses need replacing."
     },
     "size": {
      "type": [
       "object",
       "null"
      ],
      "description": "Frame size when known: eye, bridge and temple in millimeters."
     },
     "lot": {
      "type": [
       "object",
       "null"
      ],
      "description": "Set when the listing is a lot of several pairs."
     },
     "valuation": {
      "$ref": "#/components/schemas/Valuation"
     }
    },
    "additionalProperties": true
   },
   "Valuation": {
    "type": "object",
    "description": "Frame Spotter's estimates for one pair. Values are estimates, not appraisals.",
    "properties": {
     "estLow": {
      "type": "number",
      "description": "Low estimate of the resale value, in US dollars."
     },
     "estHigh": {
      "type": "number",
      "description": "High estimate of the resale value, in US dollars."
     },
     "buyAt": {
      "type": "number",
      "description": "Buy-under price: 75% of estLow, minus $50 when the lenses need replacing, rounded down to $5, never below $10."
     },
     "rarity": {
      "type": "integer",
      "minimum": 1,
      "maximum": 5,
      "description": "1 Common, 2 Uncommon, 3 Rare, 4 Very rare, 5 Grail."
     },
     "msrp": {
      "type": "number",
      "description": "Retail price when new, in US dollars."
     },
     "msrpType": {
      "type": "string",
      "enum": [
       "brand",
       "retailer",
       "dated",
       "estimate",
       "lot"
      ],
      "description": "Where the retail price comes from."
     },
     "msrpSource": {
      "type": [
       "string",
       "null"
      ],
      "format": "uri",
      "description": "Link to the page that shows the retail price (null for estimates)."
     },
     "notes": {
      "type": "string",
      "description": "Short notes on the maker, model and the estimate."
     }
    },
    "additionalProperties": true
   },
   "Brand": {
    "type": "object",
    "description": "An eyewear maker Frame Spotter watches.",
    "required": [
     "id",
     "name"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "region": {
      "type": "string"
     },
     "country": {
      "type": "string"
     },
     "city": {
      "type": "string"
     },
     "founded": {
      "type": "string"
     },
     "founder": {
      "type": "string"
     },
     "story": {
      "type": "string",
      "description": "A short history of the maker."
     },
     "known": {
      "type": "string",
      "description": "What the maker is known for."
     },
     "hunt": {
      "type": "string",
      "description": "What to hunt for when bidding."
     },
     "sources": {
      "type": "array",
      "items": {
       "type": "string",
       "format": "uri"
      }
     }
    },
    "additionalProperties": true
   },
   "BoardResponse": {
    "type": "object",
    "description": "The public board.",
    "required": [
     "lastRun",
     "builtAt",
     "items",
     "closed"
    ],
    "properties": {
     "lastRun": {
      "type": "string",
      "format": "date-time",
      "description": "When the auctions were last scanned."
     },
     "builtAt": {
      "type": "string",
      "format": "date-time",
      "description": "When this file was built."
     },
     "items": {
      "type": "array",
      "description": "Live listings anyone can see.",
      "items": {
       "$ref": "#/components/schemas/Item"
      }
     },
     "closed": {
      "type": "array",
      "description": "Recently closed pairs anyone can see.",
      "items": {
       "$ref": "#/components/schemas/Item"
      }
     },
     "tiers": {
      "type": "object",
      "description": "Numbers only: how many pairs the whole board holds, by access level.",
      "additionalProperties": true
     }
    },
    "additionalProperties": true
   },
   "BrandsResponse": {
    "type": "object",
    "description": "The watched makers.",
    "required": [
     "builtAt",
     "count",
     "brands"
    ],
    "properties": {
     "builtAt": {
      "type": "string",
      "format": "date-time"
     },
     "count": {
      "type": "integer",
      "description": "How many makers."
     },
     "brands": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Brand"
      }
     }
    },
    "additionalProperties": true
   },
   "LiveStatus": {
    "type": "object",
    "description": "Live status of one auction.",
    "required": [
     "price",
     "ended"
    ],
    "properties": {
     "price": {
      "type": "number",
      "description": "Current bid in US dollars."
     },
     "bids": {
      "type": [
       "integer",
       "null"
      ],
      "description": "Number of bids."
     },
     "buyNow": {
      "type": "number",
      "description": "ShopGoodwill Buy It Now price, 0 once used or when there is none."
     },
     "endsAt": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "When the auction closes (UTC)."
     },
     "ended": {
      "type": "boolean",
      "description": "True once the auction has closed."
     }
    },
    "additionalProperties": true
   },
   "LiveStatusMap": {
    "type": "object",
    "description": "Live status keyed by uid, for the uids that are on the public board.",
    "additionalProperties": {
     "$ref": "#/components/schemas/LiveStatus"
    }
   },
   "CountsResponse": {
    "type": "object",
    "description": "Counts for the whole board. Numbers only.",
    "required": [
     "builtAt",
     "counts"
    ],
    "properties": {
     "builtAt": {
      "type": "string",
      "format": "date-time"
     },
     "counts": {
      "type": "object",
      "description": "Live pairs counted by access level, rarity and brand.",
      "required": [
       "byLevel",
       "byRarity"
      ],
      "properties": {
       "byLevel": {
        "type": "object",
        "description": "Pairs by access level.",
        "required": [
         "free",
         "member",
         "premium"
        ],
        "properties": {
         "free": {
          "type": "integer"
         },
         "member": {
          "type": "integer"
         },
         "premium": {
          "type": "integer"
         }
        }
       },
       "byRarity": {
        "type": "object",
        "description": "Pairs by rarity (1 Common to 5 Grail).",
        "additionalProperties": {
         "type": "integer"
        }
       }
      },
      "additionalProperties": true
     }
    }
   },
   "MarkdownDocument": {
    "type": "string",
    "contentMediaType": "text/markdown",
    "description": "A Markdown document that starts with a top-level heading."
   }
  },
  "headers": {
   "ApiVersion": {
    "description": "The API major version that answered. Always 1 for v1.",
    "schema": {
     "type": "string",
     "const": "1"
    }
   },
   "RateLimitPolicy": {
    "description": "The limit as requests;w=seconds, for example 60;w=60.",
    "schema": {
     "type": "string",
     "examples": [
      "60;w=60"
     ]
    }
   },
   "RateLimitLimit": {
    "description": "Requests allowed per window per IP address.",
    "schema": {
     "type": "integer",
     "examples": [
      60
     ]
    }
   },
   "RetryAfter": {
    "description": "Seconds to wait before trying again.",
    "schema": {
     "type": "integer"
    }
   }
  }
 }
}
