Web Scraper API documentation
Get to know how Web Scraper API works and integrate it into your app.
Authenticationβ
All requests must include an X-API-Key header with a valid API key. For example:
X-API-Key: YOUR_SECRET_API_KEY
Scraper and API endpointβ
POST https://scrape.infatica.io/
- Purpose: Fetches a webpage at a given URL, optionally using a specified country proxy and/or language headers.
- Auth: Requires X-API-Key in the request header.
- Requests: Each call consumes 1 request.
Features:
- Ability to specify ISO 3166-1 country code (e.g.
"US","GB","DE") to use a localized proxy. - Optionally set language (e.g.,
"en-US","de-DE") to shape theAccept-Languageheader. - Return raw HTML (
return_html = true) or a JSON structure (return_html = false, default).
Request body (JSON):β
| Field | Type | Required? | Description |
|---|---|---|---|
url | string | yes | The URL to fetch (e.g. "https://www.example.com") |
country | string | no | ISO 3166-1 alpha-2 code (e.g. "US", "GB", "DE"). Uses localized proxy |
language | string | no | Language code in "xx-YY" format (e.g., "en-US", "de-DE") |
return_html | boolean | no | true returns raw HTML; false returns JSON with HTML sample (default) |
Example cURL Request:β
curl -X POST "https://scrape.infatica.io/" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_SECRET_API_KEY" \
-d '{
"url": "https://www.example.com",
"country": "US",
}'
Success Responseβ
HTTP Status: 200 OK
If return_html = false (default):
{
"status_code": 200,
"requests_used": 1,
"time_spent_ms": 123,
"api_key": "YOUR_SECRET_API_KEY",
"timestamp": "2025-03-25T12:00:00.123456",
"country": "US",
"language": "en-US",
"data": {
"html": "Base64 encoded HTML"
}
}
If return_html = true, the response is raw HTML:
<!DOCTYPE html>
<html>
<head>...</head>
<body>Full HTML of the requested page</body>
</html>
Google SERP endpointβ
Advanced Google SERP scraping endpoint with auto-retry, parallel page fetching, and Google AI Overview support.
Endpoint: POST https://scrape.infatica.io/serp
Auth: X-API-Key header (Advanced plan required)
Parametersβ
| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | required | Google search URL |
results | int | 10 | Total results to fetch (max 100) |
pages | string | null | Specific pages as CSV (e.g., "1,3,5", max 10 pages) |
mode | string | "scrape" | "scrape" or "render" (forces browser + Google AI) |
country | string | null | ISO 3166-1 country code |
return_html | bool | false | Return raw HTML instead of JSON |
Note: pages takes precedence over results if both specified.
Responseβ
{
"status_code": 200,
"requests_used": 45,
"elapsed_time": 3500,
"html": "base64_encoded_html"
}
Behaviorβ
- First request: scrape mode (fast) β auto-switches to render if blocked
- Render mode: forces browser execution + enables
scrape_google_ai=truefor AI Overview - Retry logic: up to 3 attempts on bans
- Additional pages: fetched in parallel (scrape mode, 1 request each)
- HTML: all pages concatenated
Examplesβ
Basic (10 results)β
curl -X POST "https://scrape.infatica.io/serp" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://www.google.com/search?q=python+scraping"}'
Multiple pages (50 results)β
curl -X POST "https://scrape.infatica.io/serp" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.google.com/search?q=machine+learning",
"results": 50
}'
Specific pages onlyβ
curl -X POST "https://scrape.infatica.io/serp" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.google.com/search?q=ai",
"pages": "1,3,5"
}'
Force render + Google AI Overviewβ
curl -X POST "https://scrape.infatica.io/serp" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.google.com/search?q=climate+change",
"mode": "render",
"results": 20
}'
Geo-targeted searchβ
curl -X POST "https://scrape.infatica.io/serp" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.google.com/search?q=restaurants",
"country": "DE",
"results": 30
}'
Decode Base64 HTMLβ
Python:
import base64, json
html = base64.b64decode(response["html"]).decode("utf-8")
Node.js:
const html = Buffer.from(response.html, 'base64').toString('utf-8');
Bash:
echo "$RESPONSE_HTML" | base64 -d
Pricingβ
- scrape: 1 request per page
- Additional pages: 1 request each (scrape mode)
Examples:
- 10 results (1 page), scrape: ~1 request
- 50 results (5 pages), scrape: ~5 requests
Error Codesβ
| Code | Reason | Solution |
|---|---|---|
| 400 | Invalid payload | Check JSON format |
| 403 | Advanced plan required | Upgrade plan |
| 429 | Rate limit exceeded | Reduce request frequency |
| 500 | All retries failed | Try render mode or adjust params |
Limitsβ
- Max results: 100
- Max pages: 10
Tipsβ
- Use
pagesfor selective scraping - Use render mode when you need Google AI Overview
AI Search Endpointsβ
Query AI-powered search engines (Gemini and Perplexity) and receive HTML responses.
Endpoints:
POST https://scrape.infatica.io/geminiPOST https://scrape.infatica.io/perplexity
Auth: X-API-Key header (Advanced plan required)
Parametersβ
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | yes | The search query to send to the AI service |
return_html | boolean | no | true returns raw HTML; false returns JSON (default) |
Example: Geminiβ
curl -X POST "https://scrape.infatica.io/gemini" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{"query": "audi vs bmw"}'
Example: Perplexityβ
curl -X POST "https://scrape.infatica.io/perplexity" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{"query": "best programming languages 2026"}'
Example: Raw HTML Responseβ
curl -X POST "https://scrape.infatica.io/gemini" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{"query": "climate change effects", "return_html": true}'
Success Responseβ
HTTP Status: 200 OK
If return_html = false (default):
{
"api_key": "YOUR_API_KEY",
"query": "audi vs bmw",
"created_at": "2025-01-21T12:00:00.123456",
"processed_at": "2025-01-21T12:00:02.456789",
"time_spent_ms": 2333,
"requests_used": 1,
"html": "<html>...response content...</html>"
}
If return_html = true, the response is raw HTML from the AI service.
Error Codesβ
| Code | Reason | Solution |
|---|---|---|
| 403 | Advanced plan required | Upgrade your plan |
| 500 | No html_content in response | AI service issue, retry later |
Notesβ
- You are charged only for successful responses
- Response times may vary based on query complexity
Render JS endpointβ
POST https://scrape.infatica.io/render
- Purpose: Fetches a webpage at a given URL and renders it via browser, optionally using a specified country proxy and/or language headers.
- Auth: Requires X-API-Key in the request header.
- Requests: Each call consumes 1 request.
Features:
- Ability to specify ISO 3166-1 country code (e.g. "US", "GB", "DE") to use a localized proxy.
- Optionally set language (e.g., "en-US", "de-DE") to shape the Accept-Language header.
- Return raw HTML (return_html = true) or a JSON structure (return_html = false, default).
Request body (JSON):β
| Field | Type | Required? | Description |
|---|---|---|---|
url | string | yes | The URL to fetch (e.g. "https://www.example.com") |
country | string | no | ISO 3166-1 alpha-2 code (e.g. "US", "GB", "DE"). Uses localized proxy |
language | string | no | Language code in "xx-YY" format (e.g., "en-US", "de-DE") |
return_html | boolean | no | true returns raw HTML; false returns JSON with HTML sample (default) |
Example cURL Request:β
curl -X POST "https://scrape.infatica.io/render" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_SECRET_API_KEY" \
-d '{
"url": "https://www.example.com",
"country": "US",
}'
Success Responseβ
HTTP Status: 200 OK
If return_html = false (default):
{
"status_code": 200,
"requests_used": 1,
"time_spent_ms": 123,
"api_key": "YOUR_SECRET_API_KEY",
"timestamp": "2025-03-25T12:00:00.123456",
"country": "US",
"language": "en-US",
"data": {
"html": "Base64 encoded HTML"
}
}
If return_html = true, the response is raw HTML:
<!DOCTYPE html>
<html>
<head>...</head>
<body>Full HTML of the requested page</body>
</html>
Possible Error Responsesβ
HTTP Status Codesβ
| Status Code | Cause |
|---|---|
| 401 | Invalid API key; Not enough prepaid requests; Missing API key |
| 403 | The account is suspended |
| 400 | The provided country is not a valid ISO 3166-1 code |
| 422 | The request body fails validation |
| 500 | Server errors or unexpected issues |
Country codesβ
If you want to define the geolocation for your request, you may set the country code (string) parameter with one country code at the creation of the request.
Supported country codes can be found in the collapsible table below:
Where US is a two-letter uppercase country code according to ISO 3166-1:
Country codes (click here to expand)
| Code | Country name | Code | Country name | Code | Country name |
|---|---|---|---|---|---|
| AD | Andorra | GL | Greenland | NO | Norway |
| AE | United Arab Emirates | GM | Gambia | NP | Nepal |
| AF | Afghanistan | GN | Guinea | NR | Nauru |
| AG | Antigua and Barbuda | GP | Guadeloupe | NU | Niue |
| AI | Anguilla | GQ | Equatorial Guinea | NZ | New Zealand |
| AL | Albania | GR | Greece | OM | Oman |
| AM | Armenia | GS | South Georgia and the South Sandwich Islands | PA | Panama |
| AO | Angola | GT | Guatemala | PE | Peru |
| AQ | Antarctica | GU | Guam | PF | French Polynesia |
| AR | Argentina | GW | Guinea-Bissau | PG | Papua New Guinea |
| AS | American Samoa | GY | Guyana | PH | Philippines |
| AT | Austria | HK | Hong Kong | PK | Pakistan |
| AU | Australia | HM | Heard Island and McDonald Islands | PL | Poland |
| AW | Aruba | HN | Honduras | PM | Saint Pierre and Miquelon |
| AX | Γ land Islands | HR | Croatia | PN | Pitcairn |
| AZ | Azerbaijan | HT | Haiti | PR | Puerto Rico |
| BA | Bosnia and Herzegovina | HU | Hungary | PS | Palestine, State of |
| BB | Barbados | ID | Indonesia | PT | Portugal |
| BD | Bangladesh | IE | Ireland | PW | Palau |
| BE | Belgium | IL | Israel | PY | Paraguay |
| BF | Burkina Faso | IM | Isle of Man | QA | Qatar |
| BG | Bulgaria | IN | India | RE | RΓ©union |
| BH | Bahrain | IO | British Indian Ocean Territory | RO | Romania |
| BI | Burundi | IQ | Iraq | RS | Serbia |
| BJ | Benin | IR | Iran (Islamic Republic of) | RU | Russian Federation |
| BL | Saint BarthΓ©lemy | IS | Iceland | RW | Rwanda |
| BM | Bermuda | IT | Italy | SA | Saudi Arabia |
| BN | Brunei Darussalam | JE | Jersey | SB | Solomon Islands |
| BO | Bolivia (Plurinational State of) | JM | Jamaica | SC | Seychelles |
| BQ | Bonaire, Sint Eustatius and Saba | JO | Jordan | SD | Sudan |
| BR | Brazil | JP | Japan | SE | Sweden |
| BS | Bahamas | KE | Kenya | SG | Singapore |
| BT | Bhutan | KG | Kyrgyzstan | SH | Saint Helena, Ascension and Tristan da Cunha |
| BV | Bouvet Island | KH | Cambodia | SI | Slovenia |
| BW | Botswana | KI | Kiribati | SJ | Svalbard and Jan Mayen |
| BY | Belarus | KM | Comoros | SK | Slovakia |
| BZ | Belize | KN | Saint Kitts and Nevis | SL | Sierra Leone |
| CA | Canada | KP | Korea (Democratic People's Republic of) | SM | San Marino |
| CC | Cocos (Keeling) Islands | KR | Korea, Republic of | SN | Senegal |
| CD | Congo, Democratic Republic of the | KW | Kuwait | SO | Somalia |
| CF | Central African Republic | KY | Cayman Islands | SR | Suriname |
| CG | Congo | KZ | Kazakhstan | SS | South Sudan |
| CH | Switzerland | LA | Lao People's Democratic Republic | ST | Sao Tome and Principe |
| CI | CΓ΄te d'Ivoire | LB | Lebanon | SV | El Salvador |
| CK | Cook Islands | LC | Saint Lucia | SX | Sint Maarten (Dutch part) |
| CL | Chile | LI | Liechtenstein | SY | Syrian Arab Republic |
| CM | Cameroon | LK | Sri Lanka | SZ | Eswatini |
| CN | China | LR | Liberia | TC | Turks and Caicos Islands |
| CO | Colombia | LS | Lesotho | TD | Chad |
| CR | Costa Rica | LT | Lithuania | TF | French Southern Territories |
| CU | Cuba | LU | Luxembourg | TG | Togo |
| CV | Cabo Verde | LV | Latvia | TH | Thailand |
| CW | CuraΓ§ao | LY | Libya | TJ | Tajikistan |
| CX | Christmas Island | MA | Morocco | TK | Tokelau |
| CY | Cyprus | MC | Monaco | TL | Timor-Leste |
| CZ | Czechia | MD | Moldova, Republic of | TM | Turkmenistan |
| DE | Germany | ME | Montenegro | TN | Tunisia |
| DJ | Djibouti | MF | Saint Martin (French part) | TO | Tonga |
| DK | Denmark | MG | Madagascar | TR | TΓΌrkiye |
| DM | Dominica | MH | Marshall Islands | TT | Trinidad and Tobago |
| DO | Dominican Republic | MK | North Macedonia | TV | Tuvalu |
| DZ | Algeria | ML | Mali | TW | Taiwan, Province of China |
| EC | Ecuador | MM | Myanmar | TZ | Tanzania, United Republic of |
| EE | Estonia | MN | Mongolia | UA | Ukraine |
| EG | Egypt | MO | Macao | UG | Uganda |
| EH | Western Sahara | MP | Northern Mariana Islands | UM | United States Minor Outlying Islands |
| ER | Eritrea | MQ | Martinique | US | United States of America |
| ES | Spain | MR | Mauritania | UY | Uruguay |
| ET | Ethiopia | MS | Montserrat | UZ | Uzbekistan |
| FI | Finland | MT | Malta | VA | Holy See |
| FJ | Fiji | MU | Mauritius | VC | Saint Vincent and the Grenadines |
| FK | Falkland Islands (Malvinas) | MV | Maldives | VE | Venezuela (Bolivarian Republic of) |
| FM | Micronesia (Federated States of) | MW | Malawi | VG | Virgin Islands (British) |
| FO | Faroe Islands | MX | Mexico | VI | Virgin Islands (U.S.) |
| FR | France | MY | Malaysia | VN | Viet Nam |
| GA | Gabon | MZ | Mozambique | VU | Vanuatu |
| GB | United Kingdom of Great Britain and Northern Ireland | NA | Namibia | WF | Wallis and Futuna |
| GD | Grenada | NC | New Caledonia | WS | Samoa |
| GE | Georgia | NE | Niger | YE | Yemen |
| GF | French Guiana | NF | Norfolk Island | YT | Mayotte |
| GG | Guernsey | NG | Nigeria | ZA | South Africa |
| GH | Ghana | NI | Nicaragua | ZM | Zambia |
| GI | Gibraltar | NL | Netherlands | ZW | Zimbabwe |
Language codesβ
If you want to define the language in your request, you may set the language (string) parameter with one language tag at the creation of the request.
Language codes can be found in the collapsible table below:
All language codes/tags (click here to expand)
| Language Tag | Language | Region | Description |
|---|---|---|---|
| ar-SA | Arabic | Saudi Arabia | Arabic (Saudi Arabia) |
| bn-BD | Bangla | Bangladesh | Bangla (Bangladesh) |
| bn-IN | Bangla | India | Bangla (India) |
| cs-CZ | Czech | Czech Republic | Czech (Czech Republic) |
| da-DK | Danish | Denmark | Danish (Denmark) |
| de-AT | German | Austria | Austrian German |
| de-CH | German | Switzerland | "Swiss" German |
| de-DE | German | Germany | Standard German (as spoken in Germany) |
| el-GR | Greek | Greece | Modern Greek |
| en-AU | English | Australia | Australian English |
| en-CA | English | Canada | Canadian English |
| en-GB | English | United Kingdom | British English |
| en-IE | English | Ireland | Irish English |
| en-IN | English | India | Indian English |
| en-NZ | English | New Zealand | New Zealand English |
| en-US | English | United States | US English |
| en-ZA | English | South Africa | English (South Africa) |
| es-AR | Spanish | Argentina | Argentine Spanish |
| es-CL | Spanish | Chile | Chilean Spanish |
| es-CO | Spanish | Columbia | Colombian Spanish |
| es-ES | Spanish | Spain | Castilian Spanish (as spoken in Central-Northern Spain) |
| es-MX | Spanish | Mexico | Mexican Spanish |
| es-US | Spanish | United States | American Spanish |
| fi-FI | Finnish | Finland | Finnish (Finland) |
| fr-BE | French | Belgium | Belgian French |
| fr-CA | French | Canada | Canadian French |
| fr-CH | French | Switzerland | "Swiss" French |
| fr-FR | French | France | Standard French (especially in France) |
| he-IL | Hebrew | Israel | Hebrew (Israel) |
| hi-IN | Hindi | India | Hindi (India) |
| hu-HU | Hungarian | Hungary | Hungarian (Hungary) |
| id-ID | Indonesian | Indonesia | Indonesian (Indonesia) |
| it-CH | Italian | Switzerland | "Swiss" Italian |
| it-IT | Italian | Italy | Standard Italian (as spoken in Italy) |
| ja-JP | Japanese | Japan | Japanese (Japan) |
| ko-KR | Korean | Republic of Korea | Korean (Republic of Korea) |
| nl-BE | Dutch | Belgium | Belgian Dutch |
| nl-NL | Dutch | The Netherlands | Standard Dutch (as spoken in The Netherlands) |
| no-NO | Norwegian | Norway | Norwegian (Norway) |
| pl-PL | Polish | Poland | Polish (Poland) |
| pt-BR | Portugese | Brazil | Brazilian Portuguese |
| pt-PT | Portugese | Portugal | European Portuguese (as written and spoken in Portugal) |
| ro-RO | Romanian | Romania | Romanian (Romania) |
| ru-RU | Russian | Russian Federation | Russian (Russian Federation) |
| sk-SK | Slovak | Slovakia | Slovak (Slovakia) |
| sv-SE | Swedish | Sweden | Swedish (Sweden) |
| ta-IN | Tamil | India | Indian Tamil |
| ta-LK | Tamil | Sri Lanka | Sri Lankan Tamil |
| th-TH | Thai | Thailand | Thai (Thailand) |
| tr-TR | Turkish | Turkey | Turkish (Turkey) |
| zh-CN | Chinese | China | Mainland China, simplified characters |
| zh-HK | Chinese | Hond Kong | Hong Kong, traditional characters |
| zh-TW | Chinese | Taiwan | Taiwan, traditional characters |