> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/products/pt-br/proxies/dedicated-isp-proxies/enterprise/restful.md).

# Whitelist de IPs (RESTful)

Adicione IPs à lista de permissões enviando consultas diretamente para nossos endpoints.

{% hint style="info" %}
Observe que há um tempo de espera de 5 minutos para confirmar alterações na sua lista de IPs permitidos.
{% endhint %}

## Obtendo lista de IPs permitidos

`GET https://api.oxylabs.io/v1/whitelisted_ips`

| Resposta | Descrição                                                                                      |
| -------- | ---------------------------------------------------------------------------------------------- |
| `200`    | Sucesso. O corpo da resposta contém todos os IPs atualmente na lista de permissões e seus IDs. |

#### Exemplo de código

{% tabs %}
{% tab title="cURL" %}

```shell
curl -u username:password "https://api.oxylabs.io/v1/whitelisted_ips"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.oxylabs.io/v1/whitelisted_ips");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERPWD, 'username:password');

$result = curl_exec($curl);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
requests.get('https://api.oxylabs.io/v1/whitelisted_ips', auth=('username', 'password'))
```

{% endtab %}
{% endtabs %}

#### Saída de exemplo

```json
{
    "data": [
        {
            "id": 9765,
            "address": "127.0.0.1"
        },
        {
            "id": 9766,
            "address": "127.0.0.2"
        }
    ]
}
```

## Adicionando um IP permitidos

`POST https://api.oxylabs.io/v1/whitelisted_ips`

| Resposta | Descrição                                                                                                 |
| -------- | --------------------------------------------------------------------------------------------------------- |
| `201`    | Sucesso. O endereço IP foi adicionado à lista. O corpo da resposta contém o novo `endereço` e `id`.       |
| `422`    | Erro. O corpo da requisição contém um endereço IP inválido. O corpo da resposta contém a mensagem de erro |

#### Exemplo de código

{% tabs %}
{% tab title="cURL" %}

```shell
curl -X POST -u username:password "https://api.oxylabs.io/v1/whitelisted_ips"
--header "Content-Type: application/json" --data '{"address": "127.0.0.1"}'
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.oxylabs.io/v1/whitelisted_ips");
$payload = json_encode( array( "address"=> "127.0.0.1" ) );
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $payload);
curl_setopt( $curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERPWD, 'username:password');

$result = curl_exec($curl);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
requests.post('https://api.oxylabs.io/v1/whitelisted_ips',
              json={"address": "127.0.0.1"},
              auth=('username', 'password'))
```

{% endtab %}
{% endtabs %}

```json
{
    "error": {
        "message": "This is not a valid IP address.",
        "code": 422
    }
}
```

#### Saída de exemplo

```json
{
    "id": 9767,
    "address": "127.0.0.1"
}
```

## Removendo um IP permitido

`DELETE https://api.oxylabs.io/v1/whitelisted_ips/{id}`

| Parâmetro | Descrição                                                                                               |
| --------- | ------------------------------------------------------------------------------------------------------- |
| `id`      | A URL `id` do endereço IP que você deseja excluir (você pode obtê-lo no endpoint GET de IPs permitidos) |

| Resposta | Descrição                                                                                          |
| -------- | -------------------------------------------------------------------------------------------------- |
| `204`    | Sucesso. O endereço IP foi removido da lista. O corpo da resposta está vazio.                      |
| `403`    | Erro. A solicitação contém um `id`. O corpo da resposta contém a mensagem de erro "Access Denied". |

#### Exemplos de código

{% tabs %}
{% tab title="cURL" %}

```shell
curl -X DELETE -u username:password "https://api.oxylabs.io/v1/whitelisted_ips/{id}"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.oxylabs.io/v1/whitelisted_ips/{id}');
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERPWD, 'username:password');
$result = curl_exec($curl);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
requests.delete('https://api.oxylabs.io/v1/whitelisted_ips/{id}', auth=('username', 'password'))
```

{% endtab %}
{% endtabs %}

## Salvando alterações (cooldown de 5 min)

`POST https://api.oxylabs.io/v1/whitelisted_ips/upload_to_servers`

| Resposta | Descrição                                                                                                                                                                                                                 |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `202`    | <p>Sucesso. As alterações na sua lista de IPs permitidos foram confirmadas. O corpo da resposta está vazio.<br></p>                                                                                                       |
| `429`    | <p>Erro. As alterações não foram confirmadas; o endpoint está em cooldown de 5 minutos. O corpo da resposta contém a mensagem de erro "You have exceeded the rate limit for the endpoint. Please try again later"<br></p> |

#### Exemplos de código

{% tabs %}
{% tab title="cURL" %}

```shell
curl -X POST -u username:password "https://api.oxylabs.io/v1/whitelisted_ips/upload_to_servers"
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.oxylabs.io/v1/whitelisted_ips/upload_to_servers");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERPWD, 'username:password');

$result = curl_exec($curl);
?>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
requests.post("https://api.oxylabs.io/v1/whitelisted_ips/upload_to_servers", auth=('username', 'password'))
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.oxylabs.io/products/pt-br/proxies/dedicated-isp-proxies/enterprise/restful.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
