How to Use PrivateProxy.me API

How to Use PrivateProxy.me API

Do you know how to use PrivateProxy.me API? This is the most comprehensive introduction from PrivateProxy.me official.

Basic Information

Package needs to be active for API to work.

Your API key: 08c5fa8dd63c8adc4b08803df5f68f9d

API base URL: https://app.privateproxy.me/api/v1

Authorization is standard basic auth with api as username and api key as password, or you can use a key query parameter.

curl -u api:08c5fa8dd63c8adc4b08803df5f68f9d https://app.privateproxy.me/api/v1/package_subscriptions/1/...
curl https://app.privateproxy.me/api/v1/package_subscriptions/1/...?key=08c5fa8dd63c8adc4b08803df5f68f9d

Inactive subscriptions can't be used in API requests.

All further examples use basic authorization.


Common Code for All Further Examples

Python 3 + requestsPHP + libcurlNode.js + stdlibRuby + stdlibGolang + stdlib
# filename proxy_api.py
import json
import requests
import pprint

class ProxyAPIException(Exception):
  pass

class RequestError(ProxyAPIException):
  pass

class ResponseError(ProxyAPIException):
  pass

class ResponseParseError(ProxyAPIException):
  pass

class ProxyAPI:
  def __init__(self, base, api_key):
    if base.endswith('/'):
      self.base = base
    else:
      self.base = base + '/'
    self.api_key = api_key

  def __is_json_response(self, response):
    if 'Content-Type' not in response.headers:
      return False
    for part in response.headers['Content-Type'].split(';'):
      if part == "application/json":
        return True

    return False

  def __process_response(self, response):
    if response.status_code == 200:
      error = None
      if self.__is_json_response(response):
        try:
          obj = json.loads(response.text)
        except Exception as e:
          error = e
        if error:
          raise ResponseParseError("Error parsing JSON response from the server: %s" % str(error))
        return obj
      else:
        return response.text
    else:
      if self.__is_json_response(response):
        failed = False
        try:
          error_json = json.loads(response.text)
        except Exception as e:
          failed = True
        if failed:
          raise ResponseError("Received non-200 code from the server, but failed to parse json response: %s" % response.text)
        else:
          raise ResponseError("Received error from server: %s" % error_json['error'])
      else:
        raise ResponseError("Received non-200 code from the server")


  def get(self, endpoint, query_params = {}):
    if endpoint[0] == '/':
      endpoint = endpoint[1:]
    fin_url = self.base + endpoint
    error = None
    try:
      response = requests.get(fin_url, auth=('api', self.api_key), params = query_params)
    except requests.exceptions.RequestException as e:
      error = e

    if error:
      raise RequestError("An error occurred while making a request: %s" % str(error))

    return self.__process_response(response)

  def put(self, endpoint, body = {}):
    if endpoint[0] == '/':
      endpoint = endpoint[1:]
    fin_url = self.base + endpoint
    error = None
    try:
      response = requests.put(
        fin_url,
        auth=('api', self.api_key),
        data = json.dumps(body),
        headers = {'Content-Type': 'application/json'}
      )
    except requests.exceptions.RequestException as e:
      error = e

    if error:
      raise RequestError("An error occurred while making a request: %s" % str(error))

    return self.__process_response(response)
<?php
// filename proxy_api.php
class ProxyAPIException extends Exception {}
class RequestError extends ProxyAPIException {}
class ResponseError extends ProxyAPIException {}
class ResponseParseError extends ProxyAPIException {}

class ProxyAPI {
  private $api_base, $api_key;

  public function __construct($api_base, $api_key) {
    $this->api_base = preg_replace("/\/+$/", "", $api_base);
    $this->api_key = $api_key;
  }

  public function get($endpoint, $query_params = null) {
    $endpoint = "/".preg_replace("/^\/+/", "", $endpoint);
    $url = $this->api_base.$endpoint;

    $query_string = "";
    if ($query_params !== null) {
      $q = null;
      if (is_string($query_params)) {
        $q = explode($url, '&');
      } elseif (is_array($query_params)) {
        $q = $query_params;
      }
      $tmp = [];
      foreach ($q as $key => $value) {
        $tmp[] = urlencode($key) . "=" . urlencode($value);
      }
      $query_string = implode("&", $tmp);
    }

    if ($query_string !== "") {
      $url .= "?".$query_string;
    }

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
    curl_setopt($ch, CURLOPT_USERNAME, "api");
    curl_setopt($ch, CURLOPT_PASSWORD, $this->api_key);
    $response = curl_exec($ch);

    return $this->process_response($ch, $response);
  }

  public function put($endpoint, $body = null) {
    $endpoint = "/" . preg_replace("/^\/+/", "", $endpoint);
    $url = $this->api_base . $endpoint;

    $data_json = json_encode($body);
    if (json_last_error()) {
      throw new RequestError("Error encoding body as json: ".json_last_error_msg());
    }

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERNAME, "api");
    curl_setopt($ch, CURLOPT_PASSWORD, $this->api_key);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
    curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type:application/json", "Content-Length:".strlen($data_json)]);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
    $response = curl_exec($ch);

    return $this->process_response($ch, $response);
  }

  private function process_response($ch, $response) {
    if (curl_error($ch)) {
      throw new RequestError("Received error during request: ".curl_error($ch));
    }
    $response_code = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
    $content_type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
    $is_json = strstr($content_type, 'application/json') !== false;
    curl_close($ch);

    if ($response_code == '200') {
      if ($is_json) {
        $res = json_decode($response, true, 512);
        $le = json_last_error();
        if ($le != JSON_ERROR_NONE) {
          throw new ResponseParseError("Error parsing response from server as JSON: ".json_last_error_msg());
        }
        return $res;
      } else {
        return $response;
      }
    } else {
      if ($is_json) {
        $res = json_decode($response, true, 512);
        $le = json_last_error();
        if ($le != JSON_ERROR_NONE) {
          throw new ResponseError("Received ".$response_code." code from server, but failed to parse JSON response: ".json_last_error_msg());
        }
        throw new ResponseError("Received ".$response_code." code from server: ".$res['error']);
      } else {
        throw new ResponseError("Received ".$response_code." code from server: ".$response);
      }
    }
  }
}
// filename proxy_api.js
const https = require('https')
const http = require('http')
const querystring = require('querystring');

function process_response(response, body, resolve, reject) {
  const ct = response.headers['content-type'] || '';
  let isJson = false;
  if (ct.includes("application/json")) {
    isJson = true;
  }

  if (response.statusCode == 200) {
    if (isJson) {
      let json;
      try {
        json = JSON.parse(body);
      } catch(e) {
        reject(e);
        return;
      }
      resolve(json);
    } else {
      resolve(body);
    }
  } else {
    const err = "Received status " + response.statusCode + " from server";
    if (isJson) {
      let json;
      try {
        json = JSON.parse(body);
      } catch(e) {
        reject(new Error(err + ", but failed to parse JSON: " + body));
        return;
      }
      reject(new Error(err + ": " + json['error']));
    } else {
      reject(new Error(err + ": " + body));
    }
  }
}

async function get(url, api_key, query_params = {}) {
  const qs = querystring.stringify(query_params);
  let final_url = url;
  if (qs != '') {
    final_url += '?' + qs;
  }
  const options = {
    method: 'GET',
    auth: "api:" + api_key
  }

  const result = await new Promise((resolve, reject) => {
    let t;
    if (final_url.startsWith("http://")) {
      t = http;
    } else if (final_url.startsWith("https://")) {
      t = https;
    }
    const req = t.request(final_url, options, (res) => {
      res.setEncoding('utf8');
      const chunks = [];
      res.on('data', (chunk) => {
        chunks.push(chunk);
      });

      res.on('end', () => {
        const body = chunks.join('');
        process_response(res, body, resolve, reject);
      });
    });

    req.on('error', (e) => {
      reject(e);
    });

    req.end();
  }).catch((e) => (e));

  return result;
}

async function put(url, api_key, request_body = {}) {
  const request_body_str = JSON.stringify(request_body);
  const options = {
    method: 'PUT',
    auth: "api:" + api_key,
    headers: {
      'Content-Type': 'application/json',
      'Content-Length': request_body_str.length
    }
  }

  const result = await new Promise((resolve, reject) => {
    let t;
    if (url.startsWith("http://")) {
      t = http;
    } else if (url.startsWith("https://")) {
      t = https;
    }
    const req = t.request(url, options, (res) => {
      res.setEncoding('utf8');
      const ct = res.headers['content-type'] || '';
      let isJson = false;
      if (ct.includes("application/json")) {
        isJson = true;
      }
      const chunks = []
      res.on('data', (chunk) => {
        chunks.push(chunk);
      });

      res.on('end', () => {
        const body = chunks.join('');
        process_response(res, body, resolve, reject);
      });
    });

    req.on('error', (e) => {
      reject(e);
    });

    req.write(request_body_str);
    req.end();
  }).catch((e) => (e));

  return result;
}

module.exports = {
  get: get,
  put: put
}
# filename proxy_api.rb
require 'net/http'
require 'uri'
require 'json'

class ProxyAPIException < StandardError
end

class RequestError < ProxyAPIException
end

class ResponseError < ProxyAPIException
  attr_accessor :code
end

class ResponseParseError < ProxyAPIException
end

class ProxyAPI
  def initialize(base_url, api_key)
    @base_url = base_url.gsub(/\/+$/, '')
    @api_key = api_key
  end

  def get(endpoint, query_params = {})
    endpoint = endpoint.gsub(/^\/+/, '/')
    if endpoint[0] != '/'
      endpoint = '/' + endpoint
    end
    final_url = @base_url + endpoint
    uri = URI.parse(final_url)
    if !query_params.empty?
      uri.query = URI.encode_www_form(query_params)
    end
    request = Net::HTTP::Get.new(uri)
    req_options = {
      use_ssl: uri.scheme == "https",
    }
    request.basic_auth('api', @api_key)

    response = nil
    err = nil
    begin
      response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
        response = http.request(request)
      end
    rescue => e
      err = RequestError.new(e.message)
    end

    raise err if err

    return process_response(response)
  end

  def put(endpoint, body = {})
    endpoint = endpoint.gsub(/^\/+/, '/')
    if endpoint[0] != '/'
      endpoint = '/' + endpoint
    end
    final_url = @base_url + endpoint
    uri = URI.parse(final_url)
    request = Net::HTTP::Put.new(uri)
    req_options = {
      use_ssl: uri.scheme == "https",
    }
    request.basic_auth('api', @api_key)
    request['Content-Type'] = 'application/json'
    request.body = body.to_json

    response = nil
    err = nil
    begin
      response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
        response = http.request(request)
      end
    rescue => e
      err = RequestError.new(e.message)
    end

    raise err if err

    return process_response(response)
  end

  private

  def process_response(response)
    if response.code == '200'
      err = nil
      res = begin
        if is_json_response?(response)
          JSON.parse(response.body)
        else
          response.body
        end
      rescue => e
        err = ResponseParseError.new(e.message)
      end
      raise err if err
      return res
    else
      if is_json_response?(response)
        b = JSON.parse(response.body) rescue nil
        if b
          ex = ResponseError.new("Received code #{response.code} from server: #{b['error']}")
          ex.code = response.code.to_i
          raise ex
        else
          ex = ResponseError.new("Received code #{response.code} from server, but failed to parse JSON: #{response.body}")
          ex.code = response.code.to_i
          raise ex
        end
      else
        ex = ResponseError.new("Received code #{response.code} from server: #{response.body}")
        ex.code = response.code.to_i
        raise ex
      end
    end
  end

  def is_json_response?(response)
    response['Content-Type'].to_s.split(';').each do |part|
      return true if part == 'application/json'
    end
    return false
  end
end
# filename proxy_api.rb
require 'net/http'
require 'uri'
require 'json'

class ProxyAPIException < StandardError
end

class RequestError < ProxyAPIException
end

class ResponseError < ProxyAPIException
  attr_accessor :code
end

class ResponseParseError < ProxyAPIException
end

class ProxyAPI
  def initialize(base_url, api_key)
    @base_url = base_url.gsub(/\/+$/, '')
    @api_key = api_key
  end

  def get(endpoint, query_params = {})
    endpoint = endpoint.gsub(/^\/+/, '/')
    if endpoint[0] != '/'
      endpoint = '/' + endpoint
    end
    final_url = @base_url + endpoint
    uri = URI.parse(final_url)
    if !query_params.empty?
      uri.query = URI.encode_www_form(query_params)
    end
    request = Net::HTTP::Get.new(uri)
    req_options = {
      use_ssl: uri.scheme == "https",
    }
    request.basic_auth('api', @api_key)

    response = nil
    err = nil
    begin
      response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
        response = http.request(request)
      end
    rescue => e
      err = RequestError.new(e.message)
    end

    raise err if err

    return process_response(response)
  end

  def put(endpoint, body = {})
    endpoint = endpoint.gsub(/^\/+/, '/')
    if endpoint[0] != '/'
      endpoint = '/' + endpoint
    end
    final_url = @base_url + endpoint
    uri = URI.parse(final_url)
    request = Net::HTTP::Put.new(uri)
    req_options = {
      use_ssl: uri.scheme == "https",
    }
    request.basic_auth('api', @api_key)
    request['Content-Type'] = 'application/json'
    request.body = body.to_json

    response = nil
    err = nil
    begin
      response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
        response = http.request(request)
      end
    rescue => e
      err = RequestError.new(e.message)
    end

    raise err if err

    return process_response(response)
  end

  private

  def process_response(response)
    if response.code == '200'
      err = nil
      res = begin
        if is_json_response?(response)
          JSON.parse(response.body)
        else
          response.body
        end
      rescue => e
        err = ResponseParseError.new(e.message)
      end
      raise err if err
      return res
    else
      if is_json_response?(response)
        b = JSON.parse(response.body) rescue nil
        if b
          ex = ResponseError.new("Received code #{response.code} from server: #{b['error']}")
          ex.code = response.code.to_i
          raise ex
        else
          ex = ResponseError.new("Received code #{response.code} from server, but failed to parse JSON: #{response.body}")
          ex.code = response.code.to_i
          raise ex
        end
      else
        ex = ResponseError.new("Received code #{response.code} from server: #{response.body}")
        ex.code = response.code.to_i
        raise ex
      end
    end
  end

  def is_json_response?(response)
    response['Content-Type'].to_s.split(';').each do |part|
      return true if part == 'application/json'
    end
    return false
  end
end

Get Subscriptions List

This endpoint allows to get a list of all subscriptions.
Endpoint /package_subscriptions
Method GET
Parameters None
Query parameters None
JSON parameters None
curl in *nix shellPython 3 + requestsPHP + libcurlNode.js + stdlibRuby + stdlibGolang + stdlib
curl -u api:08c5fa8dd63c8adc4b08803df5f68f9d https://app.privateproxy.me/api/v1/package_subscriptions

Example response:

[
  {
    "id":8644,
    "type":"backconnect",
    "package":"Backconnect Beginner (200K Requests)",
    "active":false
  },
  {
    "id":8643,
    "type":"proxy",
    "package":"3 Private Proxies",
    "active":true
  }
]
from proxy_api import *

api = ProxyAPI("https://app.privateproxy.me/api/v1","08c5fa8dd63c8adc4b08803df5f68f9d")
try:
  result = api.get("/package_subscriptions")
  pprint.PrettyPrinter(indent=2).pprint(result)
except ProxyAPIException as e:
  print(str(e))

Example response:

[
  {
    "id":8644,
    "type":"backconnect",
    "package":"Backconnect Beginner (200K Requests)",
    "active":false
  },
  {
    "id":8643,
    "type":"proxy",
    "package":"3 Private Proxies",
    "active":true
  }
]
<?php
require "proxy_api.php";

$api = new ProxyAPI('https://app.privateproxy.me/api/v1', '08c5fa8dd63c8adc4b08803df5f68f9d');

try {
  var_dump($api->get("/package_subscriptions"));
} catch(ProxyAPIException $e) {
  echo $e;
}

Example response:

[
  {
    "id":8644,
    "type":"backconnect",
    "package":"Backconnect Beginner (200K Requests)",
    "active":false
  },
  {
    "id":8643,
    "type":"proxy",
    "package":"3 Private Proxies",
    "active":true
  }
]
const proxy_api = require('./proxy_api');

async function main() {
  const res = await proxy_api.get('https://app.privateproxy.me/api/v1/package_subscriptions', '08c5fa8dd63c8adc4b08803df5f68f9d');
  if (res instanceof Error) {
    console.log("Error:" + res.toString());
  } else {
    console.log(res);
  }
}

main();

Example response:

[
  {
    "id":8644,
    "type":"backconnect",
    "package":"Backconnect Beginner (200K Requests)",
    "active":false
  },
  {
    "id":8643,
    "type":"proxy",
    "package":"3 Private Proxies",
    "active":true
  }
]
require_relative './proxy_api'

begin
  api = ProxyAPI.new("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d")
  puts(api.get("/package_subscriptions").inspect)
rescue ProxyAPIException => e
  puts e.message
end

Example response:

[
  {
    "id":8644,
    "type":"backconnect",
    "package":"Backconnect Beginner (200K Requests)",
    "active":false
  },
  {
    "id":8643,
    "type":"proxy",
    "package":"3 Private Proxies",
    "active":true
  }
]
package main

import (
  "encoding/json"
  "fmt"
  "net/http"
)

type subscriptionEl struct {
  ID      int    `json:"id"`
  Type    string `json:"type"`
  Package string `json:"package"`
  Active  bool   `json:"active"`
}

type subscriptionsList []*subscriptionEl

func main() {
  api := NewProxyAPI("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d", &http.Client{})

  resp, isJSON, err := api.Get("/package_subscriptions", nil)
  if err != nil {
    fmt.Println(err)
  } else {
    if isJSON {
      var subscriptions subscriptionsList
      json.Unmarshal([]byte(resp), &subscriptions)
      for _, v := range subscriptions {
        fmt.Println(v)
      }
    } else {
      fmt.Println(resp)
    }
  }
}

Example response:

[
  {
    "id":8644,
    "type":"backconnect",
    "package":"Backconnect Beginner (200K Requests)",
    "active":false
  },
  {
    "id":8643,
    "type":"proxy",
    "package":"3 Private Proxies",
    "active":true
  }
]

Get Subscription

This endpoint allows you to get specific subscription information, like billing cycle start and end dates, or number of requests in the current billing cycle for backconnect packages.
Endpoint /package_subscriptions/:id
Method GET
Parameters id – id of subscription
Query parameters None
JSON parameters None
curl in *nix shellPython 3 + requestsPHP + libcurlNode.js + stdlibRuby + stdlibGolang + stdlib
curl -u api:08c5fa8dd63c8adc4b08803df5f68f9d https://app.privateproxy.me/api/v1/package_subscriptions/1

Example response:

Proxy subscription Backconnect subscription
{
  "id":8643,
  "type":"proxy",
  "purpose":"Google",
  "country":"Any",
  "ip_type":"proxy",
  "package":"3 Private Proxies",
  "price_cents":900,
  "billing_cycle_start":1599563902,
  "billing_cycle_end":1602155902,
  "last_invoice_amount_cents":900,
  "payment_method":"card",
  "ip_count":3
}
{
  "id":8644,
  "type":"backconnect",
  "purpose":"Google",
  "country":"Any",
  "ip_type":"proxy",
  "package":"Backconnect Beginner (200K Requests)",
  "price_cents":5900,
  "billing_cycle_start":1599563939,
  "billing_cycle_end":1602155939,
  "last_invoice_amount_cents":5900,
  "payment_method":"card",
  "requests_limit":200000,
  "port_count":5,
  "connection_limit":1000,
  "billing_cycle_requests":15749
}

 

from proxy_api import *

api = ProxyAPI("https://app.privateproxy.me/api/v1","08c5fa8dd63c8adc4b08803df5f68f9d")
try:
  result = api.get("/package_subscriptions/1")
  pprint.PrettyPrinter(indent=2).pprint(result)
except ProxyAPIException as e:
  print(str(e))

Example response:

Proxy subscription Backconnect subscription
{
  "id":8643,
  "type":"proxy",
  "purpose":"Google",
  "country":"Any",
  "ip_type":"proxy",
  "package":"3 Private Proxies",
  "price_cents":900,
  "billing_cycle_start":1599563902,
  "billing_cycle_end":1602155902,
  "last_invoice_amount_cents":900,
  "payment_method":"card",
  "ip_count":3
}
{
  "id":8644,
  "type":"backconnect",
  "purpose":"Google",
  "country":"Any",
  "ip_type":"proxy",
  "package":"Backconnect Beginner (200K Requests)",
  "price_cents":5900,
  "billing_cycle_start":1599563939,
  "billing_cycle_end":1602155939,
  "last_invoice_amount_cents":5900,
  "payment_method":"card",
  "requests_limit":200000,
  "port_count":5,
  "connection_limit":1000,
  "billing_cycle_requests":15749
}
<?php
require "proxy_api.php";

$api = new ProxyAPI('https://app.privateproxy.me/api/v1', '08c5fa8dd63c8adc4b08803df5f68f9d');

try {
  var_dump($api->get("/package_subscriptions/1"));
} catch(ProxyAPIException $e) {
  echo $e;
}

Example response:

Proxy subscription Backconnect subscription
{
  "id":8643,
  "type":"proxy",
  "purpose":"Google",
  "country":"Any",
  "ip_type":"proxy",
  "package":"3 Private Proxies",
  "price_cents":900,
  "billing_cycle_start":1599563902,
  "billing_cycle_end":1602155902,
  "last_invoice_amount_cents":900,
  "payment_method":"card",
  "ip_count":3
}
{
  "id":8644,
  "type":"backconnect",
  "purpose":"Google",
  "country":"Any",
  "ip_type":"proxy",
  "package":"Backconnect Beginner (200K Requests)",
  "price_cents":5900,
  "billing_cycle_start":1599563939,
  "billing_cycle_end":1602155939,
  "last_invoice_amount_cents":5900,
  "payment_method":"card",
  "requests_limit":200000,
  "port_count":5,
  "connection_limit":1000,
  "billing_cycle_requests":15749
}
const proxy_api = require('./proxy_api');

async function main() {
  const res = await proxy_api.get('https://app.privateproxy.me/api/v1/package_subscriptions/1', '08c5fa8dd63c8adc4b08803df5f68f9d');
  if (res instanceof Error) {
    console.log("Error:" + res.toString());
  } else {
    console.log(res);
  }
}

main();

Example response:

Proxy subscription Backconnect subscription
{
  "id":8643,
  "type":"proxy",
  "purpose":"Google",
  "country":"Any",
  "ip_type":"proxy",
  "package":"3 Private Proxies",
  "price_cents":900,
  "billing_cycle_start":1599563902,
  "billing_cycle_end":1602155902,
  "last_invoice_amount_cents":900,
  "payment_method":"card",
  "ip_count":3
}
{
  "id":8644,
  "type":"backconnect",
  "purpose":"Google",
  "country":"Any",
  "ip_type":"proxy",
  "package":"Backconnect Beginner (200K Requests)",
  "price_cents":5900,
  "billing_cycle_start":1599563939,
  "billing_cycle_end":1602155939,
  "last_invoice_amount_cents":5900,
  "payment_method":"card",
  "requests_limit":200000,
  "port_count":5,
  "connection_limit":1000,
  "billing_cycle_requests":15749
}
require_relative './proxy_api'

begin
  api = ProxyAPI.new("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d")
  puts(api.get("/package_subscriptions/1").inspect)
rescue ProxyAPIException => e
  puts e.message
end

Example response:

Proxy subscription Backconnect subscription
{
  "id":8643,
  "type":"proxy",
  "purpose":"Google",
  "country":"Any",
  "ip_type":"proxy",
  "package":"3 Private Proxies",
  "price_cents":900,
  "billing_cycle_start":1599563902,
  "billing_cycle_end":1602155902,
  "last_invoice_amount_cents":900,
  "payment_method":"card",
  "ip_count":3
}
{
  "id":8644,
  "type":"backconnect",
  "purpose":"Google",
  "country":"Any",
  "ip_type":"proxy",
  "package":"Backconnect Beginner (200K Requests)",
  "price_cents":5900,
  "billing_cycle_start":1599563939,
  "billing_cycle_end":1602155939,
  "last_invoice_amount_cents":5900,
  "payment_method":"card",
  "requests_limit":200000,
  "port_count":5,
  "connection_limit":1000,
  "billing_cycle_requests":15749
}
package main

import (
  "encoding/json"
  "fmt"
  "net/http"
)

type subscription struct {
  ID                     int    `json:"id"`
  Type                   string `json:"type"`
  Purpose                string `json:"purpose"`
  Country                string `json:"country"`
  IPType                 string `json:"ip_type"`
  Package                string `json:"package"`
  PriceCents             int    `json:"price_cents"`
  BillingCycleStart      uint64 `json:"billing_cycle_start"`
  BillingCycleEnd        uint64 `json:"billing_cycle_end"`
  LastInvoiceAmountCents int    `json:"last_invoice_amount_cents"`
  PaymentMethod          string `json:"payment_method"`

  // only proxy
  IPCount int `json:"ip_count"`

  // only backconnect
  RequestsLimit        int `json:"requests_limit"`
  PortCount            int `json:"port_count"`
  ConnectionLimit      int `json:"connection_limit"`
  BillingCycleRequests int `json:"billing_cycle_requests"`
}

func main() {
  api := NewProxyAPI("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d", &http.Client{})

  resp, isJSON, err := api.Get("/package_subscriptions/1", nil)
  if err != nil {
    fmt.Println(err)
  } else {
    if isJSON {
      var sub subscription
      json.Unmarshal([]byte(resp), &sub)
      fmt.Println(sub)
    } else {
      fmt.Println(resp)
    }
  }
}

Example response:

Proxy subscription Backconnect subscription
{
  "id":8643,
  "type":"proxy",
  "purpose":"Google",
  "country":"Any",
  "ip_type":"proxy",
  "package":"3 Private Proxies",
  "price_cents":900,
  "billing_cycle_start":1599563902,
  "billing_cycle_end":1602155902,
  "last_invoice_amount_cents":900,
  "payment_method":"card",
  "ip_count":3
}
{
  "id":8644,
  "type":"backconnect",
  "purpose":"Google",
  "country":"Any",
  "ip_type":"proxy",
  "package":"Backconnect Beginner (200K Requests)",
  "price_cents":5900,
  "billing_cycle_start":1599563939,
  "billing_cycle_end":1602155939,
  "last_invoice_amount_cents":5900,
  "payment_method":"card",
  "requests_limit":200000,
  "port_count":5,
  "connection_limit":1000,
  "billing_cycle_requests":15749
}

IP/Port List

This endpoint allows getting a list of proxies/backconnect gateway IPs for the package.
Endpoint /package_subscriptions/:id/ips
Method GET
Parameters id – id of subscription
Query parameters hide_auth – if present, hides credentials from the list
hide_port – hides port(static packages only)
port – shows different port, available values are 2534, 3389, 5432 and 5433, 5432 is the default(static packages only)
JSON parameters None
curl in *nix shellPython 3 + requestsPHP + libcurlNode.js + stdlibRuby + stdlibGolang + stdlib
curl -u api:08c5fa8dd63c8adc4b08803df5f68f9d https://app.privateproxy.me/api/v1/package_subscriptions/1/ips

Example response:

Without hide_auth With hide_auth
1.1.1.1:5432:login:password
2.2.2.2:5432:login:password
3.3.3.3:5432:login:password
1.1.1.1:5432
2.2.2.2:5432
3.3.3.3:5432

 

from proxy_api import *

api = ProxyAPI("https://app.privateproxy.me/api/v1","08c5fa8dd63c8adc4b08803df5f68f9d")
try:
  result = api.get("/package_subscriptions/1/ips")
  pprint.PrettyPrinter(indent=2).pprint(result)
  result = api.get("/package_subscriptions/1/ips", query_params={'hide_auth': ''})
  pprint.PrettyPrinter(indent=2).pprint(result)
except ProxyAPIException as e:
  print(str(e))

Example response:

Without hide_auth With hide_auth
1.1.1.1:5432:login:password
2.2.2.2:5432:login:password
3.3.3.3:5432:login:password
1.1.1.1:5432
2.2.2.2:5432
3.3.3.3:5432
<?php
require "proxy_api.php";

$api = new ProxyAPI('https://app.privateproxy.me/api/v1', '08c5fa8dd63c8adc4b08803df5f68f9d');

try {
  var_dump($api->get("/package_subscriptions/1/ips"));
  var_dump($api->get("/package_subscriptions/1/ips", [
    "hide_auth" => ""
  ]));
} catch(ProxyAPIException $e) {
  echo $e;
}

Example response:

Without hide_auth With hide_auth
1.1.1.1:5432:login:password
2.2.2.2:5432:login:password
3.3.3.3:5432:login:password
1.1.1.1:5432
2.2.2.2:5432
3.3.3.3:5432
const proxy_api = require('./proxy_api');

async function main() {
  const res = await proxy_api.get('https://app.privateproxy.me/api/v1/package_subscriptions/1/ips', '08c5fa8dd63c8adc4b08803df5f68f9d');
  if (res instanceof Error) {
    console.log("Error:" + res.toString());
  } else {
    console.log(res);
  }
  const res2 = await proxy_api.get('https://app.privateproxy.me/api/v1/package_subscriptions/1/ips', '08c5fa8dd63c8adc4b08803df5f68f9d', {
    "hide_auth": ""
  });
  if (res2 instanceof Error) {
    console.log("Error:" + res2.toString());
  } else {
    console.log(res2);
  }
}

main();

Example response:

Without hide_auth With hide_auth
1.1.1.1:5432:login:password
2.2.2.2:5432:login:password
3.3.3.3:5432:login:password
1.1.1.1:5432
2.2.2.2:5432
3.3.3.3:5432
require_relative './proxy_api'

begin
  api = ProxyAPI.new("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d")
  puts(api.get("/package_subscriptions/1/ips").inspect)
  puts(api.get("/package_subscriptions/1/ips", hide_auth: '').inspect)
rescue ProxyAPIException => e
  puts e.message
end

Example response:

Without hide_auth With hide_auth
1.1.1.1:5432:login:password
2.2.2.2:5432:login:password
3.3.3.3:5432:login:password
1.1.1.1:5432
2.2.2.2:5432
3.3.3.3:5432
package main

import (
  "fmt"
  "net/http"
)

func main() {
  api := NewProxyAPI("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d", &http.Client{})

  resp, _, err := api.Get("/package_subscriptions/1/ips", nil)
  if err != nil {
    fmt.Println(err)
  } else {
    fmt.Println(resp)
  }

  resp, _, err = api.Get("/package_subscriptions/1/ips", map[string]string{"hide_auth": ""})
  if err != nil {
    fmt.Println(err)
  } else {
    fmt.Println(resp)
  }
}

Example response:

Without hide_auth With hide_auth
1.1.1.1:5432:login:password
2.2.2.2:5432:login:password
3.3.3.3:5432:login:password
1.1.1.1:5432
2.2.2.2:5432
3.3.3.3:5432

Get Subscription Settings

This endpoint allows to get package specific settings, like authorized ips and swap interval(for backconnect).
Endpoint /package_subscriptions/:id/settings
Method GET
Parameters id – id of subscription
Query parameters None
JSON parameters None
curl in *nix shellPython 3 + requestsPHP + libcurlNode.js + stdlibRuby + stdlibGolang + stdlib
curl -u api:08c5fa8dd63c8adc4b08803df5f68f9d https://app.privateproxy.me/api/v1/package_subscriptions/1/settings

Example response:

Proxy subscription Backconnect subscription
{
  "authorized_ips":[
    "15.25.5.11"
  ]
}
{
  "authorized_ips":[
    "15.25.5.11",
    "1.1.1.1"
  ],
  "swap_interval":120
}
from proxy_api import *

api = ProxyAPI("https://app.privateproxy.me/api/v1","08c5fa8dd63c8adc4b08803df5f68f9d")
try:
  result = api.get("/package_subscriptions/1/settings")
  pprint.PrettyPrinter(indent=2).pprint(result)
except ProxyAPIException as e:
  print(str(e))

Example response:

Proxy subscription Backconnect subscription
{
  "authorized_ips":[
    "15.25.5.11"
  ]
}
{
  "authorized_ips":[
    "15.25.5.11",
    "1.1.1.1"
  ],
  "swap_interval":120
}
<?php
require "proxy_api.php";

$api = new ProxyAPI('https://app.privateproxy.me/api/v1', '08c5fa8dd63c8adc4b08803df5f68f9d');

try {
  var_dump($api->get("/package_subscriptions/1/settings"));
} catch(ProxyAPIException $e) {
  echo $e;
}

Example response:

Proxy subscription Backconnect subscription
{
  "authorized_ips":[
    "15.25.5.11"
  ]
}
{
  "authorized_ips":[
    "15.25.5.11",
    "1.1.1.1"
  ],
  "swap_interval":120
}
const proxy_api = require('./proxy_api');

async function main() {
  const res = await proxy_api.get('https://app.privateproxy.me/api/v1/package_subscriptions/1/settings', '08c5fa8dd63c8adc4b08803df5f68f9d');
  if (res instanceof Error) {
    console.log("Error:" + res.toString());
  } else {
    console.log(res);
  }
}

main();

Example response:

Proxy subscription Backconnect subscription
{
  "authorized_ips":[
    "15.25.5.11"
  ]
}
{
  "authorized_ips":[
    "15.25.5.11",
    "1.1.1.1"
  ],
  "swap_interval":120
}
require_relative './proxy_api'

begin
  api = ProxyAPI.new("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d")
  puts(api.get("/package_subscriptions/1/settings").inspect)
rescue ProxyAPIException => e
  puts e.message
end

Example response:

Proxy subscription Backconnect subscription
{
  "authorized_ips":[
    "15.25.5.11"
  ]
}
{
  "authorized_ips":[
    "15.25.5.11",
    "1.1.1.1"
  ],
  "swap_interval":120
}
package main

import (
  "encoding/json"
  "fmt"
  "net/http"
)

type packageSettings struct {
  AuthorizedIPs []string `json:"authorized_ips"`

  //backconnect only
  SwapInterval int `json:"swap_interval"`
}

func main() {
  api := NewProxyAPI("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d", &http.Client{})

  resp, _, err := api.Get("/package_subscriptions/1/settings", nil)
  if err != nil {
    fmt.Println(err)
  } else {
    var ps packageSettings
    json.Unmarshal([]byte(resp), &ps)
    fmt.Println(ps)
  }
}

Example response:

Proxy subscription Backconnect subscription
{
  "authorized_ips":[
    "15.25.5.11"
  ]
}
{
  "authorized_ips":[
    "15.25.5.11",
    "1.1.1.1"
  ],
  "swap_interval":120
}

Set Subscription Settings

This endpoint allows setting package specific settings, like authorized ips or swap interval(for backconnect).
Endpoint /package_subscriptions/:id
Method PUT
Necessary HTTP Headers Content-Type: application/json
Parameters id – id of subscription
Query parameters None
JSON parameters authorized_ips – list – authorized ips, that are allowed access to proxy without credentials
swap_interval – integer >= 0 – how often to change ip for backconnect proxies, 0 means change on every request. Ignored for normal proxy packages.
curl in *nix shellPython 3 + requestsPHP + libcurlNode.js + stdlibRuby + stdlibGolang + stdlib
curl -X PUT -H "Content-Type: application/json" -u api:08c5fa8dd63c8adc4b08803df5f68f9d --data '{"swap_interval": 180, "authorized_ips":["1.1.1.1"]}' https://app.privateproxy.me/api/v1/package_subscriptions/1

On success {“success”:true} JSON is returned, on error the hash will have success false and error will contain any errors:

{
  "success": false,
  "error": "Authorized ips contain invalid IP 441.2.3.4 on line 1, Swap interval must be greater than or equal to 0"
}
from proxy_api import *

api = ProxyAPI("https://app.privateproxy.me/api/v1","08c5fa8dd63c8adc4b08803df5f68f9d")
try:
  result = api.put("/package_subscriptions/1", body = {'swap_interval': 180, 'authorized_ips': ['1.2.3.4', '2.5.6.7']})
  print(result)
  result = api.put("/package_subscriptions/1", body = {'swap_interval': -180, 'authorized_ips': ['441.2.3.4']})
  print(result)
except ProxyAPIException as e:
  print(str(e))

On success {“success”:true} JSON is returned, on error the hash will have success false and error will contain any errors:

{
  "success": false,
  "error": "Authorized ips contain invalid IP 441.2.3.4 on line 1, Swap interval must be greater than or equal to 0"
}
<?php
require "proxy_api.php";

$api = new ProxyAPI('https://app.privateproxy.me/api/v1', '08c5fa8dd63c8adc4b08803df5f68f9d');

try {
  var_dump($api->put("/package_subscriptions/1", [
    "authorized_ips" => ["1.5.4.4", "1.5.6.7"],
    "swap_interval" => 3600
  ]));
  var_dump($api->put("/package_subscriptions/1", [
    "authorized_ips" => ["1.5.4.444", "1.5.6.7"],
    "swap_interval" => -3600
  ]));
} catch(ProxyAPIException $e) {
  echo $e;
}

On success {“success”:true} JSON is returned, on error the hash will have success false and error will contain any errors:

{
  "success": false,
  "error": "Authorized ips contain invalid IP 441.2.3.4 on line 1, Swap interval must be greater than or equal to 0"
}
const proxy_api = require('./proxy_api');

async function main() {
  const res = await proxy_api.put(
    'https://app.privateproxy.me/api/v1/package_subscriptions/1',
    '08c5fa8dd63c8adc4b08803df5f68f9d',
    {
      "authorized_ips": ["77.66.55.44", "1.87.31.3"],
      "swap_interval": 1200
    }
  );
  if (res instanceof Error) {
    console.log("Error:" + res.toString());
  } else {
    console.log(res);
  }
}

main();

On success {“success”:true} JSON is returned, on error the hash will have success false and error will contain any errors:

{
  "success": false,
  "error": "Authorized ips contain invalid IP 441.2.3.4 on line 1, Swap interval must be greater than or equal to 0"
}
require_relative './proxy_api'

begin
  api = ProxyAPI.new("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d")
  puts(api.put("/package_subscriptions/1", authorized_ips: ['1.2.3.2'], swap_interval: 30).inspect)
  puts(api.put("/package_subscriptions/1", authorized_ips: ['412.2.3.2'], swap_interval: -30).inspect)
rescue ProxyAPIException => e
  puts e.message
end

On success {“success”:true} JSON is returned, on error the hash will have success false and error will contain any errors:

{
  "success": false,
  "error": "Authorized ips contain invalid IP 441.2.3.4 on line 1, Swap interval must be greater than or equal to 0"
}
package main

import (
  "fmt"
  "net/http"
  "strings"
)

func main() {
  api := NewProxyAPI("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d", &http.Client{})

  ips := strings.Join([]string{"1.2.3.1", "1.3.1.2", "1.1.1.1"}, "\",\"")
  settings := fmt.Sprintf("{\"authorized_ips\": [\"%s\"], \"swap_interval\": 4242}", ips)

  resp, _, err := api.Put("/package_subscriptions/1", settings)
  if err != nil {
    fmt.Println(err)
  } else {
    fmt.Println(resp)
  }

  ips = strings.Join([]string{"1.2.3.1", "1.3.1.2", "1.1.1.1000"}, "\",\"")
  settings = fmt.Sprintf("{\"authorized_ips\": [\"%s\"], \"swap_interval\": -4242}", ips)

  resp, _, err = api.Put("/package_subscriptions/1", settings)
  if err != nil {
    fmt.Println(err)
  } else {
    fmt.Println(resp)
  }
}

On success {“success”:true} JSON is returned, on error the hash will have success false and error will contain any errors:

{
  "success": false,
  "error": "Authorized ips contain invalid IP 441.2.3.4 on line 1, Swap interval must be greater than or equal to 0"
}

Add Authorized IP

This endpoint allows adding a new authorized ip to the list of authorized ips without listing them all for convenience.
Endpoint /package_subscriptions/:id/add_authorized_ip
Method PUT
Necessary HTTP Headers Content-Type: application/json
Parameters id – id of subscription
Query parameters None
JSON parameters ip – string – ip to add
curl in *nix shellPython 3 + requestsPHP + libcurlNode.js + stdlibRuby + stdlibGolang + stdlib
curl -X PUT -H "Content-Type: application/json" -u api:08c5fa8dd63c8adc4b08803df5f68f9d --data '{"ip": "1.1.1.1"}' https://app.privateproxy.me/api/v1/package_subscriptions/1/add_authorized_ip
from proxy_api import *

api = ProxyAPI("https://app.privateproxy.me/api/v1","08c5fa8dd63c8adc4b08803df5f68f9d")
try:
  result = api.put("/package_subscriptions/1/add_authorized_ip", body = {'ip': '121.23.1.25'})
  print(result)
  result = api.put("/package_subscriptions/1/add_authorized_ip", body = {'ip': '266.1.2.3'})
  print(result)
except ProxyAPIException as e:
  print(str(e))
<?php
require "proxy_api.php";

$api = new ProxyAPI('https://app.privateproxy.me/api/v1', '08c5fa8dd63c8adc4b08803df5f68f9d');

try {
  var_dump($api->put("/package_subscriptions/1/add_authorized_ip", [
    "ip" => "7.7.7.7"
  ]));
} catch(ProxyAPIException $e) {
  echo $e;
}
const proxy_api = require('./proxy_api');

async function main() {
  const res = await proxy_api.put(
    'https://app.privateproxy.me/api/v1/package_subscriptions/1/add_authorized_ip',
    '08c5fa8dd63c8adc4b08803df5f68f9d',
    {
      "ip": "1.2.3.4"
    }
  );
  if (res instanceof Error) {
    console.log("Error:" + res.toString());
  } else {
    console.log(res);
  }
}

main();
require_relative './proxy_api'

begin
  api = ProxyAPI.new("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d")
  puts(api.put("/package_subscriptions/1/add_authorized_ip", ip: '1.2.3.2').inspect)
  puts(api.put("/package_subscriptions/1/add_authorized_ip", ip: '412.2.3.2').inspect)
rescue ProxyAPIException => e
  puts e.message
end
package main

import (
  "fmt"
  "net/http"
)

func main() {
  api := NewProxyAPI("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d", &http.Client{})

  ip := "{\"ip\": \"1.7.2.5\"}"
  resp, _, err := api.Put("/package_subscriptions/1/add_authorized_ip", ip)
  if err != nil {
    fmt.Println(err)
  } else {
    fmt.Println(resp)
  }
}

Remove Authorized IP

This endpoint allows removing authorized ip without listing them all for convenience. This endpoint returns error if no ip provided, otherwise it always succeeds, even if no IP was removed.
Endpoint /package_subscriptions/:id/remove_authorized_ip
Method PUT
Necessary HTTP Headers Content-Type: application/json
Parameters id – id of subscription
Query parameters None
JSON parameters ip – string – ip to remove
curl in *nix shellPython 3 + requestsPHP + libcurlNode.js + stdlibRuby + stdlibGolang + stdlib
curl -X PUT -H "Content-Type: application/json" -u api:08c5fa8dd63c8adc4b08803df5f68f9d --data '{"ip": "1.1.1.1"}' https://app.privateproxy.me/api/v1/package_subscriptions/1/remove_authorized_ip
from proxy_api import *

api = ProxyAPI("https://app.privateproxy.me/api/v1","08c5fa8dd63c8adc4b08803df5f68f9d")
try:
  result = api.put("/package_subscriptions/1/remove_authorized_ip", body = {'ip': '121.23.1.25'})
  print(result)
except ProxyAPIException as e:
  print(str(e))
<?php
require "proxy_api.php";

$api = new ProxyAPI('https://app.privateproxy.me/api/v1', '08c5fa8dd63c8adc4b08803df5f68f9d');

try {
  var_dump($api->put("/package_subscriptions/1/remove_authorized_ip", [
    "ip" => "7.7.7.7"
  ]));
} catch(ProxyAPIException $e) {
  echo $e;
}
const proxy_api = require('./proxy_api');

async function main() {
  const res = await proxy_api.put(
    'https://app.privateproxy.me/api/v1/package_subscriptions/1/remove_authorized_ip',
    '08c5fa8dd63c8adc4b08803df5f68f9d',
    {
      "ip": "1.2.3.4"
    }
  );
  if (res instanceof Error) {
    console.log("Error:" + res.toString());
  } else {
    console.log(res);
  }
}

main();
require_relative './proxy_api'

begin
  api = ProxyAPI.new("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d")
  puts(api.put("/package_subscriptions/1/add_authorized_ip", ip: '11.22.33.212').inspect)
rescue ProxyAPIException => e
  puts e.message
end
package main

import (
  "fmt"
  "net/http"
)

func main() {
  api := NewProxyAPI("https://app.privateproxy.me/api/v1", "08c5fa8dd63c8adc4b08803df5f68f9d", &http.Client{})

  ip := "{\"ip\": \"1.7.2.5\"}"
  resp, _, err := api.Put("/package_subscriptions/1/remove_authorized_ip", ip)
  if err != nil {
    fmt.Println(err)
  } else {
    fmt.Println(resp)
  }
}

Last Updated on February 22, 2023

Do you recommend the proxy service?

Click on a trophy to award it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Leave a Comment

Your email address will not be published. Required fields are marked *

en_USEnglish
Scroll to Top