{
  "openapi": "3.0.1",
  "info": {
    "title": "Web Search - Google Results by Country and Language",
    "description": "Batch Google search with an explicit country and language. One result record per query: ranked organic results (URL, title, snippet), ads excluded, redirect links resolved, and failures, retries and provider costs reported honestly.",
    "version": "0.0",
    "x-build-id": "U5tMaW2mbhGX0BxAV"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/leadproof~web-search/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-leadproof-web-search",
        "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/leadproof~web-search/runs": {
      "post": {
        "operationId": "runs-sync-leadproof-web-search",
        "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/leadproof~web-search/run-sync": {
      "post": {
        "operationId": "run-sync-leadproof-web-search",
        "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": [
          "queries",
          "country",
          "language"
        ],
        "properties": {
          "queries": {
            "title": "Queries",
            "type": "array",
            "description": "Up to 500 queries, as strings or objects {\"id\": \"your-id\", \"query\": \"...\"}. Order is kept, and repeated queries are searched again with their own ids. Ids must be unique when given."
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Country to search from, as an ISO 3166-1 alpha-2 code such as KE, NG, GB or US (English country names also work). Sent to Google as the country domain and gl parameter, and to the proxy as its country. Required: never guessed."
          },
          "language": {
            "title": "Language",
            "type": "string",
            "description": "Interface language code such as en, sw, fr or pt-BR (Google hl). Results in other languages can still appear unless you restrict them below."
          },
          "maxResultsPerQuery": {
            "title": "Maximum results per query",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Organic results to keep per query. Google shows up to 10 per page, so more than 10 needs more result pages, and each page is a separate search request.",
            "default": 10
          },
          "maxPagesPerQuery": {
            "title": "Maximum result pages per query",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Hard cap on result pages (and paid search requests) per query. 0 means just enough pages for the maximum results. Pagination also stops when Google has no next page.",
            "default": 0
          },
          "dateRange": {
            "title": "Published within",
            "enum": [
              "any",
              "day",
              "week",
              "month",
              "year"
            ],
            "type": "string",
            "description": "Google's time filter (tbs=qdr).",
            "default": "any"
          },
          "site": {
            "title": "Only this site (optional)",
            "type": "string",
            "description": "Restrict every query to one domain, optionally with a path, for example kenyabizlist.com. Added to the query as a site: operator."
          },
          "restrictToLanguage": {
            "title": "Only pages in this language",
            "type": "boolean",
            "description": "Ask Google for documents in the selected language only (lr parameter).",
            "default": false
          },
          "resolveRedirects": {
            "title": "Resolve result links",
            "type": "boolean",
            "description": "Google links results through its own redirect. On: each link is resolved with one request to Google that reads only the destination (target pages are never opened). Off: redirect links are returned as they are.",
            "default": true
          },
          "provider": {
            "title": "Search provider",
            "enum": [
              "google",
              "brave"
            ],
            "type": "string",
            "description": "Google uses the run's Apify Google SERP proxy. Brave is a different engine with its own index; it needs the BRAVE_SEARCH_API_KEY secret and results are labeled brave.",
            "default": "google"
          },
          "maxConcurrency": {
            "title": "Parallel queries",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Queries searched at the same time.",
            "default": 3
          },
          "maxRetries": {
            "title": "Retries per page",
            "minimum": 0,
            "maximum": 5,
            "type": "integer",
            "description": "Retries for transient failures only (timeouts, rate limits, CAPTCHA pages, proxy errors). Each retry is another search request.",
            "default": 2
          },
          "requestTimeoutSecs": {
            "title": "Request timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Timeout for one search request. Google SERP proxy requests commonly take 4-20 seconds.",
            "default": 45
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}