# Packetstream

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

### How to generate sticky proxies:

* Countries are uppercase country codes. All supported countries are listed below.

```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,
  username,
  password,
) {
  proxy = [];
  for (var i = 0; i < amount; i++) {
    proxy.push(
      `pkt.x.proxiess.com:31112:${username}:${password}-country-${country}_session-${random_string(
        7
      )}\n`
    );
  }
	return proxy.join("");
}
```

* Session ( add this under sticky proxy generation )

  The `_session-` key instructs our routing system to either create or resolve a unique session for the connection. The value assigned to this key must be a random alphanumeric string, precisely 8 characters in length. This ensures the uniqueness and integrity of the session.

#### **How to Generate PacketStream EU sticky proxies:**

```
pkteu.x.proxiess.com:31113:<username>:<password>-country-<country>_session-<session id>
```

#### **How to Generate PacketStream Asia sticky proxies:**

```
pktasia.x.proxiess.com:31114:<username>:<password>-country-<country>_session-<session id>
```

### How to generate rotating proxies:

```javascript
function proxyGenerationRotating(
  amount,
  country,
  username,
  password,
) {
  proxy = [];
  for (var i = 0; i < amount; i++) {
    proxy.push(
      `pkt.x.proxiess.com:31112:${username}:${password}-country-${country}\n`
    );
  }
	return proxy.join("");
}
```

#### How to Generate PacketStream EU rotating proxies:

```
pkteu.x.proxiess.com:31113:<username>:<password>-country-<country>
```

#### How to Generate PacketStream Asia rotating proxies:

```
pktasia.x.proxiess.com:31114:<username>:<password>-country-<country>
```

### Supported Countries:

```javascript
{
    AE: { name: "UnitedArabEmirates", display: "United Arab Emirates" },
    AF: { name: "Afghanistan", display: "Afghanistan" },
    AL: { name: "Albania", display: "Albania" },
    AM: { name: "Armenia", display: "Armenia" },
    AR: { name: "Argentina", display: "Argentina" },
    AT: { name: "Austria", display: "Austria" },
    AU: { name: "Australia", display: "Australia" },
    AW: { name: "Aruba", display: "Aruba" },
    AZ: { name: "Azerbaijan", display: "Azerbaijan" },
    BA: { name: "BosniaandHerzegovina", display: "Bosnia and Herzegovina" },
    BD: { name: "Bangladesh", display: "Bangladesh" },
    BE: { name: "Belgium", display: "Belgium" },
    BG: { name: "Bulgaria", display: "Bulgaria" },
    BH: { name: "Bahrain", display: "Bahrain" },
    BN: { name: "Brunei", display: "Brunei" },
    BR: { name: "Brazil", display: "Brazil" },
    BS: { name: "Bahamas", display: "Bahamas" },
    BY: { name: "Belarus", display: "Belarus" },
    CA: { name: "Canada", display: "Canada" },
    CH: { name: "Switzerland", display: "Switzerland" },
    CL: { name: "Chile", display: "Chile" },
    CM: { name: "Cameroon", display: "Cameroon" },
    CN: { name: "China", display: "China" },
    CO: { name: "Colombia", display: "Colombia" },
    CR: { name: "CostaRica", display: "CostaRica" },
    CU: { name: "Cuba", display: "Cuba" },
    CY: { name: "Cyprus", display: "Cyprus" },
    CZ: { name: "Czechia", display: "Czechia" },
    DE: { name: "Germany", display: "Germany" },
    DK: { name: "Denmark", display: "Denmark" },
    DO: { name: "DominicanRepublic", display: "Dominican Republic" },
    DZ: { name: "Algeria", display: "Algeria" },
    EC: { name: "Ecuador", display: "Ecuador" },
    EE: { name: "Estonia", display: "Estonia" },
    EG: { name: "Egypt", display: "Egypt" },
    ES: { name: "Spain", display: "Spain" },
    ET: { name: "Ethiopia", display: "Ethiopia" },
    FI: { name: "Finland", display: "Finland" },
    FR: { name: "France", display: "France" },
    GB: { name: "Ireland", display: "Ireland" },
    GE: { name: "Georgia", display: "Georgia" },
    GH: { name: "Ghana", display: "Ghana" },
    GR: { name: "Greece", display: "Greece" },
    GS: { name: "Georgia", display: "Georgia" },
    GT: { name: "Guatemala", display: "Guatemala" },
    GY: { name: "Guyana", display: "Guyana" },
    HK: { name: "HongKong", display: "HongKong" },
    HR: { name: "Croatia", display: "Croatia" },
    HU: { name: "Hungary", display: "Hungary" },
    ID: { name: "Indonesia", display: "Indonesia" },
    IE: { name: "Ireland", display: "Ireland" },
    IL: { name: "Israel", display: "Israel" },
    IN: { name: "India", display: "India" },
    IO: { name: "India", display: "India" },
    IQ: { name: "Iraq", display: "Iraq" },
    IR: { name: "Iran", display: "Iran" },
    IT: { name: "Italy", display: "Italy" },
    JM: { name: "Jamaica", display: "Jamaica" },
    JO: {
      name: "HashemiteKingdomofJordan",
      display: "Hashemite Kingdom of Jordan",
    },
    JP: { name: "Japan", display: "Japan" },
    KE: { name: "Kenya", display: "Kenya" },
    KH: { name: "Cambodia", display: "Cambodia" },
    KR: { name: "SouthKorea", display: "South Korea" },
    KW: { name: "Kuwait", display: "Kuwait" },
    KZ: { name: "Kazakhstan", display: "Kazakhstan" },
    LI: { name: "Liechtenstein", display: "Liechtenstein" },
    LK: { name: "SriLanka", display: "Sri Lanka" },
    LT: { name: "RepublicofLithuania", display: "Republic of Lithuania" },
    LU: { name: "Luxembourg", display: "Luxembourg" },
    LV: { name: "Latvia", display: "Latvia" },
    MA: { name: "Morocco", display: "Morocco" },
    MD: { name: "RepublicofMoldova", display: "Republic of Moldova" },
    ME: { name: "Montenegro", display: "Montenegro" },
    MG: { name: "Madagascar", display: "Madagascar" },
    MK: { name: "Macedonia", display: "Macedonia" },
    MM: { name: "Myanmar", display: "Myanmar" },
    MN: { name: "Mongolia", display: "Mongolia" },
    MU: { name: "Mauritius", display: "Mauritius" },
    MX: { name: "Mexico", display: "Mexico" },
    MY: { name: "Malaysia", display: "Malaysia" },
    MZ: { name: "Mozambique", display: "Mozambique" },
    NG: { name: "Nigeria", display: "Nigeria" },
    NL: { name: "Netherlands", display: "Netherlands" },
    NO: { name: "Norway", display: "Norway" },
    NP: { name: "Nepal", display: "Nepal" },
    OM: { name: "Oman", display: "Oman" },
    PA: { name: "Panama", display: "Panama" },
    PE: { name: "Peru", display: "Peru" },
    PG: { name: "PapuaNewGuinea", display: "Papua New Guinea" },
    PH: { name: "Philippines", display: "Philippines" },
    PK: { name: "Pakistan", display: "Pakistan" },
    PL: { name: "Poland", display: "Poland" },
    PR: { name: "PuertoRico", display: "Puerto Rico" },
    PS: { name: "Palestine", display: "Palestine" },
    PT: { name: "Portugal", display: "Portugal" },
    PY: { name: "Paraguay", display: "Paraguay" },
    QA: { name: "Qatar", display: "Qatar" },
    RO: { name: "Romania", display: "Romania" },
    RS: { name: "Serbia", display: "Serbia" },
    RU: { name: "Russia", display: "Russia" },
    SA: { name: "SaudiArabia", display: "Saudi Arabia" },
    SC: { name: "Seychelles", display: "Seychelles" },
    SD: { name: "Sudan", display: "Sudan" },
    SE: { name: "Sweden", display: "Sweden" },
    SG: { name: "Singapore", display: "Singapore" },
    SI: { name: "Slovenia", display: "Slovenia" },
    SK: { name: "Slovakia", display: "Slovakia" },
    SN: { name: "Senegal", display: "Senegal" },
    SO: { name: "Somalia", display: "Somalia" },
    SR: { name: "Suriname", display: "Suriname" },
    SS: { name: "Sudan", display: "Sudan" },
    SV: { name: "ElSalvador", display: "ElSalvador" },
    SY: { name: "Syria", display: "Syria" },
    TH: { name: "Thailand", display: "Thailand" },
    TJ: { name: "Tajikistan", display: "Tajikistan" },
    TN: { name: "Tunisia", display: "Tunisia" },
    TR: { name: "Turkey", display: "Turkey" },
    TT: { name: "TrinidadandTobago", display: "Trinidad and Tobago" },
    TW: { name: "Taiwan", display: "Taiwan" },
    UA: { name: "Ukraine", display: "Ukraine" },
    UG: { name: "Uganda", display: "Uganda" },
    US: { name: "UnitedStates", display: "United States" },
    UK: { name: "UnitedKingdom", display: "United Kingdom" },
    UZ: { name: "Uzbekistan", display: "Uzbekistan" },
    VE: { name: "Venezuela", display: "Venezuela" },
    VG: { name: "BritishVirginIslands", display: "British Virgin Islands" },
    VN: { name: "Vietnam", display: "Vietnam" },
    XK: { name: "Kosovo", display: "Kosovo" },
    ZA: { name: "SouthAfrica", display: "South Africa" },
    ZM: { name: "Zambia", display: "Zambia" },
  }
```

### White labeling

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

To brand the proxies under your domain follow these steps:

1. Open the DNS configuration for your domain.
2. Create a CNAME Record pointing to the domain.
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 or whatever you want to call it pointing to the PacketStream 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%2FpgyDDXg4V5L08DoxS5kh%2FCleanShot%202025-01-29%20at%208%E2%80%AF.29.14.jpg?alt=media&#x26;token=3709c29c-5bfc-473c-bbcc-8d8023c81751" 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":1634146275996}`</mark> 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://basic.proxiesapi.xyz/proxy_api/v1/basic/users/add_balance>' \\
         --data-raw '{
						"username": "lqwdqqwoidasdq",
				    "data_gb": 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 POST '<https://basic.proxiesapi.xyz/proxy_api/v1/basic/users/get/lqwdqqwoi>' \\
       -H "Authorization: Bearer <your api token>"
```
