{
  "openapi": "3.1.0",
  "info": { "title": "PrimeOEMParts public catalog API", "version": "1.0.0",
    "description": "Read-only catalog of genuine OEM parts offered by franchised dealers. GET only, no authentication. Prices are integer US cents. Availability is in_stock or out_of_stock (no quantities). Dealer identity is not included. TEST SITE: current data is fictional demo data (demo=true)." },
  "servers": [{ "url": "https://primeoemparts.com/api/v1" }],
  "paths": {
    "/parts/search": { "get": { "operationId": "searchParts", "summary": "Search by OEM part number or keyword",
      "parameters": [
        { "name": "q", "in": "query", "schema": { "type": "string", "maxLength": 40 }, "description": "OEM part number (dashes optional) or keywords" },
        { "name": "brand", "in": "query", "schema": { "type": "string" }, "description": "Brand name or slug, e.g. toyota" },
        { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 50, "default": 20 } } ],
      "responses": { "200": { "description": "Matching part numbers", "content": { "application/json": { "schema": { "type": "object", "required": ["query", "results"],
        "properties": { "query": { "type": "object" }, "results": { "type": "array", "items": { "$ref": "#/components/schemas/Part" } } } } } } },
        "400": { "$ref": "#/components/responses/Error" }, "429": { "description": "Rate limited" } } } },
    "/parts/{brand}/{partNumber}": { "get": { "operationId": "getPart", "summary": "One OEM part number with every public offer",
      "parameters": [ { "name": "brand", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "partNumber", "in": "path", "required": true, "schema": { "type": "string" } } ],
      "responses": { "200": { "description": "The part", "content": { "application/json": { "schema": { "type": "object", "required": ["part"], "properties": { "part": { "$ref": "#/components/schemas/PartWithOffers" } } } } } },
        "404": { "$ref": "#/components/responses/Error" } } } },
    "/brands": { "get": { "operationId": "listBrands", "summary": "Brands with public offers",
      "responses": { "200": { "description": "Brands", "content": { "application/json": { "schema": { "type": "object", "properties": { "brands": { "type": "array", "items": { "type": "object",
        "properties": { "brand": { "type": "string" }, "slug": { "type": "string" }, "part_count": { "type": "integer" }, "url": { "type": "string", "format": "uri" } } } } } } } } } } } }
  },
  "components": {
    "schemas": {
      "Part": { "type": "object", "required": ["part_number", "brand", "description", "availability", "currency", "low_price_cents", "high_price_cents", "offer_count", "demo", "url"],
        "properties": {
          "part_number": { "type": "string", "description": "OEM part number" },
          "brand": { "type": "string" }, "description": { "type": "string" },
          "availability": { "type": "string", "enum": ["in_stock", "out_of_stock"] },
          "currency": { "type": "string", "const": "USD" },
          "low_price_cents": { "type": "integer" }, "high_price_cents": { "type": "integer" },
          "offer_count": { "type": "integer" },
          "demo": { "type": "boolean", "description": "true when every offer comes from a fictional demo dealer" },
          "url": { "type": "string", "format": "uri", "description": "Canonical part page" } } },
      "PartWithOffers": { "allOf": [ { "$ref": "#/components/schemas/Part" }, { "type": "object", "required": ["offers"], "properties": { "offers": { "type": "array", "items": { "type": "object",
        "properties": { "price_cents": { "type": "integer" }, "availability": { "type": "string", "enum": ["in_stock", "out_of_stock"] }, "ships": { "type": "boolean", "description": "false = dealer-quoted freight (oversize)" } } } } } } ] }
    },
    "responses": { "Error": { "description": "Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } } } } } } }
  }
}
