{
  "openapi": "3.0.1",
  "info": {
    "title": "BBB Scraper: Leads, Reviews and Complaints by City",
    "description": "Scrapes Better Business Bureau (bbb.org) search results for the USA and Canada past the 225-result cap, with optional customer reviews and complaints, complaint themes, a 0-100 lead score, change monitoring and an HTML report.",
    "version": "0.1",
    "x-build-id": "zUDa8Fun71Uyd9zCu"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/solalab_digital~bbb-leads-complaints-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-solalab_digital-bbb-leads-complaints-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/solalab_digital~bbb-leads-complaints-scraper/runs": {
      "post": {
        "operationId": "runs-sync-solalab_digital-bbb-leads-complaints-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/solalab_digital~bbb-leads-complaints-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-solalab_digital-bbb-leads-complaints-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": "What to search for: a category (\"plumber\", \"roofing contractors\") or a business name. Every term is searched in every location.",
            "items": {
              "type": "string"
            }
          },
          "locations": {
            "title": "Locations",
            "type": "array",
            "description": "\"City, ST\" (\"Austin, TX\"), a ZIP code, or a Canadian city with its province (\"Toronto, ON\").",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Country",
            "enum": [
              "USA",
              "CAN"
            ],
            "type": "string",
            "description": "BBB covers the USA and Canada.",
            "default": "USA"
          },
          "startUrls": {
            "title": "Start URLs",
            "type": "array",
            "description": "Optional. bbb.org search URLs (bbb.org/search?find_text=...&find_loc=...) or category URLs (bbb.org/us/tx/austin/category/plumber).",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "searchByName": {
            "title": "Search by business name",
            "type": "boolean",
            "description": "BBB matches terms loosely (\"Comcast\" also returns \"East Coast ...\"). Turn on to look up a specific company by its name.",
            "default": false
          },
          "sort": {
            "title": "Sort order",
            "enum": [
              "Relevance",
              "Distance",
              "Rating",
              "AToZ",
              "ZToA"
            ],
            "type": "string",
            "description": "Order in which BBB returns results.",
            "default": "Relevance"
          },
          "maxItems": {
            "title": "Max businesses",
            "minimum": 1,
            "type": "integer",
            "description": "Total number of unique businesses to save across all searches. Keeps run size and cost under control.",
            "default": 1000
          },
          "maxItemsPerQuery": {
            "title": "Max businesses per search",
            "minimum": 0,
            "type": "integer",
            "description": "Limit for each term + location pair. 0 = no limit.",
            "default": 0
          },
          "autoSplit": {
            "title": "Get past the 225-result limit",
            "type": "boolean",
            "description": "BBB shows at most 225 results per search. When a search has more, it is split into sub-categories, nearby ZIP codes and other sort orders, and duplicates are removed.",
            "default": true
          },
          "maxSplitRequests": {
            "title": "Max extra requests for splitting",
            "minimum": 0,
            "type": "integer",
            "description": "Safety cap on extra search pages used to get past the 225 limit (each page = 15 results).",
            "default": 300
          },
          "accreditedOnly": {
            "title": "Accredited businesses only",
            "type": "boolean",
            "description": "Keep only BBB Accredited Businesses.",
            "default": false
          },
          "minRating": {
            "title": "Minimum BBB rating",
            "enum": [
              "any",
              "A+",
              "A",
              "A-",
              "B+",
              "B",
              "B-",
              "C+",
              "C",
              "C-",
              "D+",
              "D",
              "D-",
              "F"
            ],
            "type": "string",
            "description": "Drop businesses rated below this grade. Not-rated businesses are dropped when a grade is set.",
            "default": "any"
          },
          "strictMatch": {
            "title": "Strict match",
            "type": "boolean",
            "description": "Keep only businesses whose name or categories contain every word of the search term.",
            "default": false
          },
          "includeReviews": {
            "title": "Include customer reviews",
            "type": "boolean",
            "description": "Fetch review texts, star ratings and business replies for every business.",
            "default": false
          },
          "maxReviewsPerBusiness": {
            "title": "Max reviews per business",
            "minimum": 1,
            "type": "integer",
            "description": "Newest reviews first.",
            "default": 30
          },
          "includeComplaints": {
            "title": "Include complaints",
            "type": "boolean",
            "description": "Fetch complaint texts, type, status and business responses, plus counts by status and type for all complaints on file.",
            "default": false
          },
          "maxComplaintsPerBusiness": {
            "title": "Max complaints per business",
            "minimum": 1,
            "type": "integer",
            "description": "Most recently closed first. Status and type counts always cover all complaints.",
            "default": 30
          },
          "monitorMode": {
            "title": "Monitor changes",
            "type": "boolean",
            "description": "Compare with the previous run under the same monitor name: marks each business NEW, CHANGED or UNCHANGED and lists changed fields (rating, accreditation, complaints...).",
            "default": false
          },
          "monitorKey": {
            "title": "Monitor name",
            "type": "string",
            "description": "Runs with the same name share one snapshot. Use different names for different watch lists.",
            "default": "default"
          },
          "onlyChanges": {
            "title": "Save only new and changed",
            "type": "boolean",
            "description": "With monitoring on, unchanged businesses are not saved (and not charged).",
            "default": false
          },
          "buildReport": {
            "title": "Build HTML report",
            "type": "boolean",
            "description": "Save a self-contained HTML report (REPORT) to the key-value store.",
            "default": true
          },
          "maxConcurrency": {
            "title": "Max parallel requests",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Higher is faster but more likely to be rate-limited by BBB.",
            "default": 4
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Usually not needed: BBB's search, review and complaint data loads without a proxy. Turn on if you see blocking warnings in the log.",
            "default": {
              "useApifyProxy": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}