# Scrapfly Documentation

## Table of Contents

### Dashboard

- [Intro](https://scrapfly.io/docs)
- [Project](https://scrapfly.io/docs/project)
- [Account](https://scrapfly.io/docs/account)
- [Workspace & Team](https://scrapfly.io/docs/workspace-and-team)
- [Billing](https://scrapfly.io/docs/billing)

### Products

#### MCP Server

- [Getting Started](https://scrapfly.io/docs/mcp/getting-started)
- [Tools & API Spec](https://scrapfly.io/docs/mcp/tools)
- [Authentication](https://scrapfly.io/docs/mcp/authentication)
- [Examples & Use Cases](https://scrapfly.io/docs/mcp/examples)
- [FAQ](https://scrapfly.io/docs/mcp/faq)
##### Integrations

- [Overview](https://scrapfly.io/docs/mcp/integrations)
- [Claude Desktop](https://scrapfly.io/docs/mcp/integrations/claude-desktop)
- [Claude Code](https://scrapfly.io/docs/mcp/integrations/claude-code)
- [ChatGPT](https://scrapfly.io/docs/mcp/integrations/chatgpt)
- [Cursor](https://scrapfly.io/docs/mcp/integrations/cursor)
- [Cline](https://scrapfly.io/docs/mcp/integrations/cline)
- [Windsurf](https://scrapfly.io/docs/mcp/integrations/windsurf)
- [Zed](https://scrapfly.io/docs/mcp/integrations/zed)
- [Roo Code](https://scrapfly.io/docs/mcp/integrations/roo-code)
- [VS Code](https://scrapfly.io/docs/mcp/integrations/vscode)
- [LangChain](https://scrapfly.io/docs/mcp/integrations/langchain)
- [LlamaIndex](https://scrapfly.io/docs/mcp/integrations/llamaindex)
- [CrewAI](https://scrapfly.io/docs/mcp/integrations/crewai)
- [OpenAI](https://scrapfly.io/docs/mcp/integrations/openai)
- [n8n](https://scrapfly.io/docs/mcp/integrations/n8n)
- [Make](https://scrapfly.io/docs/mcp/integrations/make)
- [Zapier](https://scrapfly.io/docs/mcp/integrations/zapier)
- [Vapi AI](https://scrapfly.io/docs/mcp/integrations/vapi)
- [Agent Builder](https://scrapfly.io/docs/mcp/integrations/agent-builder)
- [Custom Client](https://scrapfly.io/docs/mcp/integrations/custom-client)


#### Web Scraping API

- [Getting Started](https://scrapfly.io/docs/scrape-api/getting-started)
- [API Specification]()
- [Monitoring](https://scrapfly.io/docs/monitoring)
- [Customize Request](https://scrapfly.io/docs/scrape-api/custom)
- [Debug](https://scrapfly.io/docs/scrape-api/debug)
- [Unblocker (formerly ASP)](https://scrapfly.io/docs/scrape-api/unblocker)
- [Proxy](https://scrapfly.io/docs/scrape-api/proxy)
- [Proxy Mode](https://scrapfly.io/docs/scrape-api/proxy-mode)
- [Proxy Mode - Screaming Frog](https://scrapfly.io/docs/scrape-api/proxy-mode/screaming-frog)
- [Proxy Mode - Apify](https://scrapfly.io/docs/scrape-api/proxy-mode/apify)
- [(Auto) Data Extraction](https://scrapfly.io/docs/scrape-api/extraction)
- [Javascript Rendering](https://scrapfly.io/docs/scrape-api/javascript-rendering)
- [Javascript Scenario](https://scrapfly.io/docs/scrape-api/javascript-scenario)
- [SSL](https://scrapfly.io/docs/scrape-api/ssl)
- [DNS](https://scrapfly.io/docs/scrape-api/dns)
- [Cache](https://scrapfly.io/docs/scrape-api/cache)
- [Batch (Multi-URL Scraping)](https://scrapfly.io/docs/scrape-api/batch)
- [Session](https://scrapfly.io/docs/scrape-api/session)
- [Webhook](https://scrapfly.io/docs/scrape-api/webhook)
- [Schedule](https://scrapfly.io/docs/scrape-api/schedule)
- [Screenshot](https://scrapfly.io/docs/scrape-api/screenshot)
- [Errors](https://scrapfly.io/docs/scrape-api/errors)
- [Timeout](https://scrapfly.io/docs/scrape-api/understand-timeout)
- [Throttling](https://scrapfly.io/docs/throttling)
- [Troubleshoot](https://scrapfly.io/docs/scrape-api/troubleshoot)
- [Billing](https://scrapfly.io/docs/scrape-api/billing)
- [FAQ](https://scrapfly.io/docs/scrape-api/faq)

#### Crawler API

- [Getting Started](https://scrapfly.io/docs/crawler-api/getting-started)
- [API Specification]()
- [Retrieving Results](https://scrapfly.io/docs/crawler-api/results)
- [WARC Format](https://scrapfly.io/docs/crawler-api/warc-format)
- [Data Extraction](https://scrapfly.io/docs/crawler-api/extraction-rules)
- [Search](https://scrapfly.io/docs/crawler-api/search)
- [Prompt & Extract](https://scrapfly.io/docs/crawler-api/prompt)
- [Auto Refresh](https://scrapfly.io/docs/crawler-api/refresh)
- [Webhook](https://scrapfly.io/docs/crawler-api/webhook)
- [Schedule](https://scrapfly.io/docs/crawler-api/schedule)
- [Billing](https://scrapfly.io/docs/crawler-api/billing)
- [Errors](https://scrapfly.io/docs/crawler-api/errors)
- [Troubleshoot](https://scrapfly.io/docs/crawler-api/troubleshoot)
- [FAQ](https://scrapfly.io/docs/crawler-api/faq)

#### Screenshot API

- [Getting Started](https://scrapfly.io/docs/screenshot-api/getting-started)
- [API Specification]()
- [Accessibility Testing](https://scrapfly.io/docs/screenshot-api/accessibility)
- [Webhook](https://scrapfly.io/docs/screenshot-api/webhook)
- [Schedule](https://scrapfly.io/docs/screenshot-api/schedule)
- [Billing](https://scrapfly.io/docs/screenshot-api/billing)
- [Errors](https://scrapfly.io/docs/screenshot-api/errors)

#### Extraction API

- [Getting Started](https://scrapfly.io/docs/extraction-api/getting-started)
- [API Specification]()
- [Rules Template](https://scrapfly.io/docs/extraction-api/rules-and-template)
- [LLM Extraction](https://scrapfly.io/docs/extraction-api/llm-prompt)
- [AI Auto Extraction](https://scrapfly.io/docs/extraction-api/automatic-ai)
- [Webhook](https://scrapfly.io/docs/extraction-api/webhook)
- [Billing](https://scrapfly.io/docs/extraction-api/billing)
- [Errors](https://scrapfly.io/docs/extraction-api/errors)
- [FAQ](https://scrapfly.io/docs/extraction-api/faq)

#### Data API


#### Proxy Saver

- [Getting Started](https://scrapfly.io/docs/proxy-saver/getting-started)
- [Fingerprints](https://scrapfly.io/docs/proxy-saver/fingerprints)
- [Optimizations](https://scrapfly.io/docs/proxy-saver/optimizations)
- [SSL Certificates](https://scrapfly.io/docs/proxy-saver/certificates)
- [Protocols](https://scrapfly.io/docs/proxy-saver/protocols)
- [Pacfile](https://scrapfly.io/docs/proxy-saver/pacfile)
- [Secure Credentials](https://scrapfly.io/docs/proxy-saver/security)
- [Billing](https://scrapfly.io/docs/proxy-saver/billing)

#### Cloud Browser API

- [Getting Started](https://scrapfly.io/docs/cloud-browser-api/getting-started)
- [Proxy & Geo-Targeting](https://scrapfly.io/docs/cloud-browser-api/proxy)
- [Unblock API](https://scrapfly.io/docs/cloud-browser-api/unblock)
- [Captcha Solver](https://scrapfly.io/docs/cloud-browser-api/captcha-solver)
- [File Downloads](https://scrapfly.io/docs/cloud-browser-api/file-downloads)
- [Session Resume](https://scrapfly.io/docs/cloud-browser-api/session-resume)
- [Human-in-the-Loop](https://scrapfly.io/docs/cloud-browser-api/human-in-the-loop)
- [Debug Mode](https://scrapfly.io/docs/cloud-browser-api/debug-mode)
- [Browser Extensions](https://scrapfly.io/docs/cloud-browser-api/extensions)
- [Credential Vault](https://scrapfly.io/docs/cloud-browser-api/credential-vault)
- [Native Browser MCP](https://scrapfly.io/docs/cloud-browser-api/mcp)
- [DevTools Protocol](https://scrapfly.io/docs/cloud-browser-api/cdp-reference)
##### Integrations

- [Puppeteer](https://scrapfly.io/docs/cloud-browser-api/puppeteer)
- [Playwright](https://scrapfly.io/docs/cloud-browser-api/playwright)
- [Selenium](https://scrapfly.io/docs/cloud-browser-api/selenium)
- [Vercel Agent Browser](https://scrapfly.io/docs/cloud-browser-api/agent-browser)
- [Browser Use](https://scrapfly.io/docs/cloud-browser-api/browser-use)
- [Stagehand](https://scrapfly.io/docs/cloud-browser-api/stagehand)
- [1Password](https://scrapfly.io/docs/cloud-browser-api/1password)

- [Billing](https://scrapfly.io/docs/cloud-browser-api/billing)
- [Errors](https://scrapfly.io/docs/cloud-browser-api/errors)


### Tools

- [Antibot Detector](https://scrapfly.io/docs/tools/antibot-detector)

### SDK

- [Golang](https://scrapfly.io/docs/sdk/golang)
- [PHP](https://scrapfly.io/docs/sdk/php)
- [Python](https://scrapfly.io/docs/sdk/python)
- [Rust](https://scrapfly.io/docs/sdk/rust)
- [TypeScript](https://scrapfly.io/docs/sdk/typescript)
- [Scrapy](https://scrapfly.io/docs/sdk/scrapy)

### Integrations

- [Getting Started](https://scrapfly.io/docs/integration/getting-started)
- [LangChain](https://scrapfly.io/docs/integration/langchain)
- [LlamaIndex](https://scrapfly.io/docs/integration/llamaindex)
- [CrewAI](https://scrapfly.io/docs/integration/crewai)
- [Zapier](https://scrapfly.io/docs/integration/zapier)
- [Make](https://scrapfly.io/docs/integration/make)
- [n8n](https://scrapfly.io/docs/integration/n8n)

### Academy

- [Overview](https://scrapfly.io/academy)
- [Web Scraping Overview](https://scrapfly.io/academy/scraping-overview)
- [Tools](https://scrapfly.io/academy/tools-overview)
- [Reverse Engineering](https://scrapfly.io/academy/reverse-engineering)
- [Static Scraping](https://scrapfly.io/academy/static-scraping)
- [HTML Parsing](https://scrapfly.io/academy/html-parsing)
- [Dynamic Scraping](https://scrapfly.io/academy/dynamic-scraping)
- [Hidden API Scraping](https://scrapfly.io/academy/hidden-api-scraping)
- [Headless Browsers](https://scrapfly.io/academy/headless-browsers)
- [Hidden Web Data](https://scrapfly.io/academy/hidden-web-data)
- [JSON Parsing](https://scrapfly.io/academy/json-parsing)
- [Data Processing](https://scrapfly.io/academy/data-processing)
- [Scaling](https://scrapfly.io/academy/scaling)
- [Walkthrough Summary](https://scrapfly.io/academy/walkthrough-summary)
- [Scraper Blocking](https://scrapfly.io/academy/scraper-blocking)
- [Proxies](https://scrapfly.io/academy/proxies)

---

# Customize Requests

 All Scrapfly HTTP requests can be customized with custom headers, methods, cookies and other HTTP parameters. Let's take a look at the available options.

## Method

 The scrape requests method is equivalent to the HTTP method used to call the API. For example, calling Scrapfly through `POST` will forward the request as a `POST` request to the upstream website.
 Available methods are: `GET`, `PUT`, `POST`, `PATCH`, `HEAD`, `OPTIONS`

- [GET](#get)
- [POST](#post)
- [PUT](#put)
- [PATCH](#patch)
- [HEAD](#head)

 `GET` request is the most common request type used in web scraping. `GET` requests are used for retrieving data from a server without providing any data in the body of the request.

 [Python](#player-166795) [HTTP](#http-166795)

```
import requests

url = "https://api.scrapfly.io/scrape"

params = {
    "key": "__API_KEY__",
    "url": "https://httpbin.dev/html",
}

response = requests.request("GET", url, params=params)
# Raise exception for HTTP errors (4xx, 5xx)
response.raise_for_status()

data = response.json()
print(data)

# Access the scrape result
if 'result' in data:
    print(data['result'])

```

```
https://api.scrapfly.io/scrape?key=&url=https%3A%2F%2Fhttpbin.dev%2Fhtml
```

 `POST` requests are most commonly used to submit forms or documents. This HTTP method usually requires a `body` parameter to be sent with the request which stores the posted data. To indicate the type of posted data the `content-type` header is used. If it is not set explicitly, the API reads it from the body: a `JSON` document is sent as `application/json`, a multipart body as `multipart/form-data`, and key=value pairs as `application/x-www-form-urlencoded`, which stands for **urlencoded data**. Set the `content-type` header whenever the target expects a given type: for posting `JSON` data, specify `application/json`.

 [Python](#player-7b7321) [HTTP](#http-7b7321)

```
import requests

url = "https://api.scrapfly.io/scrape"

params = {
    "key": "__API_KEY__",
    "url": "https://httpbin.dev/post",
}

payload = "{\"example\":\"value\"}"
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.request("POST", url, params=params, data=payload, headers=headers)
# Raise exception for HTTP errors (4xx, 5xx)
response.raise_for_status()

data = response.json()
print(data)

# Access the scrape result
if 'result' in data:
    print(data['result'])

```

```
https://api.scrapfly.io/scrape?key=&url=https%3A%2F%2Fhttpbin.dev%2Fpost
```

 And here's a full example with for posting JSON and configuring the content-type header:

 [Python](#player-fbc10b) [HTTP](#http-fbc10b)

```
import requests

url = "https://api.scrapfly.io/scrape"

params = {
    "key": "__API_KEY__",
    "url": "https://httpbin.dev/post",
    "headers[content-type]": "application/json",
}

payload = "{\"example\":\"value\"}"
headers = {"Content-Type": "application/json"}
response = requests.request("POST", url, params=params, data=payload, headers=headers)
# Raise exception for HTTP errors (4xx, 5xx)
response.raise_for_status()

data = response.json()
print(data)

# Access the scrape result
if 'result' in data:
    print(data['result'])

```

```
https://api.scrapfly.io/scrape?key=&url=https%3A%2F%2Fhttpbin.dev%2Fpost&headers%5Bcontent-type%5D=application%2Fjson
```

 `PUT` requests are used to submit forms and upload user-created content. When using this method, if `content-type` header is not set explicitly, the API reads it from the body, as for `POST`: key=value pairs are sent as `application/x-www-form-urlencoded` (**urlencoded data**). For putting `JSON` data, specify `content-type: application/json` header.

```
import requests

url = "https://api.scrapfly.io/scrape"

params = {
    "key": "__API_KEY__",
    "url": "https://httpbin.dev/put",
    "headers[content-type]": "application/json",
}

payload = "{\"example\":\"value\"}"
headers = {"Content-Type": "application/json"}
response = requests.request("PUT", url, params=params, data=payload, headers=headers)
# Raise exception for HTTP errors (4xx, 5xx)
response.raise_for_status()

data = response.json()
print(data)

# Access the scrape result
if 'result' in data:
    print(data['result'])

```

 `PATCH` requests are used to submit forms and update user-created content. When using this method, if `content-type` header is not set explicitly, the API reads it from the body, as for `POST`: key=value pairs are sent as `application/x-www-form-urlencoded` (**urlencoded data**). For patching `JSON` data, specify `content-type: application/json` header.

```
import requests

url = "https://api.scrapfly.io/scrape"

params = {
    "key": "__API_KEY__",
    "url": "https://httpbin.dev/put",
    "headers[content-type]": "application/json",
}

payload = "{\"example\":\"value\"}"
headers = {"Content-Type": "application/json"}
response = requests.request("PATCH", url, params=params, data=payload, headers=headers)
# Raise exception for HTTP errors (4xx, 5xx)
response.raise_for_status()

data = response.json()
print(data)

# Access the scrape result
if 'result' in data:
    print(data['result'])

```

 `HEAD` requests are used to retrieve page metadata like response headers and status codes without fetching the content. When `HEAD` method is used, headers of the upstream website are directly forwarded to the API response. This means that Scrapfly response headers match the headers of the scraped website.

> **`HEAD` do not follow redirections**, if you want so, you must retrieve the `Location` header and make a new request to that URL.
>
>  **NOTE:** The URL in location header is not always absolute, it can also be relative. Handle it accordingly.

```
import requests

url = "https://api.scrapfly.io/scrape"

params = {
    "key": "__API_KEY__",
    "url": "https://httpbin.dev/head",
}

response = requests.request("HEAD", url, params=params)
# Raise exception for HTTP errors (4xx, 5xx)
response.raise_for_status()

data = response.json()
print(data)

# Access the scrape result
if 'result' in data:
    print(data['result'])

```

## Headers

 Request headers sent by Scrapfly can be customized through the [headers](https://scrapfly.io/docs/scrape-api/getting-started?language=python#api_param_headers) parameter. Note that the value of headers must be [urlencoded](https://www.w3schools.com/tags/ref_urlencode.ASP) once, as part of the query string, to prevent any side effects. When in doubt, use Scrapfly's [url encoding web tool](https://scrapfly.io/web-scraping-tools/urlencode "URL encode"). An HTTP client that already urlencodes query parameters (the Scrapfly SDKs, `requests`, `httpx`, `URLSearchParams`) takes the plain header value: a value encoded beforehand is encoded twice and reaches the website with its percent signs.

 [Python](#player-1500d5) [HTTP](#http-1500d5)

```
import requests

url = "https://api.scrapfly.io/scrape"

params = {
    "key": "__API_KEY__",
    "url": "https://httpbin.dev/headers",
    "headers[foo]": "bar",
}

response = requests.request("GET", url, params=params)
# Raise exception for HTTP errors (4xx, 5xx)
response.raise_for_status()

data = response.json()
print(data)

# Access the scrape result
if 'result' in data:
    print(data['result'])

```

```
https://api.scrapfly.io/scrape?key=&url=https%3A%2F%2Fhttpbin.dev%2Fheaders&headers%5Bfoo%5D=bar
```

 *You can also pass multiple time the same header e.g: `headers[X-foo][0]=bar&headers[X-foo][1]=baz` and the order order and structure will be replicated*

 By default, **Scrapfly** handles most default and basic headers to replicate a real web browser so you don't need to set User-Agent or other basic headers manually. You learn more about headers in [this dedicated article](https://scrapfly.io/blog/posts/how-to-avoid-web-scraping-blocking-headers)

> When the [Unblocker](https://scrapfly.io/docs/scrape-api/unblocker?language=python) is enabled, **headers are fine-tuned** on target you scrape is also done at header level to **maximize your success rate**

Important headers to keep in mind in web scraping context:

### Content-Type

 Specifies the media type of the resource being sent in the HTTP message body. It tells the recipient what kind of data to expect and how to interpret it. The Content-Type header is typically used in HTTP requests and responses, particularly in responses from servers to clients.

 Example, sending a `POST` request with a body of `JSON` data, you must specify `application/json`.

 By default, if you send a POST request without `Content-Type` header, `application/x-www-form-urlencoded` will be set.

> If this Header is not correctly configured, the target website respond with a `400, 406` or block you

### Accept

 Indicates the media types that the client is willing to receive in the response. Helps servers determine the appropriate representation of the requested resource.

 Default mimics a real web browser.

 Example for a JSON API expecting a response in JSON: `Accept: application/json`

> If this Header is not correctly configured, the target website respond with a `400` or block you

### Referer

 Indicates the URL of the web page from which the request originated. Often used by servers to track the source of incoming requests.

 By default, this header is not sent if not specified

 Example: `Referer: https://www.web-scraping.dev/page1.html`

> This header can be mutated while using the Unblocker feature

### Behavior And Interaction With Other Features

When the [Unblocker is activated](https://scrapfly.io/docs/scrape-api/getting-started?language=python#api_param_unblocker) or a specific [os](https://scrapfly.io/docs/scrape-api/getting-started?language=python#api_param_os) is set, following headers become immutable or limited

- `user-agent`: If you set a custom chrome user agent, it will be ignored to keep our actual version. With the Unblocker, it chooses the desktop operating system of the browser we send (Windows, macOS or Linux), and a Chrome user agent of a phone or a tablet (Android) gives a desktop browser, never a mobile one: to scrape the mobile version of a website, set the [os](https://scrapfly.io/docs/scrape-api/getting-started?language=python#api_param_os) parameter and no custom `user-agent`. The user agent of a phone or a tablet that is not Chrome's, such as Safari on an iPhone, is not replaced
- `sec-ch-ua`: Ignored
- `sec-ch-ua-arch`: Ignored
- `sec-ch-ua-platform`: Ignored
- `sec-ch-ua-platform-version`: Ignored
- `sec-ch-ua-full-version`: Ignored
- `sec-ch-ua-bitness`: Ignored

With the [Unblocker activated](https://scrapfly.io/docs/scrape-api/getting-started?language=python#api_param_unblocker), referer header is auto handled if no header set. However on specific target you might want to disable this. Setting `referer` header to `none` will prevent it

 With [JavaScript rendering](https://scrapfly.io/docs/scrape-api/getting-started?language=python#api_param_render_js) enabled, and when the [Unblocker](https://scrapfly.io/docs/scrape-api/getting-started?language=python#api_param_unblocker) loads the page in a headless browser (it can do so with `render_js` off), only the `Cookie` and `Referer` headers you set are guaranteed to be sent. Your other custom headers, such as an API key or an `Authorization` header, are not guaranteed on browser requests: do not rely on them there. Requests made without a browser send the headers you set, within the limits listed above.

## Cookies

 Cookies are regaular HTTP [headers](https://scrapfly.io/docs/scrape-api/getting-started?language=python#api_param_headers) and shouldn't be treated in a special way. While most HTTP clients and libraries have a dedicated API to manage cookies, to manage cookies with Scrapfly API simply set the appropriate headers.

### Set-Cookie

 This header should never be sent from the client’s side. It's a response header sent when upstream wants to register a cookie with the client.

### Cookie

 This header contains the cookie values held by the client. So, when scraping this should be used to include cookie data. The `Cookie` header contains key-to-value pairs of data separated by semicolons. For example:

- Single cookie: `Cookie: test=1`
- Multiple cookie: `Cookie: test=1;lang=fr;currency=USD`

> You can also pass multiple `Cookie` headers to send multiple time the cookie headers Example: `headers[Cookie][0]=foo%3Dbar&headers[Cookie][1]=bar%3Dbaz`
>
> ```
> Cookie: foo=bar
> Cookie: bar=baz
> ```
>
>
>
>
>
>
>
>
>
>   *Note: `%3D` is the [urlencoded](https://scrapfly.io/web-scraping-tools/urlencode) version of `=`, do not forget to [urlencode](https://scrapfly.io/web-scraping-tools/urlencode) the header value to not conflict with the actual url structure. Otherwise inside cookie value `=` would be interpreted as query params of the url.*

 [Python](#player-e63b86) [HTTP](#http-e63b86)

```
import requests

url = "https://api.scrapfly.io/scrape"

params = {
    "key": "__API_KEY__",
    "url": "https://httpbin.dev/cookies",
    "headers[cookie]": "lang=fr;currency=USD;test=1",
}

response = requests.request("GET", url, params=params)
# Raise exception for HTTP errors (4xx, 5xx)
response.raise_for_status()

data = response.json()
print(data)

# Access the scrape result
if 'result' in data:
    print(data['result'])

```

```
https://api.scrapfly.io/scrape?key=&url=https%3A%2F%2Fhttpbin.dev%2Fcookies&headers%5Bcookie%5D=lang%3Dfr%3Bcurrency%3DUSD%3Btest%3D1
```

## Geo Targeting

 Each Scrapfly request can be sent from a specific country. This is called Geo-Targetting and is managed by Scrapfly's proxy network.

 The desired country can be specified 2-letter country codes ([ISO 3166-1 alpha-2](https://fr.wikipedia.org/wiki/ISO_3166-1_alpha-2)). Available countries are defined on the [proxy pool](https://scrapfly.io/dashboard/proxy/scraper-api) dashboard. If the country is not available in the **Public Pool** a personal private pool can be created with desired countries. Note that restricting countries also restricts the available proxy IP pool.

 To specify geo targetting the [country](https://scrapfly.io/docs/scrape-api/getting-started?language=python#api_param_country) parameter can be used:

- Single country selection: `country=us`
- Multi country selection, one of them is drawn and the country of the website's domain comes first when it is in the list: `country=us,ca,mx`
- Country exclusion: `country=-gb`

 For example, to send request through the United States the `country=us` would be used:

 [Python](#player-69b896) [HTTP](#http-69b896)

```
import requests

url = "https://api.scrapfly.io/scrape"

params = {
    "country": "us",
    "key": "__API_KEY__",
    "url": "https://httpbin.dev/anything",
}

response = requests.request("GET", url, params=params)
# Raise exception for HTTP errors (4xx, 5xx)
response.raise_for_status()

data = response.json()
print(data)

# Access the scrape result
if 'result' in data:
    print(data['result'])

```

```
https://api.scrapfly.io/scrape?country=us&key=&url=https%3A%2F%2Fhttpbin.dev%2Fanything
```

> For more on proxies, see the [proxy documentation page](https://scrapfly.io/docs/scrape-api/proxy?language=python)

 For spoofing the latitude and longitude of web browser's location services, the [geolocation](https://scrapfly.io/docs/scrape-api/getting-started?language=python#api_param_geolocation) parameter can be used, for example: `geolocation=48.856614,2.3522219` (latitude, longitude):

 [Python](#player-dd4559) [HTTP](#http-dd4559)

```
import requests

url = "https://api.scrapfly.io/scrape"

params = {
    "key": "__API_KEY__",
    "url": "https://httpbin.dev/anything",
}

response = requests.request("GET", url, params=params)
# Raise exception for HTTP errors (4xx, 5xx)
response.raise_for_status()

data = response.json()
print(data)

# Access the scrape result
if 'result' in data:
    print(data['result'])

```

```
https://api.scrapfly.io/scrape?key=&url=https%3A%2F%2Fhttpbin.dev%2Fanything
```

 The available country options depend on the selected [proxy\_pool](https://scrapfly.io/docs/scrape-api/getting-started?language=python#api_param_proxy_pool). See this table for available options for your account:

- [ `public_datacenter_pool` ](#pool-public_datacenter_pool)
- [ `public_residential_pool` ](#pool-public_residential_pool)
- [ `public_tor_pool` ](#pool-public_tor_pool)

- **AE** - United Arab Emirates
- **AR** - Argentina
- **AT** - Austria
- **AU** - Australia
- **BD** - Bangladesh
- **BE** - Belgium
- **BG** - Bulgaria
- **BO** - Bolivia
- **BR** - Brazil
- **BY** - Belarus
- **CA** - Canada
- **CH** - Switzerland
- **CL** - Chile
- **CN** - China
- **CO** - Colombia
- **CR** - Costa Rica
- **CY** - Cyprus
- **CZ** - Czechia
- **DE** - Germany
- **DK** - Denmark
- **EC** - Ecuador
- **EE** - Estonia
- **EG** - Egypt
- **ES** - Spain
- **FI** - Finland
- **FR** - France
- **GB** - United Kingdom
- **GE** - Georgia
- **GR** - Greece
- **HK** - Hong Kong SAR China
- **HR** - Croatia
- **HU** - Hungary
- **ID** - Indonesia
- **IE** - Ireland
- **IL** - Israel
- **IN** - India
- **IT** - Italy
- **JO** - Jordan
- **JP** - Japan
- **KH** - Cambodia
- **KR** - South Korea
- **LT** - Lithuania
- **LV** - Latvia
- **MA** - Morocco
- **MX** - Mexico
- **MY** - Malaysia
- **NL** - Netherlands
- **NO** - Norway
- **NZ** - New Zealand
- **PA** - Panama
- **PE** - Peru
- **PH** - Philippines
- **PK** - Pakistan
- **PL** - Poland
- **PT** - Portugal
- **RO** - Romania
- **RU** - Russia
- **SA** - Saudi Arabia
- **SE** - Sweden
- **SG** - Singapore
- **SK** - Slovakia
- **TH** - Thailand
- **TM** - Turkmenistan
- **TR** - Türkiye
- **TW** - Taiwan
- **UA** - Ukraine
- **US** - United States
- **UZ** - Uzbekistan
- **VN** - Vietnam
- **ZA** - South Africa

- **AE** - United Arab Emirates
- **AR** - Argentina
- **AT** - Austria
- **AU** - Australia
- **BD** - Bangladesh
- **BE** - Belgium
- **BG** - Bulgaria
- **BO** - Bolivia
- **BR** - Brazil
- **BY** - Belarus
- **CA** - Canada
- **CH** - Switzerland
- **CL** - Chile
- **CN** - China
- **CO** - Colombia
- **CR** - Costa Rica
- **CY** - Cyprus
- **CZ** - Czechia
- **DE** - Germany
- **DK** - Denmark
- **EC** - Ecuador
- **EE** - Estonia
- **EG** - Egypt
- **ES** - Spain
- **FI** - Finland
- **FR** - France
- **GB** - United Kingdom
- **GE** - Georgia
- **GR** - Greece
- **HK** - Hong Kong SAR China
- **HN** - Honduras
- **HR** - Croatia
- **HU** - Hungary
- **ID** - Indonesia
- **IE** - Ireland
- **IL** - Israel
- **IN** - India
- **IQ** - Iraq
- **IT** - Italy
- **JO** - Jordan
- **JP** - Japan
- **KH** - Cambodia
- **KR** - South Korea
- **LT** - Lithuania
- **LV** - Latvia
- **MA** - Morocco
- **MG** - Madagascar
- **MN** - Mongolia
- **MX** - Mexico
- **MY** - Malaysia
- **NG** - Nigeria
- **NL** - Netherlands
- **NO** - Norway
- **NZ** - New Zealand
- **PA** - Panama
- **PE** - Peru
- **PH** - Philippines
- **PK** - Pakistan
- **PL** - Poland
- **PT** - Portugal
- **RO** - Romania
- **RU** - Russia
- **SA** - Saudi Arabia
- **SE** - Sweden
- **SG** - Singapore
- **SK** - Slovakia
- **TH** - Thailand
- **TM** - Turkmenistan
- **TN** - Tunisia
- **TR** - Türkiye
- **TW** - Taiwan
- **UA** - Ukraine
- **US** - United States
- **UZ** - Uzbekistan
- **VE** - Venezuela
- **VN** - Vietnam
- **ZA** - South Africa

- **AT** - Austria
- **BG** - Bulgaria
- **CA** - Canada
- **CH** - Switzerland
- **CZ** - Czechia
- **DE** - Germany
- **DK** - Denmark
- **ES** - Spain
- **FI** - Finland
- **FR** - France
- **GB** - United Kingdom
- **HU** - Hungary
- **IT** - Italy
- **LU** - Luxembourg
- **NL** - Netherlands
- **NO** - Norway
- **RO** - Romania
- **RS** - Serbia
- **SE** - Sweden
- **SG** - Singapore
- **US** - United States

## Language

 Content language can be configured through the [lang](https://scrapfly.io/docs/scrape-api/getting-started?language=python#api_param_lang) parameter. By default the language is inferred from the proxy location. So, if proxy of France is used the scrape request will be configured with french language preferences.

 Behind the scenes, this is done by configuring the `Accept-Language` HTTP header. If the website supports this header and the requested language, the content will be returned in that language.

 Multiple language options can be passed as well by providing multiple comma-separated values. Country locale is also supported in `{lang iso2}-{country iso2}` format. Note that the order matters as the website will negotiate the content language based on this order. Each value is a language tag without `;q=` weights, and `lang` cannot be sent together with an `Accept-Language` header (the API answers a 400).

 For example, `lang=fr,en-US,en` will result in final header `Accept-Language: fr-{proxy country iso2},fr;q=0.9,en-US;q=0.8,en;q=0.7`

> Most users prefer English regardless of the proxy location. For that, use `lang=en-US,en`

 [Python](#player-5ec952) [HTTP](#http-5ec952)

```
import requests

url = "https://api.scrapfly.io/scrape"

params = {
    "lang": "en-us,en",
    "key": "__API_KEY__",
    "url": "https://httpbin.dev/anything",
}

response = requests.request("GET", url, params=params)
# Raise exception for HTTP errors (4xx, 5xx)
response.raise_for_status()

data = response.json()
print(data)

# Access the scrape result
if 'result' in data:
    print(data['result'])

```

```
https://api.scrapfly.io/scrape?lang=en-us%2Cen&key=&url=https%3A%2F%2Fhttpbin.dev%2Fanything
```

##  Operating System

> We do not recommend using this feature unless it's absolutely necessary as it can impact scraper blocking rates.

 By default, Scrapfly automatically selects the most suitable Operating System for all outgoing requests. To configure operating system explicitly the [os](https://scrapfly.io/docs/scrape-api/getting-started?language=python#api_param_os) parameter can be used.

 The supported values are: `win11,mac,linux`

### Mobile platforms

 The supported mobile values are: `android,iphone,ipad`

 A mobile value makes the browser a real phone or tablet as a whole, not only an operating system. The screen, device pixel ratio, GPU, core count and memory all belong to the same device. The user agent, client hints, fonts, voices and touch capabilities follow the same device.

| Browser brand | Supported `os` values |
|---|---|
| `chrome` | `win11`, `mac`, `linux`, `chromeos`, `android`, `iphone`, `ipad` |
| `edge` | `win11`, `android` |
| `brave` | `win11`, `mac`, `linux`, `chromeos`, `android` |
| `opera` | `win11`, `mac`, `linux`, `chromeos`, `android` |

> Brave and Opera on iOS are WebKit wrappers with their own user-agent shape, and Edge on iOS reports `EdgiOS` instead of `CriOS`. Those combinations are rejected rather than emitting an incoherent fingerprint. Use `chrome` for `iphone` and `ipad`.

 [Python](#player-bc0ea1) [HTTP](#http-bc0ea1)

```
import requests

url = "https://api.scrapfly.io/scrape"

params = {
    "os": "android",
    "key": "__API_KEY__",
    "url": "https://httpbin.dev/anything",
}

response = requests.request("GET", url, params=params)
# Raise exception for HTTP errors (4xx, 5xx)
response.raise_for_status()

data = response.json()
print(data)

# Access the scrape result
if 'result' in data:
    print(data['result'])

```

```
https://api.scrapfly.io/scrape?os=android&key=&url=https%3A%2F%2Fhttpbin.dev%2Fanything
```

> Because of potential conflicts, the `os` parameter and `User-Agent` header cannot be set at the same time.

> A custom Chrome `User-Agent` of a phone or a tablet (Android) does not give you the mobile version of a website: with the Unblocker, the browser we send is a desktop one. To scrape the mobile version, remove the custom `User-Agent` and set `os=android`, `os=iphone` or `os=ipad`.

 For example, to set Operating System to Windows 11 the `os=win11` parameter would be used:

 [Python](#player-187f1b) [HTTP](#http-187f1b)

```
import requests

url = "https://api.scrapfly.io/scrape"

params = {
    "os": "win11",
    "key": "__API_KEY__",
    "url": "https://httpbin.dev/anything",
}

response = requests.request("GET", url, params=params)
# Raise exception for HTTP errors (4xx, 5xx)
response.raise_for_status()

data = response.json()
print(data)

# Access the scrape result
if 'result' in data:
    print(data['result'])

```

```
https://api.scrapfly.io/scrape?os=win11&key=&url=https%3A%2F%2Fhttpbin.dev%2Fanything
```

## Integration

- [Geo Targeting example with Python SDK](https://scrapfly.io/docs/onboarding#proxy-country)
- [Request customization example with Python SDK](https://scrapfly.io/docs/onboarding#custom_request)
- [Request customization example with Typescript SDK](https://scrapfly.io/docs/onboarding#custom_request)
