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
curl -X POST -u username:password "https://api.oxylabs.io/v1/whitelisted_ips"
--header "Content-Type: application/json" --data '{"address": "127.0.0.1"}'<?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);
?>import requests
requests.post('https://api.oxylabs.io/v1/whitelisted_ips',
json={"address": "127.0.0.1"},
auth=('username', 'password')){
"error": {
"message": "This is not a valid IP address.",
"code": 422
}
}Sample output
{
"id": 9767,
"address": "127.0.0.1"
}Last updated
Was this helpful?

