# Private

{% hint style="info" %}
API documentation: <https://torchlabs.readme.io/>
{% endhint %}

{% hint style="info" %}
Base Domain: **159.89.245.182:5500**
{% endhint %}

### How to generate sticky proxies:

```javascript
const random_string = (length) => {
  var result = "";
  var characters = "abcdefghijklmnopqrstuvwxyz1234567890";
  var charactersLength = characters.length;
  for (var i = 0; i < length; i++) {
    result += characters.charAt(Math.floor(Math.random() * charactersLength));
  }
  return result;
};
 
function proxyGenerationSticky(amount, country, password) {
  proxy = [];
  const domain = "159.89.245.182**";**
  for (var i = 0; i < parseInt(amount); i++) {
    proxy.push(
      `${domain}:5500:country-${country.toLowerCase()}-session-${random_string(32)}:${password}\\n`
    );
  }
	return proxy.join("");
}
```

### How to generate rotating proxies:

```javascript
async function proxyGenerationRotating(amount, country, password) {
  proxy = [];
  const domain = "159.89.245.182**"**
  for (var i = 0; i < parseInt(amount); i++) {
    proxy.push(`${domain}:5500:country-${country.toLowerCase()}:${password}\\n`);
  }
  return proxy.join("");
}
```

### Supported countries:

```javascript
const premium_countries = {
    GB: { display: "United Kingdom" },
    SI: { display: "Slovenia" },
    IT: { display: "Italy" },
    FR: { display: "France" },
    LV: { display: "Latvia" },
    CZ: { display: "Czechia" },
    PH: { display: "Philippines" },
    MA: { display: "Morocco" },
    UG: { display: "Uganda" },
    RU: { display: "Russian Federation" },
    TR: { display: "Turkey" },
    TH: { display: "Thailand" },
    BD: { display: "Bangladesh" },
    ES: { display: "Spain" },
    MT: { display: "Malta" },
    GR: { display: "Greece" },
    VN: { display: "Viet Nam" },
    BF: { display: "Burkina Faso" },
    US: { display: "United States" },
    AL: { display: "Albania" },
    DZ: { display: "Algeria" },
    JP: { display: "Japan" },
    KE: { display: "Kenya" },
    HU: { display: "Hungary" },
    RO: { display: "Romania" },
    ID: { display: "Indonesia" },
    NG: { display: "Nigeria" },
    IN: { display: "India" },
    AF: { display: "Afghanistan" },
    CN: { display: "China" },
    LK: { display: "Sri Lanka" },
    CO: { display: "Colombia" },
    MX: { display: "Mexico" },
    RS: { display: "Serbia" },
    DO: { display: "Dominican Republic" },
    IE: { display: "Ireland" },
    IR: { display: "Iran, Islamic Republic of" },
    BR: { display: "Brazil" },
    EG: { display: "Egypt" },
    MV: { display: "Maldives" },
    UA: { display: "Ukraine" },
    CH: { display: "Switzerland" },
    MH: { display: "Marshall Islands" },
    PE: { display: "Peru" },
    TZ: { display: "Tanzania, United Republic of" },
    VE: { display: "Venezuela, Bolivarian Republic of" },
    AR: { display: "Argentina" },
    LY: { display: "Libya" },
    TW: { display: "Taiwan, Province of China" },
    HR: { display: "Croatia" },
    SE: { display: "Sweden" },
    BT: { display: "Bhutan" },
    NO: { display: "Norway" },
    PG: { display: "Papua New Guinea" },
    PT: { display: "Portugal" },
    YE: { display: "Yemen" },
    FI: { display: "Finland" },
    NP: { display: "Nepal" },
    NZ: { display: "New Zealand" },
    UY: { display: "Uruguay" },
    AO: { display: "Angola" },
    HN: { display: "Honduras" },
    IQ: { display: "Iraq" },
    NL: { display: "Netherlands" },
    PY: { display: "Paraguay" },
    SO: { display: "Somalia" },
    CF: { display: "Central African Republic" },
    SD: { display: "Sudan" },
    BI: { display: "Burundi" },
    DE: { display: "Germany" },
    KR: { display: "Korea, Republic of" },
    KZ: { display: "Kazakhstan" },
    MY: { display: "Malaysia" },
    PL: { display: "Poland" },
    PS: { display: "Palestine, State of" },
    CL: { display: "Chile" },
    CU: { display: "Cuba" },
    EE: { display: "Estonia" },
    SN: { display: "Senegal" },
    SV: { display: "El Salvador" },
    SY: { display: "Syrian Arab Republic" },
    UZ: { display: "Uzbekistan" },
    BE: { display: "Belgium" },
    CA: { display: "Canada" },
    NA: { display: "Namibia" },
    SA: { display: "Saudi Arabia" },
    BJ: { display: "Benin" },
    GE: { display: "Georgia" },
    JO: { display: "Jordan" },
    PA: { display: "Panama" },
    AM: { display: "Armenia" },
    BB: { display: "Barbados" },
    CG: { display: "Congo" },
    ET: { display: "Ethiopia" },
    KP: { display: "Korea, Democratic People's Republic of" },
    MZ: { display: "Mozambique" },
    WS: { display: "Samoa" },
    DM: { display: "Dominica" },
    LT: { display: "Lithuania" },
    SB: { display: "Solomon Islands" },
    SR: { display: "Suriname" },
    SS: { display: "South Sudan" },
    ZW: { display: "Zimbabwe" },
    AT: { display: "Austria" },
    BW: { display: "Botswana" },
    GA: { display: "Gabon" },
    IS: { display: "Iceland" },
    OM: { display: "Oman" },
    SM: { display: "San Marino" },
    ZA: { display: "South Africa" },
    ZM: { display: "Zambia" },
    AG: { display: "Antigua and Barbuda" },
    AU: { display: "Australia" },
    KG: { display: "Kyrgyzstan" },
    LB: { display: "Lebanon" },
    PK: { display: "Pakistan" },
    SK: { display: "Slovakia" },
    AE: { display: "United Arab Emirates" },
    BY: { display: "Belarus" },
    CR: { display: "Costa Rica" },
    QA: { display: "Qatar" },
    BZ: { display: "Belize" },
    CY: { display: "Cyprus" },
    IL: { display: "Israel" },
    KW: { display: "Kuwait" },
    MG: { display: "Madagascar" },
    TM: { display: "Turkmenistan" },
    BH: { display: "Bahrain" },
    DK: { display: "Denmark" },
    FJ: { display: "Fiji" },
    SG: { display: "Singapore" },
    TG: { display: "Togo" },
    TO: { display: "Tonga" },
    BN: { display: "Brunei Darussalam" },
    GL: { display: "Greenland" },
    SL: { display: "Sierra Leone" },
    SZ: { display: "Eswatini" },
    KI: { display: "Kiribati" },
    KM: { display: "Comoros" },
    LU: { display: "Luxembourg" },
    TJ: { display: "Tajikistan" },
    HK: { display: "Hong Kong" },
  }
```

#### White labeling

Use this method to brand your proxies with your own domain/comapny name

To brand the proxies under your domain follow these steps:

1. Open the DNS configuration for your domain.
2. Create a A Name Record pointing to the domain {**159.89.245.182}**.
3. Whatever you enter in 'host' will decide the domain which points to our API IP.
4. Thus if your domain is [API.com](http://api.com/) and you enter the host premium pointing to the oxylabs domain, your proxies will be formatted [premium.yourdomain.com](http://premium.yourdomain.com/):port:user:pass
5. An example on Godaddy is linked below:

<figure><img src="https://633083225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsxMhtMHGoOKgipGL3q34%2Fuploads%2FcktM78ZzoLbJYSTzlzui%2F7.png?alt=media&#x26;token=86a0f573-c950-47fe-b9a6-e6e713afaeef" alt=""><figcaption></figcaption></figure>

### FAQ

* What is Authorization?

This is a header value you provide with every request. We are using Bearer token so send in the header like this: <mark style="color:red;">`"Authorization: Bearer <your api token>"`</mark>

* Im getting this error: <mark style="color:red;">`{"message":"user_id cannot be null or undefined.","timestamp"`</mark>`:1634146275996}` how do I fix it?

Make sure you have this <mark style="color:red;">`"Content-Type": "application/json"`</mark> header present in your requests.

#### Headers

Please check on how to send requests with headers in whichever languages you are using.

POST Request:

```javascript
{
	"Authorization": "Bearer <your api token>",
	"Content-Type": "application/json"
} 
```

```javascript
# Sample curl request
curl --location --request POST '<https://premium.proxiesapi.xyz/proxy_api/v1/premium/users/add_balance>' \\
         --data-raw '{
         "user_id": "f2f27683-04f8-4a84-bf23-2dfa29b6b6ec",
         "data_gb": 0.1
     }' -H "Authorization: Bearer <your api token>" -H "Content-Type: application/json"
```

GET Request:

```javascript
{
	"Authorization": "Bearer <your api token>",
}
```

```javascript
# Sample curl request
curl --location --request GET '<https://premium.proxiesapi.xyz/proxy_api/v1/premium/users/092fe926-9c52-4b72-92b4-6f0a84bd7f69>' \\
          -H "Authorization: Bearer <your api token>"
```
