> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nativeport.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nativeport.ai/_mcp/server.

# Scrapfly

Fronts the Web Scraping API of [Scrapfly](https://scrapfly.io); the gateway fills in the secret `key` parameter on the query string:

```
GET|POST|PUT|PATCH|HEAD /scrapfly   → https://api.scrapfly.io/scrape?key=<secret>&<your query>
```

Everything is driven by the **query string**: the target `url` plus any Scrapfly parameter (`asp`, `render_js`, `country`, `proxy_pool`, `format`, …). What you put there reaches Scrapfly exactly as written.

The **method of your request** becomes the method Scrapfly executes against the scraped URL — hence `GET`, `POST`, `PUT`, `PATCH`, `HEAD` all pass through. (`OPTIONS` is a CORS preflight, not a scrape — the gateway rejects it.)

## Credential handling

* **`key` goes in ahead of everything you send**, so it can't be swallowed by a target URL with incomplete encoding.
* **A `key` supplied by the client in the query is discarded** (any encoding), so nothing can displace the injected key.
* **`Authorization` is dropped** before the request goes upstream — your gateway token is meaningless to Scrapfly.

## Examples

#### Basic scrape

```bash
curl "$GATEWAY/scrapfly?url=https://example.com" \
  -H "Authorization: Bearer $TOKEN"
```

#### Render JS + anti-scraping protection

```bash
curl "$GATEWAY/scrapfly?url=https://example.com&render_js=true&asp=true&country=us" \
  -H "Authorization: Bearer $TOKEN"
```

Scrapfly's response comes back untouched. Every supported parameter is listed in [Scrapfly's documentation](https://scrapfly.io/docs/scrape-api/getting-started).