# Manage proxies

> List proxies, get credentials, change location and session, block websites, allow IPs, top up GB and view usage.
> Page: https://rh7proxys.com/en/docs/api-proxies · Index: https://rh7proxys.com/llms.txt

These routes handle the proxies that are already in your account. In all of them, `{id}` is the proxy number, which shows up in `GET /v1/proxies` as `subuser_id` and in the delivered order as `proxy_id`.

## List proxies

```bash
curl https://api.rh7proxys.com/v1/proxies \
  -H "Authorization: Bearer rh7k_your_key"
```

```json
{
  "success": true,
  "data": {
    "proxies": [
      { "subuser_id": 12345, "login": "rh7user_ab12", "label": "Principal", "product": "residential", "product_name": "Proxy Residencial" }
    ]
  }
}
```

## Balance and settings

`GET /v1/proxies/{id}/settings` shows the remaining GB and everything that is configured.

```json
{
  "success": true,
  "data": {
    "proxy_id": 12345, "username": "rh7user_ab12", "label": "Principal",
    "product": "residential", "remaining_gb": 7.42,
    "settings": { "country": "BR", "state": "sao paulo", "city": null, "mode": "sticky", "session_minutes": 30, "blocked_hosts": [], "allowed_ips": [] }
  }
}
```

## Credentials

`GET /v1/proxies/{id}/credentials` returns the address, ports, username and password.

```json
{
  "success": true,
  "data": {
    "proxy_id": 12345, "mode": "rotating", "format": "json",
    "credentials": { "host": "auto-rh7proxys.com", "username": "rh7user_ab12", "password": "your_password", "http_port": 823, "socks5_port": 824, "sticky_port_start": 10000 }
  }
}
```

Use `?format=` to get the ready-made line:

| format | Example |
|---|---|
| `json` (default) | Object above |
| `host_port_user_pass` | `auto-rh7proxys.com:823:username:password` |
| `user_pass_host_port` | `username:password@auto-rh7proxys.com:823` |
| `url` | `http://username:password@auto-rh7proxys.com:823` |

The response includes the password. Do not save this response in logs.

## Configure the proxy

`PATCH /v1/proxies/{id}` changes only what you send. It requires the **Write** permission.

| Field | What it does |
|---|---|
| `label` | Proxy name in the panel (up to 60 characters) |
| `country` | Country with 2 letters, e.g. `BR` |
| `state` | State (Residential Proxy and Mobile 4G/5G Proxy) |
| `city` | City (Residential Proxy and Mobile 4G/5G Proxy, requires state) |
| `session_minutes` | Sticky session from 1 to 120 minutes. `null` goes back to rotating. |
| `blocked_hosts` | Full list of blocked websites (up to 100). Accepts `*.dominio.com`. |

```bash
curl -X PATCH https://api.rh7proxys.com/v1/proxies/12345 \
  -H "Authorization: Bearer rh7k_your_key" \
  -H "Content-Type: application/json" \
  -d '{"label": "Loja 1", "country": "BR", "session_minutes": 10, "blocked_hosts": ["facebook.com"]}'
```

Rules: changing the country clears the state and city. Rotativa CPA accepts only country. On the Mobile 4G/5G Proxy, state and city work where mobile IPs exist. Rotativa CPA has no sticky session. If the location has no IP, the response is `409 NO_PROXIES_FOR_LOCATION` and nothing changes.

## Top up

`POST /v1/proxies/{id}/recharge` adds GB to the same proxy. It requires the **Purchases** permission and the `Idempotency-Key` header.

```bash
curl -X POST https://api.rh7proxys.com/v1/proxies/12345/recharge \
  -H "Authorization: Bearer rh7k_your_key" \
  -H "Idempotency-Key: 0b9e7a52-1c44-4d1e-8f0a-5a3e6c2d9b17" \
  -H "Content-Type: application/json" \
  -d '{"gb": 10}'
```

A top-up through the API is paid by Pix, at the table price, with no coupon and no bonus. Ranking discounts and top-up bonuses are only in the panel. The response includes the order and the Pix, just like a purchase. Check the payment at `GET /v1/orders/{id}`.

## Allowed IPs

Allows an IPv4 to use the proxy without a username and password (see [Username and password or allowed IP](https://rh7proxys.com/en/docs/autenticacao-proxy)).

```bash
# Allow
curl -X POST https://api.rh7proxys.com/v1/proxies/12345/whitelist \
  -H "Authorization: Bearer rh7k_your_key" \
  -H "Content-Type: application/json" \
  -d '{"ip": "203.0.113.10"}'

# Remove
curl -X DELETE https://api.rh7proxys.com/v1/proxies/12345/whitelist/203.0.113.10 \
  -H "Authorization: Bearer rh7k_your_key"
```

Both return the current list in `allowed_ips`.

## Usage

`GET /v1/proxies/{id}/usage?period=week` shows usage for the period: `day`, `week` (default), `month` or `year`.

## Top-up history

`GET /v1/wallet/recharges?limit=20` lists the account's latest top-ups, with the amount paid, GB and bonus.
