Modify Token
/resi/tokenAuthentication
Basic username/password authentication
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| token | string | Required | The token to modify |
| password | string | Optional | Password for authentication. Must be exactly 8 characters Validation: Must be exactly 8 characters |
| allowedPools | array[string] | Optional | Array of allowed proxy pools. If empty, token can use all pools Validation: Array of valid pool identifiers |
| dataLimit | integer | Optional | Maximum data limit in bytes. Token expires when dataUsage >= dataLimit Validation: Must be at least 1000000 (1 MB) |
| durationHours | integer | Optional | Number of hours until the token expires. If set to 0, token will not expire based on time. The expiration time is calculated from the token's original creation date. Maximum value is 87600 (10 years) Validation: Must be a non-negative integer, maximum 87600 (10 years) |
token
RequiredThe token to modify
password
OptionalPassword for authentication. Must be exactly 8 characters
Must be exactly 8 characters
allowedPools
OptionalArray of allowed proxy pools. If empty, token can use all pools
Array of valid pool identifiers
dataLimit
OptionalMaximum data limit in bytes. Token expires when dataUsage >= dataLimit
Must be at least 1000000 (1 MB)
durationHours
OptionalNumber of hours until the token expires. If set to 0, token will not expire based on time. The expiration time is calculated from the token's original creation date. Maximum value is 87600 (10 years)
Must be a non-negative integer, maximum 87600 (10 years)
Code Example
- NodeJS
- Python
- PHP
- Java
- C#
- cURL
- Javascript
- Go
const axios = require('axios');
const url = "https://api.unknownproxies.com/api/v1/resi/token";
const headers = {
"Authorization": "Basic dXNlcjpwYXNz",
"Content-Type": "application/json"
};
const data = {
"token": "your-token-here",
"password": "your-password-here",
"allowedPools": [],
"dataLimit": 0,
"durationHours": 0
};
try {
const response = await axios.patch(url, {
headers,
data
});
console.log(response.data);
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
import requests
import json
url = "https://api.unknownproxies.com/api/v1/resi/token"
headers = {
"Authorization": "Basic dXNlcjpwYXNz",
"Content-Type": "application/json"
}
data = {
"token": "your-token-here",
"password": "your-password-here",
"allowedPools": [],
"dataLimit": 0,
"durationHours": 0
}
response = requests.patch(
url,
headers=headers,
json=data
)
print(response.json())
<?php
$url = "https://api.unknownproxies.com/api/v1/resi/token";
$headers = [
"Authorization: Basic dXNlcjpwYXNz",
"Content-Type: application/json"
];
$data = {
"token": "your-token-here",
"password": "your-password-here",
"allowedPools": [],
"dataLimit": 0,
"durationHours": 0
};
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import com.google.gson.Gson;
public class ApiClient {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String url = "https://api.unknownproxies.com/api/v1/resi/token";
String auth = "Basic dXNlcjpwYXNz";
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", auth)
.header("Content-Type", "application/json");
// Add request body if needed
String jsonBody = {
"token": "your-token-here",
"password": "your-password-here",
"allowedPools": [],
"dataLimit": 0,
"durationHours": 0
};
HttpRequest request = requestBuilder
.patch(HttpRequest.BodyPublishers.ofString(jsonBody))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http.Headers;
using Newtonsoft.Json;
public class Program
{
public static async Task Main()
{
using var client = new HttpClient();
var url = "https://api.unknownproxies.com/api/v1/resi/token";
// Set basic auth
var authToken = Convert.ToBase64String(Encoding.UTF8.GetBytes("user:pass"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authToken);
var data = new {
// Define your request object here
};
var json = JsonConvert.SerializeObject(data);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.patchAsync(url, content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
curl -X PATCH "https://api.unknownproxies.com/api/v1/resi/token" \
-H "Authorization: Basic dXNlcjpwYXNz" \
-H "Content-Type: application/json" \
-d '{
"token": "your-token-here",
"password": "your-password-here",
"allowedPools": [],
"dataLimit": 0,
"durationHours": 0
}'
const response = await fetch("https://api.unknownproxies.com/api/v1/resi/token", {
method: "PATCH",
headers: {
"Authorization": "Basic dXNlcjpwYXNz",
"Content-Type": "application/json"
},
body: {
"token": "your-token-here",
"password": "your-password-here",
"allowedPools": [],
"dataLimit": 0,
"durationHours": 0
}
});
const data = await response.json();
console.log(data);
package main
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.unknownproxies.com/api/v1/resi/token"
reqBody := `
{
"token": "your-token-here",
"password": "your-password-here",
"allowedPools": [],
"dataLimit": 0,
"durationHours": 0
}
`
var body io.Reader
if reqBody != "" {
var buf bytes.Buffer
if err := json.Compact(&buf, []byte(reqBody)); err == nil {
body = bytes.NewBuffer(buf.Bytes())
} else {
body = bytes.NewBuffer([]byte(reqBody))
}
}
req, _ := http.NewRequest("PATCH", url, body)
token := base64.StdEncoding.EncodeToString([]byte("user:pass"))
req.Header.Set("Authorization", "Basic "+token)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
b, _ := io.ReadAll(resp.Body)
fmt.Println(string(b))
}
Response Example
{
"token": "zu8sBXS4gkh7",
"username": "kGyohRda",
"authType": "user",
"password": "bkXBberMQ7",
"durationHours": 750,
"status": "active",
"createdAt": 1752251968,
"updatedAt": 1754843968,
"dataUsage": 11574848653,
"dataLimit": 100000000000,
"allowedPools": ["us-s", "us-r", "tickets-us-s", "tickets-us-r", "ca-s", "ca-r", "gb-s", "gb-r"]
}What Can Be Modified
You can modify the following aspects of a residential token:
- Allowed Pools (
allowedPools) - Control which proxy pools the token can access - Data Limit (
dataLimit) - Increase the maximum data usage limit in bytes. The value must be supplied in whole gigabyte increments (multiples of 1,000,000,000 bytes), and you cannot reduce the data limit below its current value. - Duration Hours (
durationHours) - Modify the token expiration time
Residential tokens always use generated username/password credentials. IP-based authentication is not available for residential proxies. The password is automatically generated when the token is created and cannot be modified.
At least one of the optional fields above must be provided in the request body.
Duration Hours Modification
When you modify durationHours, the new value replaces the token's validity period. The expiration time is calculated from the token's original createdAt timestamp:
- Expiration calculation:
expirationTime = createdAt + durationHours - Increasing duration: If you increase
durationHourson an expired token (wherecreatedAt + oldDurationHours <= currentTime), the token will become active again and proxy requests will resume working (as long asdataUsage < dataLimit) - Decreasing duration: You can reduce
durationHours. However, if the new value makescreatedAt + durationHours <= currentTime, the token will immediately become inactive and proxy requests will cease to work - Maximum duration: The maximum allowed
durationHoursvalue is 87,600 (10 years)
Related Operations
After modifying a token, you might want to:
- Retrieve Residential Token - Verify the modifications were applied correctly
- List All Residential Tokens - View all your tokens and their current settings
For complete details on all token fields, see the Residential Token Schema documentation.