# Connection URL (/browser-api/connection-url)

## Format [#format]

```text
wss://<login>[-<modifier>-<value>...]:<password>@browser.runharvester.com
```

The connection uses port 443 over TLS only. Puppeteer's `puppeteer.connect({ browserWSEndpoint: url })` and Playwright's `chromium.connectOverCDP(url)` turn the userinfo part of the URL into an HTTP Basic `Authorization` header themselves.

- Credentials are accepted **only** from that header. A URL that carries a query string (`?...`) is refused with HTTP 400 `INVALID_CONNECTION_PARAMS`.
- The login is 20 random hexadecimal characters and is not related to your user. The password is 24 letters and digits, or a custom one of 16 to 64 letters and digits that you choose in the dashboard.
- Keep the URL secret: it contains the password.

## Modifiers [#modifiers]

Modifiers are appended to the login, each as `-<name>-<value>` (or `-captcha-auto`). The grammar is strict: an unknown, repeated, or invalid modifier is an error (`400 INVALID_CONNECTION_PARAMS`), never ignored. Modifiers can be in any order, except that `proxy` must be last.

| Modifier | Value | Meaning |
| --- | --- | --- |
| `country-<iso2>` | Two-letter country code, case-insensitive | Exit country, for example `country-de`. |
| `type-<kind>` | `datacenter`, `residential`, `own`, or `custom` | Proxy kind. `own` uses your own RunHarvester Node computers and proxy nodes. `custom` uses a proxy that you supply. |
| `pid-<profileId>` | 64 hexadecimal characters | Persistent profile. The id is signed and issued by the dashboard; a made-up id is refused with `400 INVALID_PROFILE_ID`. A signed id the server has not seen yet creates the profile on the first connection. |
| `session-<id>` | 1 to 64 letters, digits, or underscores | Names the session, so a dropped client can reconnect to the same browser and tabs within 60 seconds. |
| `ttl-<minutes>` | Integer from 0 to 120 | Sticky exit-IP time: keep the same exit address for up to this many minutes. The provider may release the address earlier. `ttl-0` or no `ttl` means no stickiness beyond the session itself. Applies to platform proxies and own nodes. |
| `proxy-<base64url>` | Base64url of a proxy URL | A customer proxy. Implies `type-custom`. Must be the last modifier. See [Customer proxy](#customer-proxy). |
| `captcha-auto` | none | Turn on automatic captcha solving for this session. See [Captcha](/browser-api/captcha). |

`type-custom` without a `proxy` modifier is refused with `400 INVALID_CONNECTION_PARAMS`.

## Priority [#priority]

When the same setting is given in several places, the first of these wins:

1. URL modifiers.
2. The profile's settings.
3. The browser account's settings.
4. The default, `datacenter`.

The browser never exits from RunHarvester's own address.

## Examples [#examples]

A bare URL uses the account's and profile's settings, or the defaults:

```text
wss://<login>:<password>@browser.runharvester.com
```

A German residential exit:

```text
wss://<login>-country-de-type-residential:<password>@browser.runharvester.com
```

A named session that keeps the same exit address for up to 30 minutes:

```text
wss://<login>-session-job42-ttl-30:<password>@browser.runharvester.com
```

A persistent profile in a chosen country:

```text
wss://<login>-country-us-pid-<64 hex characters>:<password>@browser.runharvester.com
```

A customer proxy (the `proxy` modifier is last):

```text
wss://<login>-country-de-proxy-<base64url of the proxy URL>:<password>@browser.runharvester.com
```

## Customer proxy [#customer-proxy]

The value of `proxy-` is the base64url encoding of a proxy URL. The proxy URL must use `http://`, `https://`, or `socks5://`, must include a port, and must not have a path. It must be reachable from the internet at a public address; otherwise the connection is refused with `503 PROXY_UNREACHABLE`.

<Tabs defaultValue="node">
<TabsList>
<TabsTrigger value="node">
Node.js
</TabsTrigger>

<TabsTrigger value="python">
Python
</TabsTrigger>
</TabsList>

<Tab value="node">
```javascript
const proxyUrl = "http://proxy-user:proxy-pass@203.0.113.10:8080";
const encoded = Buffer.from(proxyUrl).toString("base64url");

const url = `wss://${process.env.BROWSER_LOGIN}-proxy-${encoded}:${process.env.BROWSER_PASSWORD}@browser.runharvester.com`;
```
</Tab>

<Tab value="python">
```python
import base64
import os

proxy_url = "http://proxy-user:proxy-pass@203.0.113.10:8080"
encoded = base64.urlsafe_b64encode(proxy_url.encode()).decode().rstrip("=")

url = f"wss://{os.environ['BROWSER_LOGIN']}-proxy-{encoded}:{os.environ['BROWSER_PASSWORD']}@browser.runharvester.com"
```
</Tab>
</Tabs>

Proxy traffic is billed in the `custom_proxy` class. See [Billing](/browser-api/billing).

## Related [#related]

- [Profiles and sessions](/browser-api/profiles-and-sessions)
- [Errors and close codes](/browser-api/errors)