# Proxies

> Route a phone's traffic through your own proxy: save it once, check it, and point phones at it. Traffic through your proxy is counted but never charged.

Each phone reaches the internet through our mobile proxy network unless you route it through a proxy of your own. Save the proxy once, check it, then point phones at it. Apps on the phone see your proxy's address, and traffic through it is counted but never charged. A proxy's login is sealed when you save it and never shown again.

```bash
curl https://api.distilled.cx/v1/proxies \
  -H "Authorization: Bearer $DISTILLED_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "label": "Residential US", "url": "http://user:pass@proxy.example.com:8080" }'
```

## Endpoints

- `GET /v1/proxies` (scope `phones:read`): Your proxies, with each one's last check and how many phones use it, and whether moving a phone to a fresh exit on our network is available.
- `POST /v1/proxies` (scope `phones:write`): Saves `{ label, url, country? }`, where `url` is `http://` or `https://` with the login in it. Answers 201. Up to 50 per workspace.
- `POST /v1/proxies/{id}/check` (scope `phones:write`): Connects through the proxy the way a phone would, and keeps whether it answered, how fast, and the address and country it leaves from.
- `DELETE /v1/proxies/{id}` (scope `phones:write`): Removes a proxy. One a phone still uses answers `409 proxy-in-use`.
- `POST /v1/phones/{id}/egress` (scope `phones:write`): Routes the phone through a saved proxy with `{ "proxyId": "…" }`, or back to our network with `{ "proxyId": null }`. Whatever the phone has open closes, and it restarts when it goes on or off a proxy.
- `POST /v1/phones/{id}/egress/rotate` (scope `phones:write`): Moves the phone to a fresh exit on our network, in a `country` or `city` if you name one. Whatever the phone has open closes. Answers `503 exits-exhausted` when none is ready; try again later. If you named a city whose last vetting round found none clean, the body also has `"reason": "none-clean"`, so pick another city instead.

Source: https://distilled.cx/docs/proxies/
