Skip to content
Translated page. The English version is the source of truth.

POST /apiv2/address/rotate

ส่งคำขอเปลี่ยนที่อยู่สำหรับการฝาก ที่อยู่สำหรับการฝากปัจจุบันจะถูกแทนที่ด้วยที่อยู่ใหม่ คำขอจะถูกจัดเข้าคิวประมวลผลและเสร็จสมบูรณ์โดยอัตโนมัติภายใน 5 นาที

URL ของ Endpoint

POST https://netts.io/apiv2/address/rotate

Headers ของคำขอ

ส่วนหัวจำเป็นคำอธิบาย
Content-Typeใช่application/json
X-API-KEYใช่คีย์ API ของคุณจากแดชบอร์ด Netts
X-Real-IPใช่ที่อยู่ IP จากรายการที่อนุญาต (whitelist) ของคุณ

เนื้อหาคำขอ

json
{
    "user_id": 1234,
    "address_type": "web"
}

พารามิเตอร์

พารามิเตอร์ชนิดจำเป็นค่าเริ่มต้นคำอธิบาย
user_idintegerไม่ผู้ใช้ที่ยืนยันตัวตนแล้วID ผู้ใช้เป้าหมาย เว้นว่างไว้เพื่อเปลี่ยนที่อยู่ของตัวคุณเอง ผู้ใช้หลัก (Parent user) สามารถระบุ ID ของผู้ใช้ย่อย (SUB-user) ได้
address_typestringไม่"web"ประเภทที่อยู่ที่จะเปลี่ยน: web หรือ tg

การยืนยันตัวตนและการอนุญาตสิทธิ์

Endpoint นี้ต้องการทั้ง การยืนยันตัวตน (authentication) และ การอนุญาตสิทธิ์ (authorization):

  1. การยืนยันตัวตน: คีย์ API ที่ถูกต้อง + IP จากรายการที่อนุญาต (เหมือนกับ Endpoint อื่นๆ)
  2. การอนุญาตสิทธิ์:
    • เปลี่ยนที่อยู่ของ ตัวคุณเอง — ได้รับอนุญาตเสมอ
    • เปลี่ยนที่อยู่ของ ผู้ใช้ย่อย (SUB-user) ของคุณ — อนุญาตสำหรับผู้ใช้หลัก
    • เปลี่ยนที่อยู่ของผู้ใช้อื่น — จะถูกปฏิเสธด้วย 403 Forbidden

ตัวอย่างคำขอ

cURL

bash
# เปลี่ยนที่อยู่ของตนเอง
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
# เปลี่ยนที่อยู่ของผู้ใช้ย่อย (SUB-user) (เฉพาะผู้ใช้หลักเท่านั้น)
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"
}

# เปลี่ยนที่อยู่ของตนเอง
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;
}

// เปลี่ยนที่อยู่ของตนเอง
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"
}

ฟิลด์การตอบกลับ

ฟิลด์ชนิดคำอธิบาย
rotation_idintegerID คำขอเปลี่ยนที่อยู่ที่ไม่ซ้ำกัน (ใช้สำหรับการตรวจสอบสถานะ)
user_idintegerผู้ใช้ที่กำลังถูกเปลี่ยนที่อยู่
address_typestringประเภทที่อยู่ที่จะเปลี่ยน (web หรือ tg)
old_addressstringที่อยู่การฝาก TRON ปัจจุบันก่อนที่จะทำการเปลี่ยน
statusstringสถานะคำขอ: pending
messagestringข้อความสถานะที่มนุษย์สามารถอ่านเข้าใจได้
estimated_completionstringเวลาที่คาดว่าจะเสร็จสมบูรณ์ในรูปแบบ 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"

การตอบกลับ:

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"
}

ค่าสถานะ

สถานะคำอธิบาย
pendingส่งคำขอแล้ว กำลังรอการประมวลผล
processingกำลังดำเนินการประมวลผล
completedกำหนดที่อยู่ใหม่สำเร็จเรียบร้อยแล้ว
failedเกิดข้อผิดพลาดระหว่างการเปลี่ยนที่อยู่

ตรวจสอบการเปลี่ยนที่อยู่ที่รอดำเนินการ

GET /apiv2/address/rotate/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"

การตอบกลับ:

json
{
    "user_id": 1234,
    "address_type": "web",
    "has_pending": true,
    "pending_rotation": {
        "rotation_id": 42,
        "status": "pending",
        "created_at": "2026-03-14T12:30:00Z"
    }
}

หมายเหตุสำคัญ

การเปลี่ยนแปลงที่อยู่

หลังจากการเปลี่ยนที่อยู่เสร็จสมบูรณ์ ที่อยู่การฝากปัจจุบันของคุณจะไม่ยอมรับการฝากอีกต่อไป โปรดตรวจสอบให้แน่ใจว่า:

  1. ถอนยอดคงเหลือที่เหลืออยู่ทั้งหมดออกจากที่อยู่ปัจจุบันก่อนที่จะส่งคำขอเปลี่ยนที่อยู่
  2. อัปเดตระบบภายนอกใดๆ ที่อ้างอิงถึงที่อยู่การฝากเดิมของคุณ
  3. ใช้ที่อยู่ใหม่สำหรับการฝากเงินทั้งหมดในอนาคต

ระยะเวลาการประมวลผล

คำขอเปลี่ยนที่อยู่จะได้รับการประมวลผลโดยอัตโนมัติ โดยทั่วไปที่อยู่ใหม่จะได้รับการกำหนดภายใน 5 นาที หลังจากการส่งคำขอ

  • อนุญาตให้มี คำขอเปลี่ยนที่อยู่ที่รอดำเนินการได้เพียงหนึ่งรายการ ต่อผู้ใช้ต่อประเภทที่อยู่ภายในกรอบเวลา 7 วัน
  • หากคุณมีคำขอเปลี่ยนที่อยู่ที่รอดำเนินการอยู่แล้ว คำขอจะถูกปฏิเสธด้วย 409 Conflict
  • สามารถเปลี่ยนที่อยู่ทั้ง web และ tg ได้อย่างอิสระแยกจากกัน
  • ผู้ใช้หลักสามารถเปลี่ยนที่อยู่ของผู้ใช้ย่อยได้โดยระบุพารามิเตอร์ user_id

การตอบกลับข้อผิดพลาด

ขัดแย้ง (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คำอธิบาย
200ส่งคำขอเปลี่ยนที่อยู่สำเร็จเรียบร้อยแล้ว
400คำขอไม่ถูกต้อง (ไม่มีที่อยู่, ประเภทไม่ถูกต้อง)
401ส่วนหัวคีย์ API ขาดหายไป
403ไม่ได้รับอนุญาต / คีย์ API หรือ IP ไม่ถูกต้อง
404ไม่พบผู้ใช้ / ไม่พบข้อมูลการเปลี่ยนที่อยู่
409มีคำขอเปลี่ยนที่อยู่ที่รอดำเนินการอยู่แล้ว
500ข้อผิดพลาดภายในเซิร์ฟเวอร์

Endpoint ที่เกี่ยวข้อง