# Client API: overview

> API address, rh7k_ key, read, write and purchase permissions, IP list per key and response format.
> Page: https://rh7proxys.com/en/docs/api · Index: https://rh7proxys.com/llms.txt

The client API lets your system do what you do in the panel: buy proxies, get credentials, change location and session, top up and track usage. It works for any RH7 customer, with no special plan.

## Address

```text
https://api.rh7proxys.com/v1
```

All routes start with `/v1`. Responses are JSON in UTF-8.

## API key

Create the key in the panel, under **API > API Keys**. It starts with `rh7k_` and is shown only once: store it in a password manager or in an environment variable. Each account can have up to 5 active keys.

Send the key on every call, in one of these ways:

```http
Authorization: Bearer rh7k_your_key
```

```http
x-api-key: rh7k_your_key
```

Never put the key in the URL or in code that runs in your customer's browser.

## Permissions

Each key has one permission. Give it the lowest one that covers your case.

| Permission | What it allows |
|---|---|
| Read | View proxies, balance, usage, orders and locations |
| Write | Everything in Read, plus changing location, session, blocked websites and allowed IPs |
| Purchases | Everything above, plus buying proxies and topping up GB. This creates charges. |

Without the right permission, the API responds with `403 INSUFFICIENT_SCOPE`.

## Key IP list

When you create the key, you can add up to 20 IPs or ranges (e.g. `203.0.113.0/24`). With the list filled in, the key only works from those addresses. Calls from another IP get `403 IP_NOT_ALLOWED`. An empty list allows any IP.

Always use the list when the key has the **Purchases** permission.

## Expiration

The key can have an expiration date. After that date, the API responds with `401 EXPIRED_API_KEY`. To revoke it earlier, deactivate the key in the panel.

## Response format

Success:

```json
{ "success": true, "data": { } }
```

Error:

```json
{ "success": false, "error": "PROXY_NOT_FOUND", "message": "Proxy não encontrado ou não pertence à sua conta." }
```

The `error` field is a fixed code, useful for your program to decide what to do. The `message` is for people and can change. The full list is in [Errors, limits and idempotency](https://rh7proxys.com/en/docs/api-erros).

## Route map

| Method | Route | What for | Permission |
|---|---|---|---|
| GET | `/v1/auth/me` | Details of the account that owns the key | Read |
| GET | `/v1/products` | Products, price tiers and bonus | Read |
| GET | `/v1/quote` | Exact quote for an order | Read |
| POST | `/v1/orders` | Buy a proxy | Purchases |
| GET | `/v1/orders` | List orders | Read |
| GET | `/v1/orders/{id}` | Order status | Read |
| GET | `/v1/proxies` | List proxies | Read |
| GET | `/v1/proxies/{id}/settings` | Balance and settings | Read |
| GET | `/v1/proxies/{id}/credentials` | Address, ports, username and password | Read |
| PATCH | `/v1/proxies/{id}` | Change name, location, session and blocked websites | Write |
| POST | `/v1/proxies/{id}/recharge` | Top up GB | Purchases |
| POST | `/v1/proxies/{id}/whitelist` | Allow an IP | Write |
| DELETE | `/v1/proxies/{id}/whitelist/{ip}` | Remove an allowed IP | Write |
| GET | `/v1/proxies/{id}/usage` | Usage by period | Read |
| GET | `/v1/wallet/recharges` | Top-up history | Read |
| GET | `/v1/locations/countries` | Countries | Read |
| GET | `/v1/locations/states` | States | Read |
| GET | `/v1/locations/cities` | Cities | Read |

## Quick test

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

```json
{
  "success": true,
  "data": { "user_id": "uuid", "full_name": "Maria Souza", "api_key_label": "Produção", "proxies_count": 2 }
}
```

To test without writing code, download the [Postman collection](https://rh7proxys.com/en/docs/postman) or use the API explorer inside the panel.
