{
  "openapi": "3.0.1",
  "info": {
    "title": "Yellow Pages CA Scraper — Canadian Business Leads",
    "description": "Scrape Canadian business listings from YellowPages.ca. Extract names, phones, emails, addresses, websites, ratings, reviews, hours, social links, and coordinates. Search by keyword+location or paste direct URLs.",
    "version": "1.0",
    "x-build-id": "EnDQsZq2PoVGqmdnx"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/muhammadafzal~yellow-pages-ca-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-muhammadafzal-yellow-pages-ca-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/muhammadafzal~yellow-pages-ca-scraper/runs": {
      "post": {
        "operationId": "runs-sync-muhammadafzal-yellow-pages-ca-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/muhammadafzal~yellow-pages-ca-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-muhammadafzal-yellow-pages-ca-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": {
          "searchTerms": {
            "title": "Search Terms",
            "type": "array",
            "description": "Keywords or business categories to search for on YellowPages.ca (e.g. plumber, dentist, restaurant). Each term is cross-joined with every location — 2 terms x 3 locations = 6 searches. Use this when the user wants to find businesses by type or keyword. Do NOT use this field when the user provides specific YellowPages.ca URLs — use startUrls instead.",
            "items": {
              "type": "string"
            }
          },
          "locations": {
            "title": "Locations",
            "type": "array",
            "description": "Canadian locations in 'City, Province' or 'City, ST' format (e.g. 'Toronto, ON', 'Montreal, QC', 'Vancouver, BC'). Each location is cross-joined with every search term. Leave empty to search all of Canada.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "Direct YellowPages.ca URLs to scrape. Accepts search results pages (yellowpages.ca/search/...), category pages (yellowpages.ca/ON/Toronto/Plumbers), or individual business detail pages (yellowpages.ca/bus/...). Use this when the user provides specific URLs to scrape. Do NOT use this when the user describes a keyword or business type — use searchTerms + locations instead.",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL",
                  "description": "Full YellowPages.ca URL to scrape (required)"
                }
              },
              "required": [
                "url"
              ]
            }
          },
          "maxResults": {
            "title": "Max Results",
            "minimum": 0,
            "type": "integer",
            "description": "Hard cap on total business records extracted across all searches and URLs. Set to 0 for unlimited (internal cap of 10,000 applies). The actor stops paginating once this number is reached.",
            "default": 100
          },
          "maxPagesPerSearch": {
            "title": "Max Pages per Search",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Maximum number of result pages to crawl per (search term x location) pair or per start URL. YellowPages.ca typically shows up to 50 results per page. Set higher for more exhaustive crawls.",
            "default": 10
          },
          "extractDetails": {
            "title": "Visit Detail Pages",
            "type": "boolean",
            "description": "When enabled, follow each business's detail page on YellowPages.ca to extract additional fields (email, full hours, social links, services, payment methods, years in business, logo, photos, coordinates). Roughly 2x the runtime and proxy cost. Disable for faster runs with basic fields only.",
            "default": true
          },
          "includeReviews": {
            "title": "Include Reviews",
            "type": "boolean",
            "description": "Embed customer reviews for each business when 'Visit Detail Pages' is also enabled. Off by default — significantly increases runtime as each business needs additional review page fetches.",
            "default": false
          },
          "maxReviewsPerBusiness": {
            "title": "Max Reviews per Business",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum number of customer reviews to capture per business when 'Include Reviews' is enabled (most recent first). Set to 0 to capture every available review (internal hard cap of ~500 applies).",
            "default": 30
          },
          "sortBy": {
            "title": "Sort Listings By",
            "enum": [
              "default",
              "distance",
              "name",
              "rating"
            ],
            "type": "string",
            "description": "How YellowPages.ca sorts the search results before extraction. Applies to keyword + location searches only (ignored for direct URLs).",
            "default": "default"
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "Apify proxy settings. Canadian residential proxies (RESIDENTIAL, country CA) are required — YellowPages.ca uses CloudFront geo-blocking and blocks datacenter IPs and non-CA residential ranges. Leave default unless you have custom proxy needs.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ],
              "apifyProxyCountry": "CA"
            }
          },
          "maxConcurrency": {
            "title": "Max Concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Maximum number of concurrent browser pages. Lower this if you encounter rate-limiting or timeout errors. Increase for faster scraping on stable connections.",
            "default": 5
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}