> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrapeunblocker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# cURL

> Copy-paste cURL commands for all three endpoints.

The simplest way to test ScrapeUnblocker. Drop these into a terminal, replace `YOUR_API_KEY`, and you're scraping.

## Fetch page HTML

```bash theme={null}
curl -X POST "https://api.scrapeunblocker.com/getPageSource?url=https://example.com" \
  -H "x-scrapeunblocker-key: YOUR_API_KEY"
```

## Fetch page HTML through a specific country

```bash theme={null}
curl -X POST "https://api.scrapeunblocker.com/getPageSource?url=https://example.com&proxy_country=de" \
  -H "x-scrapeunblocker-key: YOUR_API_KEY"
```

## Get parsed JSON instead of HTML

```bash theme={null}
curl -X POST "https://api.scrapeunblocker.com/getPageSource?url=https://www.amazon.com/dp/B08N5WRWNW&parsed_data=true" \
  -H "x-scrapeunblocker-key: YOUR_API_KEY"
```

## Get HTML + cookies + the proxy address used

```bash theme={null}
curl -X POST "https://api.scrapeunblocker.com/getPageSource?url=https://example.com&get_cookies=true" \
  -H "x-scrapeunblocker-key: YOUR_API_KEY"
```

## Run browser steps, then return the HTML

Fill a search form, submit it, wait for results. `steps` is a URL-encoded JSON
array, so pass it with `--data-urlencode` and `-G`:

```bash theme={null}
curl -X POST "https://api.scrapeunblocker.com/getPageSource" \
  -H "x-scrapeunblocker-key: YOUR_API_KEY" \
  -G \
  --data-urlencode "url=https://example.com" \
  --data-urlencode 'steps=[{"action":"type","selector":"input[name=q]","value":"headphones"},{"action":"press_key","value":"Enter"},{"action":"wait_for","selector":".search-results"}]'
```

## Discover the interactive elements first

`list_elements=true` returns the page's inputs, buttons and links as JSON, each
with a ready-to-use `selector` for `steps`:

```bash theme={null}
curl -X POST "https://api.scrapeunblocker.com/getPageSource?url=https://example.com&list_elements=true" \
  -H "x-scrapeunblocker-key: YOUR_API_KEY"
```

See the [browser steps guide](/guides/browser-steps) for the full action list.

## Scrape a Google SERP

```bash theme={null}
curl -X POST "https://api.scrapeunblocker.com/serpApi?keyword=best+running+shoes" \
  -H "x-scrapeunblocker-key: YOUR_API_KEY"
```

## Scrape multiple SERP pages from a specific country

```bash theme={null}
curl -X POST "https://api.scrapeunblocker.com/serpApi?keyword=pizza&pages_to_check=3&proxy_country=it" \
  -H "x-scrapeunblocker-key: YOUR_API_KEY"
```

## Fetch a single image as PNG

```bash theme={null}
curl -X POST "https://api.scrapeunblocker.com/getImage?url=https://example.com/photo.jpg" \
  -H "x-scrapeunblocker-key: YOUR_API_KEY" \
  --output photo.png
```

## Bash one-liner with API key from environment

```bash theme={null}
export SCRAPEUNBLOCKER_KEY="su_live_..."
curl -X POST "https://api.scrapeunblocker.com/getPageSource?url=https://example.com" \
  -H "x-scrapeunblocker-key: $SCRAPEUNBLOCKER_KEY"
```

## URL-encoding parameter values

cURL does not URL-encode for you. If your `url` parameter contains special characters (`&`, `?`, `=`, spaces), encode them or wrap them with `--data-urlencode`:

```bash theme={null}
curl -X POST "https://api.scrapeunblocker.com/getPageSource" \
  -H "x-scrapeunblocker-key: $SCRAPEUNBLOCKER_KEY" \
  --data-urlencode "url=https://example.com/path?foo=bar&baz=qux" \
  -G
```

`-G` tells cURL to convert `--data-urlencode` into query-string parameters while still using `POST`.
