{
  "openapi": "3.0.3",
  "info": {
    "title": "Card Library API",
    "version": "1.0.0",
    "description": "Public read-only catalog API. No API key required. Imported checklist coverage only; images may be missing and editions unresolved. GET, HEAD and OPTIONS supported. GET responses support ETag conditional requests (304). No write endpoints."
  },
  "servers": [
    {
      "url": "https://cardlibrary.dev"
    }
  ],
  "paths": {
    "/api/v1": {
      "get": {
        "operationId": "getCatalog",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Catalog changed; restart pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Catalog unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/collections": {
      "get": {
        "operationId": "listCollections",
        "parameters": [
          {
            "name": "manufacturer",
            "description": "Exact name, case-insensitive.",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "season",
            "description": "Exact season, e.g. 2025-26.",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "description": "Page size, 1\u2013100.",
            "required": false,
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "description": "Opaque nextCursor from the previous response; keep other filters unchanged.",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Catalog changed; restart pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Catalog unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/collections/{collectionId}": {
      "get": {
        "operationId": "getCollection",
        "parameters": [
          {
            "name": "collectionId",
            "description": "",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CollectionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Catalog changed; restart pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Catalog unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/collections/{collectionId}/subsets": {
      "get": {
        "operationId": "listSubsets",
        "parameters": [
          {
            "name": "collectionId",
            "description": "",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "description": "Page size, 1\u2013100.",
            "required": false,
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "description": "Opaque nextCursor from the previous response; keep other filters unchanged.",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubsetList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Catalog changed; restart pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Catalog unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cards": {
      "get": {
        "operationId": "listCards",
        "parameters": [
          {
            "name": "collection",
            "description": "Required collection ID.",
            "required": true,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "description": "Case-insensitive, accent-insensitive token search over player, team, number and subset.",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "subset",
            "description": "Exact value, case- and accent-insensitive.",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "description": "Exact value, case- and accent-insensitive.",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "player",
            "description": "Exact value, case- and accent-insensitive.",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "team",
            "description": "Exact value, case- and accent-insensitive.",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hasImage",
            "description": "",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "any",
                "front",
                "back",
                "both",
                "none"
              ]
            }
          },
          {
            "name": "limit",
            "description": "Page size, 1\u2013100.",
            "required": false,
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "description": "Opaque nextCursor from the previous response; keep other filters unchanged.",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CardList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Catalog changed; restart pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Catalog unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cards/{cardId}": {
      "get": {
        "operationId": "getCard",
        "parameters": [
          {
            "name": "cardId",
            "description": "",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CardResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown resource",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Catalog changed; restart pagination",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Catalog unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Image": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "source": {
            "type": "string",
            "format": "uri"
          },
          "originalUrl": {
            "type": "string",
            "format": "uri"
          },
          "type": {
            "type": "string"
          },
          "matchBasis": {
            "type": "string"
          }
        }
      },
      "Card": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "collectionId": {
            "type": "string"
          },
          "collectionName": {
            "type": "string"
          },
          "number": {
            "type": "string"
          },
          "player": {
            "type": "string"
          },
          "team": {
            "type": "string"
          },
          "rookie": {
            "type": "boolean",
            "nullable": true
          },
          "subset": {
            "type": "string"
          },
          "identityStatus": {
            "type": "string"
          },
          "identityNote": {
            "type": "string",
            "nullable": true
          },
          "images": {
            "type": "object",
            "properties": {
              "front": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Image"
                  }
                ],
                "nullable": true
              },
              "back": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Image"
                  }
                ],
                "nullable": true
              }
            }
          },
          "provenance": {
            "type": "object"
          },
          "links": {
            "type": "object",
            "properties": {
              "self": {
                "type": "string"
              }
            }
          }
        }
      },
      "Collection": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "manufacturer": {
            "type": "string"
          },
          "season": {
            "type": "string"
          },
          "releaseDate": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "licensed": {
            "type": "boolean"
          },
          "entries": {
            "type": "integer"
          },
          "images": {
            "type": "object",
            "properties": {
              "fronts": {
                "type": "integer"
              },
              "backs": {
                "type": "integer"
              }
            }
          },
          "checklistUrl": {
            "type": "string"
          },
          "releaseSource": {
            "type": "string"
          },
          "scopeNote": {
            "type": "string"
          },
          "links": {
            "type": "object"
          }
        }
      },
      "Subset": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "entries": {
            "type": "integer"
          },
          "fronts": {
            "type": "integer"
          },
          "backs": {
            "type": "integer"
          },
          "both": {
            "type": "integer"
          },
          "unresolvedEditions": {
            "type": "integer"
          }
        }
      },
      "Meta": {
        "type": "object",
        "properties": {
          "apiVersion": {
            "type": "string"
          },
          "snapshot": {
            "type": "string"
          },
          "catalogUpdatedAt": {
            "type": "string"
          }
        }
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          },
          "next": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "CardList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Card"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "CardResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Card"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "CollectionList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Collection"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "CollectionResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Collection"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "SubsetList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Subset"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "SubsetResponse": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Subset"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      }
    }
  }
}