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

时间状态 API

获取处于 Host Mode 下的地址状态信息——您账户下的所有地址,或单个地址。

有两个端点:

  1. POST /apiv2/time/status — 获取您所有地址的状态(支持可选的分页和账户级汇总)。
  2. GET /apiv2/time/status/{address} — 获取单个特定地址的状态。

POST /apiv2/time/status

端点 URL

POST https://netts.io/apiv2/time/status

身份验证

在请求体(api_key)或 X-API-KEY 请求头中提供您的 API 密钥。请求 IP 必须在为您 API 密钥配置的白名单中。

请求体

json
{
    "api_key": "your_api_key",
    "page": 1,
    "page_size": 50
}
参数类型必填描述
api_keystringAPI 密钥(或使用 X-API-KEY 请求头)。
pageinteger页码,≥ 1。需要与 page_size 一起使用。
page_sizeinteger每页地址数量,1–100。需要与 page 一起使用。

**分页:**如果同时提供了 pagepage_size,结果将进行分页并包含一个 pagination 对象。如果不提供,则返回所有地址(最多 1000 个),按创建时间排序(最新的排在前面)。

请求示例

cURL(所有地址):

bash
curl -X POST https://netts.io/apiv2/time/status \
  -H "Content-Type: application/json" \
  -d '{ "api_key": "YOUR_API_KEY_HERE" }'

cURL(分页):

bash
curl -X POST https://netts.io/apiv2/time/status \
  -H "Content-Type: application/json" \
  -d '{ "api_key": "YOUR_API_KEY_HERE", "page": 1, "page_size": 50 }'

Python:

python
import requests

resp = requests.post(
    "https://netts.io/apiv2/time/status",
    json={"api_key": "YOUR_API_KEY_HERE"},  # add "page"/"page_size" to paginate
    timeout=30,
)
result = resp.json()

if result["code"] == 0:
    for a in result["data"]["addresses"]:
        # cycles_remaining is None in infinity mode — no limit to count down
        left = "unlimited" if a["cycles_remaining"] is None else f"{a['cycles_remaining']} left"
        print(a["address"], a["mode"], a["status"], left,
              f"spent {a['total_spent']} TRX")
else:
    print("Error:", result["msg"])

Node.js:

javascript
const axios = require('axios');

axios.post('https://netts.io/apiv2/time/status', { api_key: 'YOUR_API_KEY_HERE' })
    .then(({ data: result }) => {
        if (result.code === 0) {
            result.data.addresses.forEach(a => {
                // cycles_remaining is null in infinity mode — no limit to count down
                const left = a.cycles_remaining === null ? 'unlimited' : `${a.cycles_remaining} left`;
                console.log(a.address, a.mode, a.status, left, `spent ${a.total_spent} TRX`);
            });
        } else {
            console.error('Error:', result.msg);
        }
    })
    .catch(err => console.error('Request failed:', err.response?.data || err.message));

响应

json
{
    "code": 0,
    "msg": "Status retrieved successfully",
    "data": {
        "summary": {
            "total_addresses": 3,
            "active_addresses": 2,
            "infinity_mode_count": 1,
            "total_cycles_ordered": 25,
            "total_open_orders": 3
        },
        "order_statistics": {
            "total_orders": 12,
            "open_orders": 3,
            "closed_orders": 9,
            "total_cycles_in_open_orders": 25,
            "total_delegations": 340,
            "total_amount_spent": 1502.4471
        },
        "addresses": [
            {
                "address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
                "status": "active",
                "mode": "normal",
                "cycles_ordered": 25,
                "cycle_set": 25,
                "cycles_completed": 10,
                "cycles_remaining": 15,
                "cycles_total_lifetime": 214,
                "current_cycle_no": 3,
                "open_orders": 1,
                "total_spent": 962.1184,
                "bandwidth_delegated": true,
                "created_at": "2026-07-08T12:00:00.000000",
                "updated_at": "2026-07-09T10:00:00.000000"
            },
            {
                "address": "TYn8Y3khEsLJW2ChVWFMSMeRDow6KcbMTF",
                "status": "active",
                "mode": "infinity",
                "cycles_ordered": null,
                "cycle_set": 0,
                "cycles_completed": 83,
                "cycles_remaining": null,
                "cycles_total_lifetime": 115,
                "current_cycle_no": 5,
                "open_orders": 1,
                "total_spent": 519.1234,
                "bandwidth_delegated": true,
                "created_at": "2026-07-08T08:00:00.000000",
                "updated_at": "2026-07-09T09:30:00.000000"
            }
        ],
        "timestamp": "2026-07-09T12:34:50.123456"
    }
}

使用分页时data 还包含:

json
"pagination": {
    "page": 1,
    "page_size": 50,
    "total_items": 150,
    "total_pages": 3,
    "has_next": true,
    "has_prev": false
}

summary 字段

字段描述
total_addresses您账户下的地址总数
active_addresses当前处于活跃状态的地址数
infinity_mode_count运行在 infinity mode 下的活跃地址数
total_cycles_ordered进行中订单订购周期的总和(不包括 infinity 订单)
total_open_orders所有地址的进行中订单总数

order_statistics 字段

字段描述
total_orders有史以来创建的所有订单
open_orders当前进行中的订单
closed_orders已关闭的订单
total_cycles_in_open_orders进行中订单包含的总周期数(不包括 infinity)
total_delegations您所有地址实际执行的代理总次数
total_amount_spent实际扣费金额,单位为 TRX — 从您余额中真正扣除的总和

地址对象字段

字段类型描述
addressstringTRON 地址
statusstring"active""inactive"
modestring"normal""infinity",或 "off"(当非活跃时)
cycles_orderedinteger | null进行中订单订购的周期数。在 infinity mode 下为 null
cycle_setinteger为该地址存储的 cycle_set
cycles_completedinteger自该地址上次启动以来已使用的周期数。当您停止该模式或订购的周期耗尽时重置
cycles_remaininginteger | nullcycles_ordered − cycles_completed。在 infinity mode 下为 null
cycles_total_lifetimeinteger该地址整个生命周期内的所有代理次数。永不重置
current_cycle_nointeger | null自该地址上次启动以来的当前代理序号。当没有活跃代理时为 null
open_ordersinteger该地址的进行中订单数
total_spentnumber该地址的实际扣费金额,单位为 TRX
bandwidth_delegatedboolean当前是否代理了 Bandwidth。Bandwidth 是免费的并包含在周期价格中
created_atstring添加时的 ISO 时间戳
updated_atstring最后一次更新的 ISO 时间戳

Infinity mode。 cycles_orderedcycles_remainingnull,而不是 0 — 因为没有需要倒计时的限制。请将 null 视为“无限制”,不要将其理解为“没有剩余周期”。cycles_completed 仍会报告实际数字。

三个周期计数器,三种含义。 cycles_completed 仅计算自地址上次启动以来的次数,cycles_total_lifetime 计算其整个历史的次数,而 current_cycle_no 是当前代理的序号。它们的值通常不同 — 对于一个地址,您可能会同时看到 831155

错误

所有错误均使用 code = -1

msg原因
API key required in body or X-API-KEY header未提供 API 密钥
Invalid API key or IP not in whitelist身份验证失败
Page number must be >= 1page 小于 1
Page size must be >= 1page_size 小于 1
Page size must be <= 100page_size 大于 100
Database error getting status临时服务端错误 — 请重试
Internal server error未知错误 — 请重试或联系支持人员

GET /apiv2/time/status/

单个地址的状态。

端点 URL

GET https://netts.io/apiv2/time/status/{address}

身份验证

X-API-KEY 请求头中发送您的 API 密钥。请求 IP 必须在白名单中。

请求示例

bash
curl -X GET "https://netts.io/apiv2/time/status/TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE" \
  -H "X-API-KEY: YOUR_API_KEY_HERE"
python
import requests

address = "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE"
resp = requests.get(
    f"https://netts.io/apiv2/time/status/{address}",
    headers={"X-API-KEY": "YOUR_API_KEY_HERE"},
    timeout=30,
)
print(resp.json())

响应

json
{
    "code": 0,
    "msg": "Address status retrieved successfully",
    "data": {
        "address_info": {
            "address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
            "status": "active",
            "mode": "normal",
            "cycles_ordered": 25,
            "cycle_set": 25,
            "cycles_completed": 10,
            "cycles_remaining": 15,
            "cycles_total_lifetime": 214,
            "current_cycle_no": 3,
            "open_orders": 1,
            "total_spent": 962.1184,
            "bandwidth_delegated": true,
            "created_at": "2026-07-08T12:00:00.000000",
            "updated_at": "2026-07-09T10:00:00.000000"
        },
        "timestamp": "2026-07-09T12:34:50.123456"
    }
}

address_info 使用与上述地址对象相同的字段。

错误

code = -1,例如:

msg原因
API key required in X-API-KEY header缺少请求头
Invalid API key or IP not in whitelist身份验证失败
Address not found or doesn't belong to user该账户下未找到该地址
Database error getting address status临时服务端错误 — 请重试
Internal server error未知错误 — 请重试或联系支持人员

HTTP 状态码

两个端点均使用 HTTP 200 和负数 code 返回错误 — 请检查 code,而不是 HTTP 状态码。错误响应体始终包含 "data": null

部分错误会在请求到达端点之前返回。它们使用非 200 状态码和不同的响应体格式:

HTTP响应体原因
402{"detail": {"code": 1004, "msg": "Insufficient funds. Minimum balance is 4 TRX. Please top up your account."}}账户余额过低
403{"detail": {"code": 1005, "msg": "API key is blocked. Contact support."}}API 密钥已被封禁 — 请联系支持人员
422{"detail": [ … ]}仅限 POST — 请求体校验失败:某个字段类型错误,或者在未附带 api_key 的情况下发送了 page/page_size。注意此响应中没有 code 字段

相关端点

注意事项

  • 状态端点为只读端点。
  • 仅返回属于您账户的地址。
  • 时间戳为 ISO 8601 格式字符串。