> 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/proxies/dedicated-isp-proxies/enterprise/restful.md).

# Whitelisting IPs (RESTful)

Whitelist IPs by sending queries directly to our endpoints.

{% hint style="info" %}
Please note there is a 5-minute cooldown to confirm changes to your whitelisted IP list.
{% endhint %}

## Getting Whitelisted IPs List

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

| Response | Description                                                                  |
| -------- | ---------------------------------------------------------------------------- |
| `200`    | Success. Response body contains all currently whitelisted IPs and their ids. |

#### Code example

{% 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 %}

#### Sample output

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

## Adding a Whitelisted IP

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

| Response | Description                                                                                                    |
| -------- | -------------------------------------------------------------------------------------------------------------- |
| `201`    | Success. The IP address has been added to the list. Response body contains the newly added `address` and `id`. |
| `422`    | Error. Request body contains an invalid IP address. Response body contains the error message                   |

#### Code example

{% 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
    }
}
```

#### Sample output

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

## Removing a Whitelisted IP

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

| Parameter | Description                                                                                      |
| --------- | ------------------------------------------------------------------------------------------------ |
| `id`      | The `id` of the IP address you want to delete (you can get it from GET whitelisted IPs endpoint) |

| Response | Description                                                                                        |
| -------- | -------------------------------------------------------------------------------------------------- |
| `204`    | Success. The IP address has been removed from the list. Response body is empty.                    |
| `403`    | Error. Request contains an invalid `id`. Response body contains the error message "Access Denied". |

#### Code examples

{% 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 %}

## Saving Changes (5min Cooldown)

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

| Response | Description                                                                                                                                                                                                     |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `202`    | <p>Success. Changes to your whitelisted IP list have been confirmed. Response body is empty.<br></p>                                                                                                            |
| `429`    | <p>Error. Changes have not been confirmed, the endpoint is on a 5 minute cooldown. Response body contains the error message "You have exceeded the rate limit for the endpoint. Please try again later"<br></p> |

#### Code examples

{% 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/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.
