> 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.

# Bright Data

Fronts the direct API of [Bright Data](https://brightdata.com) — a single endpoint serving two products, **Web Unlocker** and **SERP API**:

```
POST /brightdata   → https://api.brightdata.com/request
```

Only `POST` is mounted. All controls — `{zone, url, format, …}` — go in the JSON body; which of the two products handles the call is decided by the `zone` field rather than the path.

## Automatic `zone` injection

A `zone` names the Web Unlocker / SERP zone configured on the account — a value scoped to that account, which you can't know in advance. The gateway therefore **fills it in whenever your body leaves it out**, so `{url, format}` alone is a valid call to `/brightdata`:

* A body **without** `zone` gets the configured zone added.
* A body **carrying** `zone` is left alone — your value wins.

## Credential handling

Bright Data takes its key in `Authorization: Bearer` — the very header carrying your gateway token — so the gateway **replaces** that header with the Bright Data key:

* **`Authorization` is overwritten with Bright Data's secret key.** Your gateway token stops at the gateway and never travels upstream.
* No query-param form of the key exists on Bright Data's side, so nothing gets removed from the query string.

## Responses

Whatever Bright Data returns streams through **unmodified**. Under `format: "raw"` that means the target site's raw bytes — HTML, JSON, occasionally binary — forwarded exactly as received.

## Example

```bash
curl -X POST "$GATEWAY/brightdata" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "format": "raw"}'
```

The reply is Bright Data's own, passed along untouched. Field-level request and response detail lives in [Bright Data's documentation](https://docs.brightdata.com); the gateway modifies neither.