{
  "openapi": "3.1.0",
  "info": {
    "title": "WaxTrack Vinyl Valuation & Deadwax OCR API",
    "version": "1.0.0",
    "description": "Programmatic API for AI agents and crate diggers to identify vinyl record pressings and query real-time Discogs market valuations."
  },
  "servers": [
    {
      "url": "https://api.getwaxtrack.app/v1"
    }
  ],
  "paths": {
    "/valuation": {
      "get": {
        "summary": "Query vinyl valuation by matrix runout code or Discogs release ID",
        "operationId": "queryVinylValuation",
        "parameters": [
          {
            "name": "matrix",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "SHVL 804 A-2"
            },
            "description": "Alphanumeric matrix runout code etched into deadwax"
          },
          {
            "name": "condition",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["M", "NM", "VG+", "VG", "G+", "G", "F", "P"],
              "default": "NM"
            },
            "description": "Goldmine condition grading"
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "USD"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Valuation and pressing metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "artist": { "type": "string" },
                    "album": { "type": "string" },
                    "year": { "type": "integer" },
                    "pressing": { "type": "string" },
                    "matrix_code": { "type": "string" },
                    "condition": { "type": "string" },
                    "multiplier": { "type": "number" },
                    "estimated_value": { "type": "number" },
                    "discogs_median": { "type": "number" },
                    "historical_high": { "type": "number" },
                    "is_holy_grail": { "type": "boolean" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/ocr/deadwax": {
      "post": {
        "summary": "Perform optical character recognition on vinyl deadwax image",
        "operationId": "ocrDeadwax",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "image": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Extracted matrix codes and candidate pressings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "extracted_codes": {
                      "type": "array",
                      "items": { "type": "string" }
                    },
                    "matched_release_id": { "type": "integer" },
                    "confidence": { "type": "number" }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
