POST /apiv2/time/delete
从主机模式中移除一个TRON地址并收回所有活动的能量委托。
概述
删除时间端点会永久地从主机模式管理中移除一个TRON地址,立即收回任何活动的能量委托,并停止所有自动化的能量管理服务。此操作对于当前计费周期是不可逆的,但如果需要,可以稍后重新添加该地址。
端点 URL
POST https://netts.io/apiv2/time/delete
身份验证
此端点使用JSON主体身份验证(而非标头)。您的API密钥和目标地址在请求主体中提供。
身份验证流程
- API Key Validation: System verifies the API key exists and is active
- IP Whitelist Check: Request IP must match configured whitelist
- Ownership Verification: API key must own the specified address
- Permission Check: Account must have deletion permissions enabled
请求头
Header | Required | Description |
---|---|---|
Content-Type | Yes | application/json |
请求体
json
{
"api_key": "your_api_key",
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE"
}
参数
Parameter | Type | Required | Validation | Description |
---|---|---|---|---|
api_key | string | Yes | Must exist in system | Your API key for authentication and billing |
address | string | Yes | TRC-20 format | TRON address to remove from Host Mode (must start with 'T' and be 34 characters) |
参数验证
api_key:
- Must be a valid 32-character hexadecimal string
- Must be associated with an active account
- Must have ownership of the specified address
- Account must not be suspended or restricted
address:
- Must match TRC-20 format
^T[1-9A-HJ-NP-Za-km-z]{33}$
- Must be currently in Host Mode under your account
- Cannot be deleted if it has pending transactions
- Cannot be deleted during active delegation cycle (wait for cycle completion)
- Must match TRC-20 format
IP Address:
- Your request IP must be in the whitelist associated with your API key
- Maximum 5 IP addresses per API key
- IPv4 and IPv6 supported
示例请求
cURL
bash
curl -X POST https://netts.io/apiv2/time/delete \
-H "Content-Type: application/json" \
-d '{
"api_key": "YOUR_API_KEY_HERE",
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE"
}'
Python
python
import requests
import json
from typing import Dict, Optional
def delete_from_host_mode(api_key: str, address: str) -> Dict:
"""
Remove a TRON address from Host Mode.
Args:
api_key: Your API authentication key
address: TRON address to remove
Returns:
API response dictionary
"""
url = "https://netts.io/apiv2/time/delete"
# Validate address format
if not address.startswith('T') or len(address) != 34:
raise ValueError(f"Invalid TRON address format: {address}")
data = {
"api_key": api_key,
"address": address
}
try:
response = requests.post(url, json=data, verify=True, timeout=30)
response.raise_for_status()
result = response.json()
if result['code'] == 0:
print(f"✅ Successfully removed from Host Mode: {result['data']['address']}")
print(f"Energy reclaimed: {result['data'].get('energy_reclaimed', 0)}")
print(f"Cycles remaining: {result['data'].get('cycles_remaining', 0)}")
else:
print(f"❌ Error: {result['msg']}")
return result
except requests.exceptions.RequestException as e:
print(f"❌ Request failed: {str(e)}")
raise
except json.JSONDecodeError as e:
print(f"❌ Invalid JSON response: {str(e)}")
raise
# Example usage
if __name__ == "__main__":
API_KEY = "YOUR_API_KEY_HERE"
ADDRESS = "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE"
result = delete_from_host_mode(API_KEY, ADDRESS)
Node.js
javascript
const axios = require('axios');
/**
* Remove a TRON address from Host Mode
* @param {string} apiKey - Your API authentication key
* @param {string} address - TRON address to remove
* @returns {Promise<Object>} API response
*/
async function deleteFromHostMode(apiKey, address) {
const url = 'https://netts.io/apiv2/time/delete';
// Validate address format
if (!address.startsWith('T') || address.length !== 34) {
throw new Error(`Invalid TRON address format: ${address}`);
}
const data = {
api_key: apiKey,
address: address
};
try {
const response = await axios.post(url, data, {
headers: {
'Content-Type': 'application/json'
},
timeout: 30000
});
const result = response.data;
if (result.code === 0) {
console.log(`✅ Successfully removed from Host Mode: ${result.data.address}`);
console.log(`Energy reclaimed: ${result.data.energy_reclaimed || 0}`);
console.log(`Cycles remaining: ${result.data.cycles_remaining || 0}`);
} else {
console.error(`❌ Error: ${result.msg}`);
}
return result;
} catch (error) {
if (error.response) {
console.error(`❌ API Error: ${error.response.status} - ${error.response.data?.msg || error.message}`);
} else if (error.request) {
console.error('❌ No response from server');
} else {
console.error(`❌ Request failed: ${error.message}`);
}
throw error;
}
}
// Example usage
(async () => {
const API_KEY = 'YOUR_API_KEY_HERE';
const ADDRESS = 'TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE';
try {
const result = await deleteFromHostMode(API_KEY, ADDRESS);
console.log('Result:', result);
} catch (error) {
console.error('Failed to delete address:', error.message);
}
})();
PHP
php
<?php
/**
* Remove a TRON address from Host Mode
*
* @param string $apiKey Your API authentication key
* @param string $address TRON address to remove
* @return array API response
*/
function deleteFromHostMode($apiKey, $address) {
$url = 'https://netts.io/apiv2/time/delete';
// Validate address format
if (!preg_match('/^T[1-9A-HJ-NP-Za-km-z]{33}$/', $address)) {
throw new InvalidArgumentException("Invalid TRON address format: $address");
}
$data = [
'api_key' => $apiKey,
'address' => $address
];
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data),
'timeout' => 30
]
];
$context = stream_context_create($options);
$response = @file_get_contents($url, false, $context);
if ($response === false) {
$error = error_get_last();
throw new RuntimeException('Request failed: ' . $error['message']);
}
$result = json_decode($response, true);
if ($result['code'] == 0) {
echo "✅ Successfully removed from Host Mode: {$result['data']['address']}\n";
echo "Energy reclaimed: " . ($result['data']['energy_reclaimed'] ?? 0) . "\n";
echo "Cycles remaining: " . ($result['data']['cycles_remaining'] ?? 0) . "\n";
} else {
echo "❌ Error: {$result['msg']}\n";
}
return $result;
}
// Example usage
$API_KEY = 'YOUR_API_KEY_HERE';
$ADDRESS = 'TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE';
try {
$result = deleteFromHostMode($API_KEY, $ADDRESS);
print_r($result);
} catch (Exception $e) {
echo "Failed to delete address: " . $e->getMessage() . "\n";
}
?>
响应
成功响应 (200 OK)
json
{
"code": 0,
"msg": "Address successfully removed from Host Mode",
"data": {
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
"status": "removed",
"energy_reclaimed": 131000,
"cycles_remaining": 0,
"timestamp": 1699528800,
"refund_amount": 0,
"transaction_hash": "f8b3c2a1d4e6957b8f9a0c3e5d7b9a1c3e5f7a9b1d3f5b7c9e1a3d5f7b9c1e3f5"
}
}
响应字段
Field | Type | Description |
---|---|---|
code | integer | Status code (0 for success, -1 for error) |
msg | string | Human-readable status message |
data | object | Response data object |
data.address | string | The TRON address that was removed |
data.status | string | Current status ("removed") |
data.energy_reclaimed | integer | Amount of energy reclaimed from delegations |
data.cycles_remaining | integer | Number of unused cycles (always 0 after deletion) |
data.timestamp | integer | Unix timestamp of the deletion |
data.refund_amount | integer | TRX amount refunded for unused cycles (if applicable) |
data.transaction_hash | string | TRON blockchain transaction hash for the reclaim operation |
错误响应
身份验证错误 (401)
json
{
"code": -1,
"msg": "Invalid API key",
"data": null
}
Causes:
- Invalid or expired API key
- API key not found in system
- Account suspended or terminated
Resolution:
- Verify API key is correct
- Check account status in dashboard
- Contact support if key should be valid
地址未找到 (404)
json
{
"code": -1,
"msg": "Address not found in Host Mode",
"data": {
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
"suggestion": "Use /time/add to add this address first"
}
}
Causes:
- Address was never added to Host Mode
- Address already deleted
- Address belongs to different API key
Resolution:
- Verify address is in Host Mode using
/time/status
- Check if address was already deleted
- Ensure you're using correct API key
无效地址格式 (400)
json
{
"code": -1,
"msg": "Invalid TRON address format",
"data": {
"address": "invalid_address",
"format": "Address must start with 'T' and be 34 characters long"
}
}
Causes:
- Address doesn't match TRC-20 format
- Address contains invalid characters
- Address wrong length
Resolution:
- Verify address starts with 'T'
- Ensure address is exactly 34 characters
- Check for typos or copy/paste errors
活动委托错误 (409)
json
{
"code": -1,
"msg": "Cannot delete address with active delegation",
"data": {
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
"active_until": 1699532400,
"retry_after": 3600
}
}
Causes:
- Address has active energy delegation
- Delegation cycle not yet complete
- Pending transactions in progress
Resolution:
- Wait for current delegation cycle to complete
- Retry after the specified time
- Use
/time/stop
to pause delegations first
IP 未列入白名单 (403)
json
{
"code": -1,
"msg": "IP address not whitelisted",
"data": {
"ip": "192.168.1.100",
"suggestion": "Add this IP to whitelist in dashboard"
}
}
Causes:
- Request IP not in API key whitelist
- IP address changed since configuration
- Using proxy or VPN
Resolution:
- Add IP to whitelist in dashboard
- Verify not using proxy/VPN
- Contact support to update whitelist
权限不足 (403)
json
{
"code": -1,
"msg": "Insufficient permissions for this operation",
"data": {
"required_permission": "delete_addresses",
"your_permissions": ["read_only"]
}
}
Causes:
- API key has read-only permissions
- Delete operations disabled for account
- Sub-account with limited permissions
Resolution:
- Request permission upgrade from account owner
- Use master API key instead of sub-account key
- Contact support to enable delete permissions
速率限制
Period | Limit | Description |
---|---|---|
1 minute | 6 requests | Maximum 6 requests per minute per API key |
1 hour | 100 requests | Maximum 100 requests per hour per API key |
1 day | 1000 requests | Maximum 1000 requests per day per API key |
速率限制报头
http
X-RateLimit-Limit-Minute: 6
X-RateLimit-Remaining-Minute: 5
X-RateLimit-Reset-Minute: 1699528860
X-RateLimit-Limit-Hour: 100
X-RateLimit-Remaining-Hour: 98
X-RateLimit-Reset-Hour: 1699532400
X-RateLimit-Limit-Day: 1000
X-RateLimit-Remaining-Day: 995
X-RateLimit-Reset-Day: 1699574400
速率限制超出响应 (429)
json
{
"code": -1,
"msg": "API rate limit exceeded",
"data": {
"retry_after": 45,
"limit": "6 per minute",
"reset_at": 1699528860
}
}
删除后会发生什么
立即采取的措施
能量回收流程
- All active energy delegations are immediately reclaimed
- Energy returns to the main pool within 1-2 blocks
- Delegation records are marked as terminated
数据库更新
- Address removed from Host Mode registry
- All automation schedules cancelled
- Historical data retained for 30 days
区块链操作
- Undelegate transaction submitted to TRON network
- Transaction typically confirms within 3 seconds
- Energy becomes available for other addresses
时间考虑因素
- Instant Removal: Address removed from Host Mode immediately
- Energy Reclaim: Takes 1-2 TRON blocks (3-6 seconds)
- Database Cleanup: Background process within 5 minutes
- Refund Processing: If applicable, processed within 1 hour
对您账户的影响
- Cycles: Any remaining cycles are forfeited (no refund)
- Energy Pool: Reclaimed energy returns to available pool
- Billing: No further charges for this address
- Re-addition: Address can be added again immediately
主机模式的影响
删除之前
- Address receives automatic 131,000 energy every 24 hours
- Energy delegations managed automatically
- Continuous monitoring and optimization
- Automatic renewal based on usage
删除后
- No more automatic energy delegations
- Address operates with its own resources only
- Must manually manage energy needs
- Can be re-added to Host Mode at any time
安全注意事项
身份验证安全
- API Key Storage: Never expose API keys in client-side code
- HTTPS Only: All requests must use HTTPS
- IP Whitelist: Configure IP whitelist for production use
- Key Rotation: Rotate API keys regularly
验证检查
API 密钥验证
- Key exists and is active
- Account has sufficient permissions
- Not exceeded rate limits
地址所有权
- Address belongs to API key owner
- Not locked or restricted
- No pending operations
请求完整性
- Valid JSON format
- Required fields present
- No SQL injection attempts
- No XSS payloads
审计追踪
所有删除操作均记录如下:
- Timestamp
- API key used
- IP address
- Address deleted
- Energy reclaimed
- Transaction hash
技术架构
服务组件
API 网关
- Request validation and routing
- Rate limiting enforcement
- IP whitelist checking
身份验证服务
- API key validation
- Permission checking
- Account status verification
主机模式管理器
- Address registry management
- Delegation scheduling
- Resource allocation
区块链服务
- TRON network interaction
- Transaction submission
- Confirmation monitoring
数据库层
- PostgreSQL for persistent data
- Redis for caching and rate limits
- Audit log storage
请求流程
- Client sends POST request with API key and address
- API Gateway validates request format and rate limits
- Authentication Service verifies API key and permissions
- Host Mode Manager checks address status
- Blockchain Service initiates energy reclaim
- Database updated with removal record
- Response sent to client with transaction details
相关端点
- POST /apiv2/time/add - Add address to Host Mode
- POST /apiv2/time/stop - Temporarily stop delegations
- POST /apiv2/time/status - Check current status
- POST /apiv2/time/order - Purchase additional cycles
- POST /apiv2/time/infinitystart - Enable unlimited cycles
最佳实践
何时删除
- Permanent Removal: When you no longer need energy for an address
- Account Cleanup: Removing unused or old addresses
- Cost Optimization: Stopping charges for inactive addresses
- Security: Removing compromised addresses
删除之前
- Check Active Transactions: Ensure no pending operations
- Verify Energy Usage: Confirm address doesn't need energy
- Document Transaction Hash: Save the reclaim transaction hash
- Consider Alternatives: Maybe
/time/stop
is sufficient
删除后
- Verify Removal: Check status with
/time/status
- Monitor Transaction: Confirm blockchain transaction
- Update Records: Update your internal systems
- Plan Re-addition: If temporary, schedule when to re-add
故障排除
常见问题
“主机模式下找不到地址”
问题: 尝试删除未处于主机模式的地址
Solutions:
- Verify address with
/time/status
endpoint - Check if already deleted
- Ensure using correct API key
- Verify address format is correct
“无法删除具有活动委托的地址”
问题: 地址当前已委托能量
Solutions:
- Wait for current cycle to complete (check
active_until
in response) - Use
/time/stop
first to pause delegations - Retry after the specified wait time
- Contact support if urgent removal needed
“无效的API密钥”
问题: API 密钥无法识别或已过期
Solutions:
- Verify API key is correct (no extra spaces)
- Check account status in dashboard
- Ensure API key has delete permissions
- Generate new API key if needed
“IP地址未列入白名单”
问题: 来自未列入白名单的IP的请求
Solutions:
- Add your IP to whitelist in dashboard
- Check if behind proxy or VPN
- Verify IP hasn't changed
- Use static IP for production
获取帮助
如果您遇到此处未涵盖的问题:
- Check Documentation: Review this guide and related endpoints
- API Status: Check https://status.netts.io for service status
- Support Ticket: Submit ticket with transaction details
- Emergency: Use emergency contact for critical issues
备注
- Irreversible Action: Deletion removes all automation for the address
- No Partial Deletion: Address is either fully in Host Mode or completely removed
- Energy Reclaim: Reclaimed energy available immediately for other addresses
- Historical Data: Deletion history retained for audit purposes
- Re-addition Allowed: Same address can be added again with
/time/add
- No Refunds: Unused cycles are not refunded upon deletion
- Bulk Operations: For multiple deletions, implement client-side batching with rate limit compliance
- Webhook Support: Configure webhooks to receive deletion notifications
- API Versioning: This is v2 API; v1 is deprecated
- Maintenance Windows: Deletions may be delayed during maintenance (rare)