{
  "openapi": "3.0.1",
  "info": {
    "title": "Thailand Yellow Pages Scraper",
    "description": "Scrape yellowpages.co.th - Thailand's official business directory. Search by keyword and province, browse official business categories, or enrich specific listings with phone numbers, hours, and coordinates.",
    "version": "1.0",
    "x-build-id": "tPXHBsdHZEzKlqcJk"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/crawlerbros~thailand-yellow-pages-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-crawlerbros-thailand-yellow-pages-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/crawlerbros~thailand-yellow-pages-scraper/runs": {
      "post": {
        "operationId": "runs-sync-crawlerbros-thailand-yellow-pages-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/crawlerbros~thailand-yellow-pages-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-crawlerbros-thailand-yellow-pages-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "byCategory",
              "byProfileUrls"
            ],
            "type": "string",
            "description": "What to fetch from Thailand Yellow Pages (yellowpages.co.th).",
            "default": "search"
          },
          "query": {
            "title": "Search keyword (mode=search)",
            "type": "string",
            "description": "Product, service, shop name, company, phone number, or location term to search for, e.g. `restaurant`, `hotel`, `plumber`. Matches yellowpages.co.th's own site search.",
            "default": "restaurant"
          },
          "province": {
            "title": "Province filter (mode=search)",
            "enum": [
              "",
              "Amnat Charoen",
              "Ang Thong",
              "Bangkok",
              "Bueng Kan",
              "Buri Ram",
              "Chachoengsao",
              "Chai Nat",
              "Chaiyaphum",
              "Chanthaburi",
              "Chiang Mai",
              "Chiang Rai",
              "Chonburi",
              "Chumphon",
              "Kalasin",
              "Kamphaeng Phet",
              "Kanchanaburi",
              "Khon Kaen",
              "Krabi",
              "Lampang",
              "Lamphun",
              "Loei",
              "Lopburi",
              "Mae Hong Son",
              "Maha Sarakham",
              "Mukdahan",
              "Nakhon Nayok",
              "Nakhon Pathom",
              "Nakhon Phanom",
              "Nakhon Ratchasima",
              "Nakhon Sawan",
              "Nakhon Si Thammarat",
              "Nan",
              "Narathiwat",
              "Nong Bua Lam Phu",
              "Nong Khai",
              "Nonthaburi",
              "Pathum Thani",
              "Pattani",
              "Phang Nga",
              "Phatthalung",
              "Phayao",
              "Phetchabun",
              "Phetchaburi",
              "Phichit",
              "Phitsanulok",
              "Phra Nakhon Si Ayutthaya",
              "Phrae",
              "Phuket",
              "Prachinburi",
              "Prachuap Khiri Khan",
              "Ranong",
              "Ratchaburi",
              "Rayong",
              "Roi Et",
              "Sa Kaeo",
              "Sakon Nakhon",
              "Samut Prakan",
              "Samut Sakhon",
              "Samut Songkhram",
              "Saraburi",
              "Satun",
              "Sing Buri",
              "Sisaket",
              "Songkhla",
              "Sukhothai",
              "Suphan Buri",
              "Surat Thani",
              "Surin",
              "Tak",
              "Trang",
              "Trat",
              "Ubon Ratchathani",
              "Udon Thani",
              "Uthai Thani",
              "Uttaradit",
              "Yala",
              "Yasothon"
            ],
            "type": "string",
            "description": "Restrict search results to one of Thailand's 77 official provinces. Leave as \"(none)\" to search all of Thailand.",
            "default": ""
          },
          "category": {
            "title": "Category / heading name (mode=byCategory)",
            "type": "string",
            "description": "Exact yellowpages.co.th category (\"heading\") name to browse, in ENGLISH, e.g. `Restaurants & Food Shops`, `Hotels (Bangkok Metro)`, `Automobile Repairing & Service`, `Acupuncture Clinic`. Must match the official heading name exactly (case-insensitive) — browse the full taxonomy at yellowpages.co.th/en/category to find exact names. Results that don't exactly match the requested category are automatically filtered out, so an approximate name (e.g. `Hotels` instead of `Hotels (Bangkok Metro)`) yields 0 records rather than unrelated ones.",
            "default": "Restaurants & Food Shops"
          },
          "profileUrls": {
            "title": "Business profile URLs (mode=byProfileUrls)",
            "type": "array",
            "description": "Full yellowpages.co.th business profile URLs (containing `/profile/`), e.g. `https://www.yellowpages.co.th/profile/some-business-93ITTdSAL`. Also accepts the numeric `data-businessid` redirect form `https://www.yellowpages.co.th/profile/523342900374001`.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "language": {
            "title": "Site language (mode=search)",
            "enum": [
              "th",
              "en"
            ],
            "type": "string",
            "description": "Which language edition of yellowpages.co.th to browse for mode=search (address text renders in this language). Business names/descriptions are stored as entered by the business (usually Thai) regardless of this setting. Not used by mode=byCategory, which always matches against the English heading name for reliable category filtering.",
            "default": "th"
          },
          "includeContactDetails": {
            "title": "Enrich with full contact details (phone, hours)",
            "type": "boolean",
            "description": "For search/byCategory modes, visit each business's own yellowpages.co.th profile page to add phone number, business hours, and full street address. Only works for businesses that have a native yellowpages.co.th profile page (not ones that link straight out to their own website). Adds one extra request per result.",
            "default": true
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Hard cap on the number of business records returned.",
            "default": 30
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}