Skip to content

POST /apiv2/subusergen

Create a new SUB-user (sub-account) linked to your main account. SUB-users have their own API key, deposit address, and separate balance for independent energy operations.

Endpoint URL

POST https://netts.io/apiv2/subusergen

Request Headers

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

Request Body

json
{}

No parameters required. The SUB-user is automatically linked to the account identified by the API key.

Example Requests

cURL

bash
curl -X POST https://netts.io/apiv2/subusergen \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: your_api_key" \
  -H "X-Real-IP: your_whitelisted_ip" \
  -d '{}'

Python

python
import requests

url = "https://netts.io/apiv2/subusergen"
headers = {
    "Content-Type": "application/json",
    "X-API-KEY": "your_api_key",
    "X-Real-IP": "your_whitelisted_ip"
}

response = requests.post(url, headers=headers, json={})
data = response.json()

if response.status_code == 200:
    print(f"SUB User ID: {data['user_id']}")
    print(f"Google ID: {data['google_id']}")
    print(f"Email: {data['email']}")
    print(f"Deposit Address: {data['deposit_address']}")
    print(f"API Key: {data['api_key']}")
    print(f"Referral Code: {data['referral_code']}")
    print(f"Parent User ID: {data['referrer_user_id']}")
else:
    print(f"Error: {data.get('detail', 'Unknown error')}")

Node.js

javascript
const axios = require('axios');

async function createSubUser(apiKey, whitelistedIp) {
    const url = 'https://netts.io/apiv2/subusergen';

    const response = await axios.post(url, {}, {
        headers: {
            'Content-Type': 'application/json',
            'X-API-KEY': apiKey,
            'X-Real-IP': whitelistedIp
        },
        timeout: 30000
    });

    const data = response.data;
    console.log(`SUB User ID: ${data.user_id}`);
    console.log(`API Key: ${data.api_key}`);
    console.log(`Deposit Address: ${data.deposit_address}`);
    return data;
}

// Usage
createSubUser('your_api_key', 'your_whitelisted_ip')
    .then(result => console.log('Created:', result))
    .catch(err => console.error('Error:', err.response?.data || err.message));

PHP

php
<?php
$url = 'https://netts.io/apiv2/subusergen';

$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' => '{}',
        'timeout' => 30
    ]
];

$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);
$data = json_decode($response, true);

echo "SUB User ID: {$data['user_id']}\n";
echo "API Key: {$data['api_key']}\n";
echo "Deposit Address: {$data['deposit_address']}\n";
?>

Response

Success Response (200 OK)

json
{
    "user_id": 1379,
    "google_id": "SUB123456789012345678",
    "email": "[email protected]",
    "name": "SUB123456789012345678",
    "deposit_address": "TExampleAddress1234567890123456789",
    "api_key": "mock1234567890abcdef1234567890ab",
    "referral_code": "A2B4K9",
    "created_at": "2026-03-14T12:00:00",
    "referrer_user_id": 42,
    "comment": "SUB user linked to main user (referrer_user_id). Google ID, Email and Name are mock data (not real) that can be updated via separate endpoint. For API services usage, requests must include this SUB user's API key and IP from main user's whitelist. Calculations use SUB user's balance. Generated deposit address is not active."
}

Response Fields

FieldTypeDescription
user_idintegerUnique ID of the created SUB-user
google_idstringFake identifier (format: SUB + 18 digits). Not a real Google account — used only for internal identification of the SUB-user
emailstringFake email (google_id + @gmail.com). Not a real email address — used only for internal identification
namestringDisplay name (defaults to google_id). Can be changed in the dashboard
deposit_addressstringGenerated TRON deposit address (not active by default)
api_keystringAPI key for the SUB-user (prefix: mock)
referral_codestringGenerated referral code (6 characters)
created_atstringCreation timestamp in ISO 8601 format
referrer_user_idintegerParent user ID (the account that created this SUB-user)
commentstringUsage instructions and notes

Fake Google Data

The google_id, email, and name fields are fake data — they are not real Google accounts or email addresses. These fields exist solely for internal identification of the SUB-user within the system. The name and tag of a SUB-user can be changed in the dashboard.

How SUB-Users Work

Key Concepts

  • Separate balance: Each SUB-user has its own TRX balance independent from the parent
  • Shared IP whitelist: SUB-user API requests are validated against the parent's IP whitelist
  • Own API key: Each SUB-user gets a unique API key for authentication
  • Parent linkage: The SUB-user is permanently linked to the creating account via referral system
  • All API endpoints: SUB-users can use all API endpoints (order1h, time/order, etc.) with their own API key and balance

Usage Flow

  1. Create SUB-user via this endpoint
  2. Fund the SUB-user by depositing TRX to its deposit address or transferring balance
  3. Use SUB-user's API key in subsequent API requests (order1h, time/order, etc.)
  4. Monitor via userinfo endpoint using the SUB-user's API key

Error Responses

Authentication Error (401)

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

Forbidden (403)

json
{
    "detail": "Invalid API key or IP not whitelisted"
}

Validation Error (422)

json
{
    "detail": [...],
    "body": {...}
}

Internal Server Error (500)

json
{
    "detail": "Failed to create mock user: ..."
}

Error Code Reference

HTTP StatusDescription
200SUB-user created successfully
401Missing API key header
403Invalid API key or IP not in whitelist
422Request validation error
500Internal server error

Notes

  • Empty request body {} is required (Content-Type must be application/json)
  • The generated deposit address is not active by default
  • SUB-user's google_id and email are fake data (not real Google accounts), used for internal identification only
  • The SUB-user's name and tag can be changed in the dashboard
  • The SUB-user's API key starts with mock prefix
  • IP whitelist validation uses the parent user's whitelist
  • Each SUB-user has its own balance, separate from the parent
  • SUB-users can be deleted via DELETE /apiv2/subuserdel endpoint