{
  "openapi": "3.1.0",
  "info": {
    "title": "GradeHunter Public API",
    "version": "1.0.0",
    "description": "Read-only access to GradeHunter Pokémon card grading analytics: raw and graded values, estimated grading cost, estimated profit, estimated ROI, market trends, data confidence and the GradeHunter Score. Values are reported in AUD, converted from USD source data with the fx_usd_to_aud rate included in every response, and every response carries a generated_at response timestamp distinct from per-card price_snapshot_at and signal_calculated_at. Profit assumes a flat US$75 all-in grading cost and a 13.25% marketplace selling fee — the same assumptions the website shows — and is an estimate of an uncertain outcome, never a guaranteed return.",
    "termsOfService": "https://gradehunter.com/terms",
    "contact": {
      "name": "GradeHunter",
      "url": "https://gradehunter.com/developers"
    },
    "license": {
      "name": "GradeHunter attribution licence",
      "url": "https://gradehunter.com/developers"
    }
  },
  "servers": [
    {
      "url": "https://mhuoryltvvgzemskybmg.supabase.co/functions/v1/gh-api",
      "description": "Production read-only API"
    }
  ],
  "externalDocs": {
    "description": "Methodology",
    "url": "https://gradehunter.com/methodology"
  },
  "paths": {
    "/v1/opportunities": {
      "get": {
        "operationId": "listOpportunities",
        "summary": "Search recorded grading opportunities",
        "tags": [
          "Opportunities"
        ],
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "description": "Free-text search across card and set names.",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "pokemon",
            "in": "query",
            "description": "Filter by Pokémon / card name.",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "set",
            "in": "query",
            "description": "Filter by set name.",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "min_raw_price_aud",
            "in": "query",
            "description": "Minimum raw market value (AUD).",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            }
          },
          {
            "name": "max_raw_price_aud",
            "in": "query",
            "description": "Maximum raw market value (AUD).",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            }
          },
          {
            "name": "min_roi_percent",
            "in": "query",
            "description": "Minimum estimated PSA 10 ROI %.",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "min_profit_aud",
            "in": "query",
            "description": "Minimum estimated PSA 10 profit (AUD).",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "min_gradehunter_score",
            "in": "query",
            "description": "Minimum GradeHunter Score (0-100).",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            }
          },
          {
            "name": "trend_window",
            "in": "query",
            "description": "Momentum window used for sorting/reporting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d"
              ]
            }
          },
          {
            "name": "minimum_sales",
            "in": "query",
            "description": "Minimum observed graded sales activity.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Sort field.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "gradehunter_score",
                "roi",
                "estimated_profit",
                "momentum",
                "raw_price",
                "updated_at"
              ]
            }
          },
          {
            "name": "order",
            "in": "query",
            "description": "Sort direction.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Results per page (max 20).",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque pagination cursor from a previous response.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked grading opportunities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Response creation time, NOT price freshness."
                    },
                    "as_of": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Legacy alias for generated_at, not price freshness."
                    },
                    "as_of_local": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "example": "AUD"
                    },
                    "source_currency": {
                      "type": "string",
                      "example": "USD"
                    },
                    "fx_usd_to_aud": {
                      "type": "number"
                    },
                    "methodology_version": {
                      "type": "string"
                    },
                    "filters": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "data_quality": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "confidence": {
                          "type": "string",
                          "description": "Unverified model signal, not a verified sample-size or freshness guarantee."
                        },
                        "cards_considered": {
                          "type": "integer"
                        }
                      }
                    },
                    "assumptions": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "methodology_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Card"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "integer"
                        },
                        "next_cursor": {
                          "type": "string",
                          "nullable": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/cards/search": {
      "get": {
        "operationId": "searchCards",
        "summary": "Search cards (alias of /v1/opportunities)",
        "tags": [
          "Cards"
        ],
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "description": "Free-text search across card and set names.",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "pokemon",
            "in": "query",
            "description": "Filter by Pokémon / card name.",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "set",
            "in": "query",
            "description": "Filter by set name.",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "min_raw_price_aud",
            "in": "query",
            "description": "Minimum raw market value (AUD).",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            }
          },
          {
            "name": "max_raw_price_aud",
            "in": "query",
            "description": "Maximum raw market value (AUD).",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            }
          },
          {
            "name": "min_roi_percent",
            "in": "query",
            "description": "Minimum estimated PSA 10 ROI %.",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "min_profit_aud",
            "in": "query",
            "description": "Minimum estimated PSA 10 profit (AUD).",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "min_gradehunter_score",
            "in": "query",
            "description": "Minimum GradeHunter Score (0-100).",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            }
          },
          {
            "name": "trend_window",
            "in": "query",
            "description": "Momentum window used for sorting/reporting.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d"
              ]
            }
          },
          {
            "name": "minimum_sales",
            "in": "query",
            "description": "Minimum observed graded sales activity.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Sort field.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "gradehunter_score",
                "roi",
                "estimated_profit",
                "momentum",
                "raw_price",
                "updated_at"
              ]
            }
          },
          {
            "name": "order",
            "in": "query",
            "description": "Sort direction.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Results per page (max 20).",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque pagination cursor from a previous response.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching cards",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Response creation time, NOT price freshness."
                    },
                    "as_of": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Legacy alias for generated_at, not price freshness."
                    },
                    "as_of_local": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "example": "AUD"
                    },
                    "source_currency": {
                      "type": "string",
                      "example": "USD"
                    },
                    "fx_usd_to_aud": {
                      "type": "number"
                    },
                    "methodology_version": {
                      "type": "string"
                    },
                    "filters": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "data_quality": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "confidence": {
                          "type": "string",
                          "description": "Unverified model signal, not a verified sample-size or freshness guarantee."
                        },
                        "cards_considered": {
                          "type": "integer"
                        }
                      }
                    },
                    "assumptions": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "methodology_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Card"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "integer"
                        },
                        "next_cursor": {
                          "type": "string",
                          "nullable": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/cards/{cardIdOrSlug}": {
      "get": {
        "operationId": "getCard",
        "summary": "Get a single card analysis",
        "description": "Resolves a GradeHunter card id, slug or specific search term. Ambiguous input returns `ambiguous: true` with up to five options instead of guessing.",
        "tags": [
          "Cards"
        ],
        "parameters": [
          {
            "name": "cardIdOrSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Card analysis, or ambiguity options",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Response creation time, NOT price freshness."
                    },
                    "as_of": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Legacy alias for generated_at, not price freshness."
                    },
                    "as_of_local": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "example": "AUD"
                    },
                    "source_currency": {
                      "type": "string",
                      "example": "USD"
                    },
                    "fx_usd_to_aud": {
                      "type": "number"
                    },
                    "methodology_version": {
                      "type": "string"
                    },
                    "filters": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "data_quality": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "confidence": {
                          "type": "string",
                          "description": "Unverified model signal, not a verified sample-size or freshness guarantee."
                        },
                        "cards_considered": {
                          "type": "integer"
                        }
                      }
                    },
                    "assumptions": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "methodology_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "card": {
                      "$ref": "#/components/schemas/Card"
                    },
                    "ambiguous": {
                      "type": "boolean"
                    },
                    "options": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Card"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/cards/compare": {
      "post": {
        "operationId": "compareCards",
        "summary": "Compare up to 10 cards",
        "tags": [
          "Cards"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "cards"
                ],
                "properties": {
                  "cards": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 2,
                    "maxItems": 10,
                    "description": "Card ids or slugs."
                  },
                  "focus": {
                    "type": "string",
                    "description": "Optional comparison focus, e.g. roi, profit, momentum, score."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Comparison results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Response creation time, NOT price freshness."
                    },
                    "as_of": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Legacy alias for generated_at, not price freshness."
                    },
                    "as_of_local": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "example": "AUD"
                    },
                    "source_currency": {
                      "type": "string",
                      "example": "USD"
                    },
                    "fx_usd_to_aud": {
                      "type": "number"
                    },
                    "methodology_version": {
                      "type": "string"
                    },
                    "filters": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "data_quality": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "confidence": {
                          "type": "string",
                          "description": "Unverified model signal, not a verified sample-size or freshness guarantee."
                        },
                        "cards_considered": {
                          "type": "integer"
                        }
                      }
                    },
                    "assumptions": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "methodology_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Card"
                      }
                    },
                    "unresolved": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sets": {
      "get": {
        "operationId": "listSets",
        "summary": "List sets covered by GradeHunter",
        "tags": [
          "Sets"
        ],
        "responses": {
          "200": {
            "description": "Sets with card counts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Response creation time, NOT price freshness."
                    },
                    "as_of": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Legacy alias for generated_at, not price freshness."
                    },
                    "as_of_local": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "example": "AUD"
                    },
                    "source_currency": {
                      "type": "string",
                      "example": "USD"
                    },
                    "fx_usd_to_aud": {
                      "type": "number"
                    },
                    "methodology_version": {
                      "type": "string"
                    },
                    "filters": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "data_quality": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "confidence": {
                          "type": "string",
                          "description": "Unverified model signal, not a verified sample-size or freshness guarantee."
                        },
                        "cards_considered": {
                          "type": "integer"
                        }
                      }
                    },
                    "assumptions": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "methodology_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Card"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "integer"
                        },
                        "next_cursor": {
                          "type": "string",
                          "nullable": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sets/{setSlug}": {
      "get": {
        "operationId": "getSet",
        "summary": "Get a set and its top opportunities",
        "tags": [
          "Sets"
        ],
        "parameters": [
          {
            "name": "setSlug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Results (max 20).",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Set detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Response creation time, NOT price freshness."
                    },
                    "as_of": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Legacy alias for generated_at, not price freshness."
                    },
                    "as_of_local": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "example": "AUD"
                    },
                    "source_currency": {
                      "type": "string",
                      "example": "USD"
                    },
                    "fx_usd_to_aud": {
                      "type": "number"
                    },
                    "methodology_version": {
                      "type": "string"
                    },
                    "filters": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "data_quality": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "confidence": {
                          "type": "string",
                          "description": "Unverified model signal, not a verified sample-size or freshness guarantee."
                        },
                        "cards_considered": {
                          "type": "integer"
                        }
                      }
                    },
                    "assumptions": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "methodology_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Card"
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "integer"
                        },
                        "next_cursor": {
                          "type": "string",
                          "nullable": true
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/market-summary": {
      "get": {
        "operationId": "getMarketSummary",
        "summary": "Current market summary",
        "tags": [
          "Market"
        ],
        "parameters": [
          {
            "name": "set",
            "in": "query",
            "description": "Restrict to a set.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pokemon",
            "in": "query",
            "description": "Restrict to a Pokémon.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_raw_price_aud",
            "in": "query",
            "description": "Minimum raw value (AUD).",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            }
          },
          {
            "name": "max_raw_price_aud",
            "in": "query",
            "description": "Maximum raw value (AUD).",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 0
            }
          },
          {
            "name": "trend_window",
            "in": "query",
            "description": "Momentum window.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "7d",
                "30d"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Aggregate market view",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Response creation time, NOT price freshness."
                    },
                    "as_of": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Legacy alias for generated_at, not price freshness."
                    },
                    "as_of_local": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "example": "AUD"
                    },
                    "source_currency": {
                      "type": "string",
                      "example": "USD"
                    },
                    "fx_usd_to_aud": {
                      "type": "number"
                    },
                    "methodology_version": {
                      "type": "string"
                    },
                    "filters": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "data_quality": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "confidence": {
                          "type": "string",
                          "description": "Unverified model signal, not a verified sample-size or freshness guarantee."
                        },
                        "cards_considered": {
                          "type": "integer"
                        }
                      }
                    },
                    "assumptions": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "methodology_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "summary": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/methodology": {
      "get": {
        "operationId": "getMethodology",
        "summary": "Explain GradeHunter calculations",
        "tags": [
          "Methodology"
        ],
        "parameters": [
          {
            "name": "section",
            "in": "query",
            "description": "Optional single section id.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Methodology sections",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Response creation time, NOT price freshness."
                    },
                    "as_of": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Legacy alias for generated_at, not price freshness."
                    },
                    "as_of_local": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string",
                      "example": "AUD"
                    },
                    "source_currency": {
                      "type": "string",
                      "example": "USD"
                    },
                    "fx_usd_to_aud": {
                      "type": "number"
                    },
                    "methodology_version": {
                      "type": "string"
                    },
                    "filters": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "data_quality": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "confidence": {
                          "type": "string",
                          "description": "Unverified model signal, not a verified sample-size or freshness guarantee."
                        },
                        "cards_considered": {
                          "type": "integer"
                        }
                      }
                    },
                    "assumptions": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "methodology_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "disclaimer": {
                      "type": "string"
                    },
                    "sections": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Card": {
        "type": "object",
        "description": "Public GradeHunter card analysis. Fields absent from the dataset are omitted rather than nulled.",
        "properties": {
          "card_id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "pokemon": {
            "type": "string"
          },
          "set": {
            "type": "string"
          },
          "set_slug": {
            "type": "string"
          },
          "card_number": {
            "type": "string"
          },
          "era": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "format": "uri"
          },
          "raw_price_aud": {
            "type": "number"
          },
          "psa9_price_aud": {
            "type": "number"
          },
          "psa10_price_aud": {
            "type": "number"
          },
          "estimated_grading_cost_aud": {
            "type": "number"
          },
          "estimated_total_cost_aud": {
            "type": "number"
          },
          "estimated_profit_psa9_aud": {
            "type": "number"
          },
          "estimated_profit_aud": {
            "type": "number"
          },
          "estimated_roi_psa9_percent": {
            "type": "number"
          },
          "estimated_roi_percent": {
            "type": "number"
          },
          "gradehunter_score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "gradehunter_score_tier": {
            "type": "string",
            "enum": [
              "elite",
              "strong",
              "moderate",
              "weak"
            ]
          },
          "score_factors": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "trend_7d_percent": {
            "type": "number"
          },
          "trend_30d_percent": {
            "type": "number"
          },
          "trend_status": {
            "type": "string"
          },
          "sales_activity": {
            "type": "integer"
          },
          "confidence": {
            "type": "string",
            "description": "Unverified model signal, not a verified sample-size or freshness guarantee."
          },
          "price_snapshot_at": {
            "type": "string",
            "format": "date-time",
            "description": "Recorded price date; missing means unknown."
          },
          "signal_calculated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Model calculation time, not a price refresh."
          },
          "identity_updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Legacy recorded-price-or-identity fallback. Use price_snapshot_at for prices."
          },
          "updated_at_local": {
            "type": "string"
          },
          "canonical_url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "card_id",
          "slug",
          "name",
          "set",
          "updated_at",
          "canonical_url"
        ]
      },
      "Error": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "enum": [
              "bad_request",
              "not_found",
              "rate_limited",
              "internal_error"
            ]
          },
          "message": {
            "type": "string"
          },
          "retry_after_seconds": {
            "type": "integer"
          },
          "documentation_url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "success",
          "error",
          "message"
        ]
      }
    }
  },
  "x-disclaimer": "Market values and estimated grading returns are informational only, derived from third-party sales data, and are not guaranteed. Grading outcomes are uncertain."
}