Skip to content

POST /apiv2/address/rotate

Request a deposit address rotation. The current deposit address will be replaced with a new one. The request is placed in a processing queue and completed automatically within 5 minutes.

Endpoint URL

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

Request Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
X-API-KEYYesYour API key from Netts dashboard
X-Real-IPYesIP address from your whitelist

Request Body

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

Parameters

ParameterTypeRequiredDefaultDescription
user_idintegerNoAuthenticated userTarget user ID. Omit to rotate your own address. Parent users can specify their SUB-user's ID
address_typestringNo"web"Address type to rotate: web or tg

Authentication & Authorization

This endpoint requires both authentication and authorization:

  1. Authentication: Valid API key + IP from whitelist (same as other endpoints)
  2. Authorization:
    • Rotate your own address — always allowed
    • Rotate your SUB-user's address — allowed for parent users
    • Rotate another user's address — rejected with 403 Forbidden

Example Requests

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";
?>

Response

Success Response (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 Fields

FieldTypeDescription
rotation_idintegerUnique rotation request ID (use for status checks)
user_idintegerUser whose address is being rotated
address_typestringAddress type being rotated (web or tg)
old_addressstringCurrent TRON deposit address before rotation
statusstringRequest status: pending
messagestringHuman-readable status message
estimated_completionstringEstimated completion time in ISO 8601 format

Check Rotation Status

GET /apiv2/address/rotate/status/

Check the status of a previously submitted rotation request.

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 Values

StatusDescription
pendingRequest submitted, waiting to be processed
processingCurrently being processed
completedNew address assigned successfully
failedError occurred during rotation

Check Pending Rotation

GET /apiv2/address/rotate/pending

Check if a user has a pending rotation request (useful for disabling the rotation button).

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

Important Notes

Address Change

After rotation is completed, your current deposit address will no longer accept deposits. Make sure to:

  1. Withdraw any remaining balance from the current address before requesting rotation
  2. Update any external systems that reference your old deposit address
  3. Use the new address for all future deposits

Processing Time

Rotation requests are processed automatically. A new address is typically assigned within 5 minutes of submission.

  • Only one pending rotation per user per address type is allowed within a 7-day window
  • If you already have a pending rotation, the request will be rejected with 409 Conflict
  • Both web and tg addresses can be rotated independently
  • Parent users can rotate their SUB-users' addresses by specifying the user_id parameter

Error Responses

Conflict (409)

json
{
    "detail": "User 1234 already has a pending web address rotation request"
}

Bad Request (400)

json
{
    "detail": "User 1234 has no web deposit address"
}
json
{
    "detail": "address_type must be 'web' or 'tg'"
}

Not Found (404)

json
{
    "detail": "User 9999 not found"
}

Forbidden (403)

json
{
    "detail": "Not authorized to rotate this user's address"
}

Authentication Error (401)

json
{
    "detail": "X-API-KEY header required"
}

Error Code Reference

HTTP StatusDescription
200Rotation request submitted successfully
400Invalid request (no address, invalid type)
401Missing API key header
403Not authorized / Invalid API key or IP
404User not found / Rotation not found
409Pending rotation already exists
500Internal server error