{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/valotcg/json-schema/valotcg-page-scan-result-schema.json",
  "title": "PageScanResult",
  "x-generated": "2026-12-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/valotcg-scans-api-openapi.yml#/components/schemas/PageScanResult",
  "properties": {
    "cards": {
      "items": {
        "$ref": "#/$defs/PageCard"
      },
      "type": "array",
      "title": "Cards",
      "description": "Every card detected on the photo, in reading order."
    },
    "summary": {
      "$ref": "#/$defs/PageScanSummary"
    },
    "model_version": {
      "type": "string",
      "title": "Model Version",
      "description": "Version of the recognition service, for support and reproducibility."
    },
    "catalog_date": {
      "type": "string",
      "format": "date",
      "title": "Catalog Date",
      "description": "Date of the catalogue the photo was compared against."
    },
    "latency_ms": {
      "type": "integer",
      "title": "Latency Ms",
      "description": "Server processing time of the whole photo."
    }
  },
  "type": "object",
  "required": [
    "cards",
    "summary",
    "model_version",
    "catalog_date",
    "latency_ms"
  ],
  "$defs": {
    "CardSummary": {
      "properties": {
        "card_id": {
          "type": "integer",
          "title": "Card Id",
          "description": "Stable Valo.Data card id."
        },
        "game": {
          "type": "string",
          "title": "Game",
          "description": "Game slug, e.g. `pokemon`, `onepiece`, `star_wars_unlimited`."
        },
        "name": {
          "type": "string",
          "title": "Name",
          "description": "Printed name in the card language."
        },
        "name_en": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Name En",
          "description": "English name when known; `name` on an English card."
        },
        "number": {
          "type": "string",
          "title": "Number",
          "description": "Collector number as printed, e.g. `001/102`, `OP01-012`."
        },
        "rarity": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Rarity",
          "description": "Rarity label as printed on the card or as given by the source, in the card language, e.g. `Illustration spéciale rare`, `SuperRare`."
        },
        "rarity_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Rarity Code",
          "description": "Canonical rarity code, shared by every language of one rarity system, e.g. `special_illustration_rare`. Japanese and Chinese Pokémon prints follow their own system (`sar`, `ur`). `null` when the rarity is unknown. Codes of a game: `GET /data/v1/games/{game}/rarities`."
        },
        "language": {
          "type": "string",
          "enum": [
            "fr",
            "en",
            "ja",
            "zh",
            "de",
            "es",
            "it",
            "pt"
          ],
          "title": "Language",
          "description": "Language of the printed card."
        },
        "edition": {
          "$ref": "#/$defs/EditionRef"
        },
        "image_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Image Url"
        },
        "variants": {
          "items": {
            "type": "string",
            "enum": [
              "default",
              "foil",
              "first_edition",
              "reverse",
              "pokeball",
              "masterball"
            ]
          },
          "type": "array",
          "title": "Variants",
          "description": "Price variants tracked for this card, each with its own quotes: `default` (main printing); `foil` for games pricing foils separately (Magic, Lorcana, Riftbound, Dragon Ball Super...); for Pokémon, `first_edition` (1st Edition of a card also printed unlimited), `reverse` (reverse holo), `pokeball` and `masterball` (reverse Poké Ball and Master Ball patterns) on cards printed in them. Only the variants the card exists in are listed; a card printed only in 1st Edition lists `default`, which is that print."
        },
        "cardmarket_product_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cardmarket Product Id",
          "description": "Cardmarket idProduct; `null` on Sandbox and Starter."
        },
        "tcgplayer_product_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "US market product id",
          "description": "US market product id; `null` on Sandbox and Starter."
        }
      },
      "type": "object",
      "required": [
        "card_id",
        "game",
        "name",
        "number",
        "language",
        "edition",
        "variants"
      ],
      "title": "CardSummary"
    },
    "EditionRef": {
      "properties": {
        "id": {
          "type": "integer",
          "title": "Id",
          "description": "Edition id, usable as `edition_id` filter."
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Code",
          "description": "Publisher set code, e.g. `SV06`, `OP-01`."
        },
        "release_date": {
          "anyOf": [
            {
              "type": "string",
              "format": "date"
            },
            {
              "type": "null"
            }
          ],
          "title": "Release Date"
        }
      },
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "title": "EditionRef"
    },
    "PageCard": {
      "properties": {
        "index": {
          "type": "integer",
          "title": "Index",
          "description": "Reading order on the photo, row by row from the top left, starting at 1."
        },
        "status": {
          "type": "string",
          "enum": [
            "matched",
            "ambiguous",
            "no_match",
            "rejected"
          ],
          "title": "Status",
          "description": "As for a single scan, plus `rejected`: the card is detected but its framing cannot be read (see `rejection_reason`); it has no candidate and costs nothing. `no_match` costs nothing either."
        },
        "rejection_reason": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "cut_off",
                "too_small",
                "bad_framing"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Rejection Reason",
          "description": "Only when `rejected`. `cut_off`: the card runs past the photo edge. `too_small`: the card takes too little of the photo. `bad_framing`: the box is not card-shaped (strong tilt or perspective)."
        },
        "finish_confidence": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "high",
                "low"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Finish Confidence",
          "description": "As for a single scan."
        },
        "detection": {
          "$ref": "#/$defs/ScanDetection",
          "description": "Where this card is on the photo."
        },
        "candidates": {
          "items": {
            "$ref": "#/$defs/ScanCandidate"
          },
          "type": "array",
          "title": "Candidates",
          "description": "Up to 5 candidates, best first."
        }
      },
      "type": "object",
      "required": [
        "index",
        "status",
        "rejection_reason",
        "finish_confidence",
        "detection",
        "candidates"
      ],
      "title": "PageCard"
    },
    "PageScanSummary": {
      "properties": {
        "cards": {
          "type": "integer",
          "title": "Cards",
          "description": "Cards detected on the photo, rejected ones included."
        },
        "matched": {
          "type": "integer",
          "title": "Matched"
        },
        "ambiguous": {
          "type": "integer",
          "title": "Ambiguous"
        },
        "no_match": {
          "type": "integer",
          "title": "No Match"
        },
        "rejected": {
          "type": "integer",
          "title": "Rejected"
        },
        "scans_billed": {
          "type": "integer",
          "title": "Scans Billed",
          "description": "Scans this call cost: one per `matched` or `ambiguous` card, at least one per analysed photo."
        }
      },
      "type": "object",
      "required": [
        "cards",
        "matched",
        "ambiguous",
        "no_match",
        "rejected",
        "scans_billed"
      ],
      "title": "PageScanSummary"
    },
    "ScanBox": {
      "properties": {
        "x": {
          "type": "number",
          "title": "X",
          "description": "Left edge, as a fraction of the photo width (photo turned upright)."
        },
        "y": {
          "type": "number",
          "title": "Y",
          "description": "Top edge, as a fraction of the photo height."
        },
        "width": {
          "type": "number",
          "title": "Width",
          "description": "Box width, as a fraction of the photo width."
        },
        "height": {
          "type": "number",
          "title": "Height",
          "description": "Box height, as a fraction of the photo height."
        }
      },
      "type": "object",
      "required": [
        "x",
        "y",
        "width",
        "height"
      ],
      "title": "ScanBox"
    },
    "ScanCandidate": {
      "properties": {
        "rank": {
          "type": "integer",
          "title": "Rank",
          "description": "1 for the best candidate."
        },
        "score": {
          "type": "number",
          "title": "Score",
          "description": "Visual similarity between the photo and the catalogue card. It is not a probability: compare candidates of one scan, do not read it as a percentage."
        },
        "card": {
          "$ref": "#/$defs/CardSummary",
          "description": "The Valo.Data card. `cardmarket_product_id` and `tcgplayer_product_id` are filled on the Growth and Scale plans only; prices come from `GET /data/v1/cards/{card_id}/prices`."
        },
        "same_artwork_card_ids": {
          "items": {
            "type": "integer"
          },
          "type": "array",
          "title": "Same Artwork Card Ids",
          "description": "Other cards of the same language printed with this artwork (reprints, promos). A photo cannot tell them apart; check the set symbol and number."
        }
      },
      "type": "object",
      "required": [
        "rank",
        "score",
        "card",
        "same_artwork_card_ids"
      ],
      "title": "ScanCandidate"
    },
    "ScanDetection": {
      "properties": {
        "confidence": {
          "type": "number",
          "title": "Confidence",
          "description": "Confidence that the box holds a card (0 to 1)."
        },
        "box": {
          "$ref": "#/$defs/ScanBox"
        }
      },
      "type": "object",
      "required": [
        "confidence",
        "box"
      ],
      "title": "ScanDetection"
    }
  }
}