# Proxy usernames

The proxy username says which device should carry a request. The password is always the account's credential. `POST /app/api/proxy/spawn` prints usernames for you, and this page is the full grammar for writing one by hand.

```
<account>-<pool>-<country>[-<key>-<value>]...
```

A username is lowercase ASCII and at most 255 bytes. Each key appears once, in any order. A username outside the grammar is refused with `bad_options`: the cause names the token and the fix shows the username to send.

Fixed words: `any`, `best`, `peer`, `mbl`, `sid`, `rot`, `iptype`, `carrier`, `asn`, `state`, `city`, `failover`, `pin-device`, `auto5`, `auto10`, `auto20`, `auto60`, `sticky`, `hard`, `mobile`, `residential`, `datacenter`, `isp`, `none`.

| Part | Values | Meaning |
| --- | --- | --- |
| account | 32 hex digits | The account id without dashes. It must be the account of the credential. |
| pool | `any`, `best`, `peer` | The peer network. `mbl` (carrier modems) is recorded as demand and answered `on_request`. |
| country | two letters, or `any` | The measured exit country. |
| `sid-<id>` | 1 to 64 of `a-z`, `0-9`, `_` | A session key. The same key reaches the same device while that device stays in the pool. |
| `rot-<mode>` | `auto5`, `auto10`, `auto20`, `auto60`, `sticky` | How many minutes a session stays on one device. It needs `sid`, and `auto10` applies when it is left out. `hard` means `sticky`. |
| `iptype-<class>` | `mobile`, `residential` | The IP class. `datacenter` and `isp` are recorded as demand and answered `on_request`. |
| `carrier-<slug>` | a slug from the stock | One carrier. |
| `asn-<number>` | 1 to 4294967295 | One network by its AS number. |
| `state-<code>`, `city-<slug>` | from the stock | A region or a city. Both need a country. |
| `failover-none` | | One attempt, with no second device. |
| `pin-device-<name>` | the rest of the username | Your own named device. It takes country `any` and no other key. |

A username takes at most one of `iptype`, `carrier` and `asn`. With `city` the only network key is `iptype`.

Examples, for the account `0123456789abcdef0123456789abcdef`:

- `0123456789abcdef0123456789abcdef-peer-de` picks any device in Germany for each request.
- `0123456789abcdef0123456789abcdef-peer-us-state-ca-sid-job_1-rot-sticky` keeps session `job_1` on one device in California.
- `0123456789abcdef0123456789abcdef-any-any-pin-device-my-phone` uses your own device named `my-phone`.

Read the carriers, states and cities that exist with `GET /app/api/proxy/stock?country=<code>`. A value with no device online is on request: the demand is recorded and the username works once supply arrives.
