{
  "openapi": "3.0.1",
  "info": {
    "title": "PCGS Population Report Scraper — Coin Pops, Grades & Totals",
    "description": "Scrape PCGS coin population reports by series URL, category, or name search — one row per coin with PCGS #, designation, per-grade pops incl. plus grades, and certified totals. No login or API key needed; optional CoinFacts enrichment with your own token. From $4 per 1,000 coins.",
    "version": "0.1",
    "x-build-id": "6H100Nl7xMvwoviEt"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapersdelight~pcgs-pop-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapersdelight-pcgs-pop-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/scrapersdelight~pcgs-pop-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapersdelight-pcgs-pop-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/scrapersdelight~pcgs-pop-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapersdelight-pcgs-pop-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "popUrls": {
            "title": "Pop Report URLs",
            "type": "array",
            "description": "What to scrape: series detail URLs (https://www.pcgs.com/pop/detail/{slug}/{id}), whole-category URLs (https://www.pcgs.com/pop/uscoins, /pop/canadiancoins, …), or https://www.pcgs.com/pop for every category. One row per coin line is output.",
            "items": {
              "type": "string"
            }
          },
          "searchTerm": {
            "title": "Series search",
            "type": "string",
            "description": "Optional free-text series-name search, e.g. 'morgan dollar', 'lincoln cent', 'saint-gaudens'. Crawls the Pop Report index and scrapes every series whose name matches. Combine with, or use instead of, Pop Report URLs."
          },
          "gradeTab": {
            "title": "Grade band (tab)",
            "enum": [
              "1",
              "2",
              "3",
              "4",
              "5"
            ],
            "type": "string",
            "description": "Which Pop Report tab to scrape. '3' (MS/PR 60-70) is the site default; '4' Summary gives the compact P/AG-MS/PR + Total view; '5' Comprehensive returns every grade column.",
            "default": "3"
          },
          "maxRecords": {
            "title": "Max coin rows per run",
            "minimum": 0,
            "type": "integer",
            "description": "Hard cap on coin rows scraped this run (cost/safety guard). 0 = unlimited. Prefilled to 100 for a fast first run.",
            "default": 100
          },
          "pcgsApiToken": {
            "title": "PCGS Public API token (optional, BYOK)",
            "type": "string",
            "description": "Optional: your own free token from pcgs.com/publicapi. When set, each coin row is enriched with official CoinFacts data (GetCoinFactsByGrade) under 'coin_facts'. Never required — the Pop Report itself needs no key."
          },
          "apiGradeNo": {
            "title": "CoinFacts grade number",
            "minimum": 1,
            "maximum": 70,
            "type": "integer",
            "description": "Grade used for the optional CoinFacts enrichment call (e.g. 65 = MS/PR65). Only used when a PCGS API token is set.",
            "default": 65
          },
          "apiPlusGrade": {
            "title": "CoinFacts plus grade",
            "type": "boolean",
            "description": "Ask the CoinFacts enrichment for the plus-grade variant (e.g. MS65+). Only used when a PCGS API token is set.",
            "default": false
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Proxy settings. Automatic datacenter rotation is usually enough; switch to RESIDENTIAL if Cloudflare challenges persist at high volume. With the Apify proxy selected, the run starts on its own direct connection and moves to the proxy the first time PCGS refuses a page; your own proxy URLs are always used as given.",
            "default": {
              "useApifyProxy": true
            }
          },
          "requestDelayMs": {
            "title": "Delay between requests (ms)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Polite spacing between page fetches. Keep at/above ~800 ms to stay under Cloudflare's radar on long runs.",
            "default": 800
          },
          "diagnose": {
            "title": "Diagnostic mode (dev)",
            "type": "boolean",
            "description": "Dev only. Dumps raw landing + detail HTML to the key-value store and logs the parsed first row, then exits.",
            "default": false
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}