# Countries, states and cities

> API routes to list the countries, states and cities available for each product.
> Page: https://rh7proxys.com/en/docs/api-locais · Index: https://rh7proxys.com/llms.txt

Use these routes to build the list of locations in your system and to find the codes that `PATCH /v1/proxies/{id}` accepts.

## Countries

```bash
curl "https://api.rh7proxys.com/v1/locations/countries?product=residential" \
  -H "Authorization: Bearer rh7k_your_key"
```

```json
{
  "success": true,
  "data": { "product": "residential", "countries": [{ "code": "br", "name": "Brazil" }, { "code": "us", "name": "United States" }] }
}
```

`product` accepts `residential` (default), `mobile` or `rotativa_cpa`.

## States

Residential Proxy and Mobile 4G/5G Proxy. Send `product=mobile` for the Mobile list.

```bash
curl "https://api.rh7proxys.com/v1/locations/states?country=br" \
  -H "Authorization: Bearer rh7k_your_key"
```

```json
{ "success": true, "data": { "product": "residential", "states": [{ "code": "sao paulo", "name": "São Paulo" }] } }
```

## Cities

Residential Proxy and Mobile 4G/5G Proxy. The state is optional.

```bash
curl "https://api.rh7proxys.com/v1/locations/cities?country=br&state=sao%20paulo" \
  -H "Authorization: Bearer rh7k_your_key"
```

```json
{ "success": true, "data": { "product": "residential", "cities": [{ "code": "campinas", "name": "Campinas" }] } }
```

## How to use the codes

Send the `code` of each item in the `PATCH`:

```json
{ "country": "BR", "state": "sao paulo", "city": "campinas" }
```

The country works in uppercase or lowercase. State and city go exactly as they came in the list.

Availability changes throughout the day. If a location has no IP, the `PATCH` responds with `NO_PROXIES_FOR_LOCATION` and the previous setting stays in effect.
