POST /apiv2/subusergen
अपने मुख्य खाते से जुड़ा एक नया SUB-user (उप-खाता) बनाएं। स्वतंत्र energy संचालन के लिए SUB-users के पास अपनी स्वयं की API key, जमा पता और अलग बैलेंस होता है।
एंडपॉइंट URL
POST https://netts.io/apiv2/subusergenअनुरोध हेडर
| हेडर | आवश्यक | विवरण |
|---|---|---|
| Content-Type | हाँ | application/json |
| X-API-KEY | हाँ | Netts डैशबोर्ड से आपकी API key |
| X-Real-IP | हाँ | आपकी श्वेतसूची (whitelist) से IP पता |
अनुरोध मुख्य भाग (Request Body)
json
{}किसी पैरामीटर की आवश्यकता नहीं है। SUB-user स्वचालित रूप से API key द्वारा पहचाने गए खाते से लिंक हो जाता है।
उदाहरण अनुरोध
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)
सफल प्रतिक्रिया (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."
}प्रतिक्रिया फ़ील्ड
| फ़ील्ड | प्रकार | विवरण |
|---|---|---|
| user_id | integer | बनाए गए SUB-user की विशिष्ट ID |
| google_id | string | फ़र्ज़ी पहचानकर्ता (प्रारूप: SUB + 18 अंक)। कोई वास्तविक Google खाता नहीं है — केवल SUB-user की आंतरिक पहचान के लिए उपयोग किया जाता है |
| string | फ़र्ज़ी ईमेल (google_id + @gmail.com)। कोई वास्तविक ईमेल पता नहीं है — केवल आंतरिक पहचान के लिए उपयोग किया जाता है | |
| name | string | प्रदर्शित नाम (डिफ़ॉल्ट रूप से google_id)। डैशबोर्ड में बदला जा सकता है |
| deposit_address | string | जनरेट किया गया TRON जमा पता (डिफ़ॉल्ट रूप से सक्रिय नहीं) |
| api_key | string | SUB-user के लिए API key (उपसर्ग: mock) |
| referral_code | string | जनरेट किया गया रेफरल कोड (6 वर्ण) |
| created_at | string | ISO 8601 प्रारूप में निर्माण टाइमस्टैम्प |
| referrer_user_id | integer | पैरेंट यूज़र ID (वह खाता जिसने यह SUB-user बनाया है) |
| comment | string | उपयोग निर्देश और नोट्स |
फ़र्ज़ी Google डेटा
google_id, email, और name फ़ील्ड फ़र्ज़ी डेटा हैं — ये वास्तविक Google खाते या ईमेल पते नहीं हैं। ये फ़ील्ड केवल सिस्टम के भीतर SUB-user की आंतरिक पहचान के लिए मौजूद हैं। SUB-user का नाम और टैग डैशबोर्ड में बदला जा सकता है।
SUB-Users कैसे काम करते हैं
मुख्य अवधारणाएं
- अलग बैलेंस: प्रत्येक SUB-user का पैरेंट से स्वतंत्र अपना TRX बैलेंस होता है
- साझा IP श्वेतसूची: SUB-user API अनुरोधों को पैरेंट की IP श्वेतसूची के विरुद्ध मान्य किया जाता है
- स्वयं की API key: प्रत्येक SUB-user को प्रमाणीकरण के लिए एक विशिष्ट API key मिलती है
- पैरेंट लिंकेज: SUB-user रेफरल सिस्टम के माध्यम से निर्माण करने वाले खाते से स्थायी रूप से जुड़ा होता है
- सभी API एंडपॉइंट्स: SUB-users अपनी स्वयं की API key और बैलेंस के साथ सभी API एंडपॉइंट्स (order1h, time/order, आदि) का उपयोग कर सकते हैं
उपयोग प्रवाह
- इस एंडपॉइंट के माध्यम से SUB-user बनाएं
- इसके जमा पते पर TRX जमा करके या बैलेंस स्थानांतरित करके SUB-user को फंड करें
- बाद के API अनुरोधों (order1h, time/order, आदि) में SUB-user की API key का उपयोग करें
- SUB-user की API key का उपयोग करके userinfo एंडपॉइंट के माध्यम से निगरानी करें
त्रुटि प्रतिक्रियाएं
प्रमाणीकरण त्रुटि (401)
json
{
"detail": "X-API-KEY header required"
}वर्जित (Forbidden) (403)
json
{
"detail": "Invalid API key or IP not whitelisted"
}सत्यापन त्रुटि (422)
json
{
"detail": [...],
"body": {...}
}आंतरिक सर्वर त्रुटि (500)
json
{
"detail": "Failed to create mock user: ..."
}त्रुटि कोड संदर्भ
| HTTP स्थिति | विवरण |
|---|---|
200 | SUB-user सफलतापूर्वक बनाया गया |
401 | अनुपलब्ध API key हेडर |
403 | अमान्य API key या IP श्वेतसूची में नहीं है |
422 | अनुरोध सत्यापन त्रुटि |
500 | आंतरिक सर्वर त्रुटि |
टिप्पणियाँ
- खाली अनुरोध मुख्य भाग
{}आवश्यक है (Content-Type application/json होना चाहिए) - जनरेट किया गया जमा पता डिफ़ॉल्ट रूप से सक्रिय नहीं है
- SUB-user की
google_idऔरemailफ़र्ज़ी डेटा हैं (वास्तविक Google खाते नहीं), जिनका उपयोग केवल आंतरिक पहचान के लिए किया जाता है - SUB-user का नाम और टैग डैशबोर्ड में बदला जा सकता है
- SUB-user की API key
mockउपसर्ग से शुरू होती है - IP श्वेतसूची सत्यापन पैरेंट यूज़र की श्वेतसूची का उपयोग करता है
- प्रत्येक SUB-user का पैरेंट से अलग, अपना बैलेंस होता है
- SUB-users को DELETE /apiv2/subuserdel एंडपॉइंट के माध्यम से हटाया जा सकता है
- जमा पते को POST /apiv2/address/rotate एंडपॉइंट के माध्यम से बदला (rotate किया) जा सकता है