POST /apiv2/address/rotate
ڈپازٹ ایڈریس تبدیل کرنے (rotate) کی درخواست کریں۔ موجودہ ڈپازٹ ایڈریس کو ایک نئے ایڈریس سے بدل دیا جائے گا۔ درخواست کو پروسیسنگ کی قطار میں رکھا جاتا ہے اور 5 منٹ کے اندر خودکار طور پر مکمل کر دیا جاتا ہے۔
Endpoint URL
POST https://netts.io/apiv2/address/rotateRequest ہیڈرز
| Header | مطلوب ہے | تفصیل |
|---|---|---|
| Content-Type | ہاں | application/json |
| X-API-KEY | ہاں | آپ کی Netts ڈیش بورڈ سے حاصل کردہ API کی |
| X-Real-IP | ہاں | آپ کی وائٹ لسٹ سے IP ایڈریس |
Request باڈی
json
{
"user_id": 1234,
"address_type": "web"
}Request پیرامیٹرز
| Parameter | Type | مطلوب ہے | ڈیفالٹ | تفصیل |
|---|---|---|---|---|
| user_id | integer | نہیں | تصدیق شدہ صارف | ٹارگٹ صارف کی ID۔ اپنا ایڈریس تبدیل کرنے کے لیے اسے خالی چھوڑ دیں۔ پیرنٹ صارفین اپنے SUB-user کی ID درج کر سکتے ہیں |
| address_type | string | نہیں | "web" | ایڈریس کی قسم جسے تبدیل کرنا ہے: web یا tg |
تصدیق اور اجازت (Authentication & Authorization)
اس اینڈ پوائنٹ کے لیے تصدیق (authentication) اور اجازت (authorization) دونوں درکار ہیں:
- تصدیق: درست API کی + وائٹ لسٹ سے IP (دیگر اینڈ پوائنٹس کی طرح)
- اجازت:
- اپنا ذاتی ایڈریس تبدیل کرنا — ہمیشہ مجاز ہے
- اپنے SUB-user کا ایڈریس تبدیل کرنا — پیرنٹ صارفین کے لیے مجاز ہے
- کسی دوسرے صارف کا ایڈریس تبدیل کرنا —
403 Forbiddenکے ساتھ مسترد کر دیا جائے گا
مثالیں
cURL
bash
# Rotate own address
curl -X POST https://netts.io/apiv2/address/rotate \
-H "Content-Type: application/json" \
-H "X-API-KEY: your_api_key" \
-H "X-Real-IP: your_whitelisted_ip" \
-d '{"address_type": "web"}'bash
# Rotate SUB-user's address (parent user only)
curl -X POST https://netts.io/apiv2/address/rotate \
-H "Content-Type: application/json" \
-H "X-API-KEY: your_api_key" \
-H "X-Real-IP: your_whitelisted_ip" \
-d '{"user_id": 1234, "address_type": "web"}'Python
python
import requests
url = "https://netts.io/apiv2/address/rotate"
headers = {
"Content-Type": "application/json",
"X-API-KEY": "your_api_key",
"X-Real-IP": "your_whitelisted_ip"
}
# Rotate own address
response = requests.post(url, headers=headers, json={"address_type": "web"})
data = response.json()
if response.status_code == 200:
print(f"Rotation ID: {data['rotation_id']}")
print(f"Old Address: {data['old_address']}")
print(f"Status: {data['status']}")
print(f"Estimated Completion: {data['estimated_completion']}")
else:
print(f"Error: {data.get('detail', 'Unknown error')}")Node.js
javascript
const axios = require('axios');
async function rotateAddress(apiKey, whitelistedIp, addressType = 'web', userId = null) {
const url = 'https://netts.io/apiv2/address/rotate';
const body = { address_type: addressType };
if (userId) body.user_id = userId;
const response = await axios.post(url, body, {
headers: {
'Content-Type': 'application/json',
'X-API-KEY': apiKey,
'X-Real-IP': whitelistedIp
},
timeout: 30000
});
const data = response.data;
console.log(`Rotation ID: ${data.rotation_id}`);
console.log(`Status: ${data.status}`);
console.log(`Old Address: ${data.old_address}`);
return data;
}
// Rotate own address
rotateAddress('your_api_key', 'your_whitelisted_ip')
.then(result => console.log('Submitted:', result.message))
.catch(err => console.error('Error:', err.response?.data || err.message));PHP
php
<?php
$url = 'https://netts.io/apiv2/address/rotate';
$data = json_encode([
'address_type' => 'web'
]);
$options = [
'http' => [
'header' => implode("\r\n", [
"Content-Type: application/json",
"X-API-KEY: your_api_key",
"X-Real-IP: your_whitelisted_ip"
]),
'method' => 'POST',
'content' => $data,
'timeout' => 30
]
];
$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$result = json_decode($response, true);
echo "Rotation ID: {$result['rotation_id']}\n";
echo "Old Address: {$result['old_address']}\n";
echo "Status: {$result['status']}\n";
echo "Message: {$result['message']}\n";
?>جواب
کامیاب جواب (200 OK)
json
{
"rotation_id": 42,
"user_id": 1234,
"address_type": "web",
"old_address": "TCurrentAddress1234567890123456789",
"status": "pending",
"message": "Address rotation request submitted. New address will be assigned within 5 minutes.",
"estimated_completion": "2026-03-14T12:35:00Z"
}Response فیلڈز
| Field | Type | تفصیل |
|---|---|---|
| rotation_id | integer | منفرد روٹیشن ریکویسٹ ID (اسٹیٹس چیک کرنے کے لیے استعمال کریں) |
| user_id | integer | وہ صارف جس کا ایڈریس تبدیل کیا جا رہا ہے |
| address_type | string | تبدیل کی جانے والی ایڈریس کی قسم (web یا tg) |
| old_address | string | تبدیلی سے پہلے کا موجودہ TRON ڈپازٹ ایڈریس |
| status | string | درخواست کی صورتحال: pending |
| message | string | پڑھنے کے قابل اسٹیٹس پیغام |
| estimated_completion | string | تکمیل کا متوقع وقت ISO 8601 فارمیٹ میں |
روٹیشن کا اسٹیٹس چیک کریں
GET /apiv2/address/rotate/status/
پہلے جمع کرائی گئی روٹیشن کی درخواست کی صورتحال چیک کریں۔
bash
curl https://netts.io/apiv2/address/rotate/status/42 \
-H "X-API-KEY: your_api_key" \
-H "X-Real-IP: your_whitelisted_ip"Response:
json
{
"rotation_id": 42,
"user_id": 1234,
"address_type": "web",
"status": "completed",
"old_address": "TOldAddress1234567890123456789012",
"new_address": "TNewAddress1234567890123456789012",
"created_at": "2026-03-14T12:30:00Z",
"completed_at": "2026-03-14T12:34:15Z"
}اسٹیٹس کی ویلیوز
| Status | تفصیل |
|---|---|
pending | درخواست جمع کر دی گئی ہے، پروسیس ہونے کا انتظار ہے |
processing | اس وقت پروسیس کی جا رہی ہے |
completed | نیا ایڈریس کامیابی سے تفویض کر دیا گیا |
failed | روٹیشن کے دوران خرابی پیش آ گئی |
زیر التواء روٹیشن چیک کریں
GET /apiv2/address/rotate/pending
چیک کریں کہ آیا صارف کی کوئی روٹیشن ریکویسٹ زیر التواء (pending) ہے (روٹیشن بٹن کو غیر فعال کرنے کے لیے مفید ہے)۔
bash
curl "https://netts.io/apiv2/address/rotate/pending?address_type=web" \
-H "X-API-KEY: your_api_key" \
-H "X-Real-IP: your_whitelisted_ip"Response:
json
{
"user_id": 1234,
"address_type": "web",
"has_pending": true,
"pending_rotation": {
"rotation_id": 42,
"status": "pending",
"created_at": "2026-03-14T12:30:00Z"
}
}نوٹس
ایڈریس کی تبدیلی
روٹیشن مکمل ہونے کے بعد، آپ کا موجودہ ڈپازٹ ایڈریس مزید ڈپازٹس قبول نہیں کرے گا۔ درج ذیل باتوں کو یقینی بنائیں:
- روٹیشن کی درخواست کرنے سے پہلے موجودہ ایڈریس سے تمام بقایا رقم نکال لیں
- اپنے پرانے ڈپازٹ ایڈریس کا حوالہ دینے والے کسی بھی بیرونی سسٹم کو اپ ڈیٹ کریں
- تمام آئندہ ڈپازٹس کے لیے نیا ایڈریس استعمال کریں
پروسیسنگ کا وقت
روٹیشن کی درخواستیں خودکار طریقے سے پروسیس کی جاتی ہیں۔ نیا ایڈریس عام طور پر جمع کرانے کے 5 منٹ کے اندر تفویض کر دیا جاتا ہے۔
- 7 دن کے اندر فی صارف فی ایڈریس کی قسم صرف ایک زیر التواء روٹیشن کی اجازت ہے
- اگر آپ کے پاس پہلے سے کوئی زیر التواء روٹیشن موجود ہے، تو درخواست
409 Conflictکے ساتھ مسترد کر دی جائے گی webاورtgدونوں ایڈریسز کو الگ الگ تبدیل کیا جا سکتا ہے- پیرنٹ صارفین
user_idپیرامیٹر فراہم کر کے اپنے SUB-users کے ایڈریسز کو تبدیل کر سکتے ہیں
خرابی کے Responses
تعارض (409)
json
{
"detail": "User 1234 already has a pending web address rotation request"
}غلط درخواست (400)
json
{
"detail": "User 1234 has no web deposit address"
}json
{
"detail": "address_type must be 'web' or 'tg'"
}نہیں ملا (404)
json
{
"detail": "User 9999 not found"
}ممنوع (403)
json
{
"detail": "Not authorized to rotate this user's address"
}تصدیقی خرابی (401)
json
{
"detail": "X-API-KEY header required"
}خرابی کے کوڈز کا حوالہ
| HTTP Status | تفصیل |
|---|---|
200 | روٹیشن کی درخواست کامیابی سے جمع ہو گئی |
400 | غلط درخواست (ایڈریس موجود نہیں، غلط قسم) |
401 | API کی ہیڈر غائب ہے |
403 | مجاز نہیں ہے / غلط API کی یا IP |
404 | صارف نہیں ملا / روٹیشن نہیں ملی |
409 | زیر التواء روٹیشن پہلے سے موجود ہے |
500 | اندرونی سرور کی خرابی (Internal server error) |
متعلقہ اینڈ پوائنٹس
- POST /apiv2/subusergen — نیا SUB-user بنائیں
- DELETE /apiv2/subuserdel — SUB-user حذف کریں
- GET /apiv2/userinfo — صارف کی معلومات حاصل کریں