GET /apiv2/billing/limits
获取后付费账户上的所有额度——包括由 Netts 设置的信用额度以及您自己设置的额度——并显示各项额度的已用量、剩余量,以及每个产品仍可消耗的额度。属于后付费计费的一部分。
端点 URL
GET https://netts.io/apiv2/billing/limits请求标头
| Header | Required | Description |
|---|---|---|
X-API-KEY | 是 | 具有 billing.read 权限的 API 密钥 |
X-Netts-Billing-Format | 否 | 用于带币种的金额的 contract-v1;不发送则为下方的原始格式 |
该请求无参数。
示例
bash
curl -s 'https://netts.io/apiv2/billing/limits' \
-H 'X-API-KEY: your-api-key'json
{
"success": true,
"data": {
"limits": [
{
"id": 1,
"scope": "account",
"origin": "netts",
"editable": false,
"canDisable": false,
"period": "outstanding",
"productCode": null,
"apiKeyId": null,
"enabled": true,
"revision": 3,
"limit": { "unit": "USD", "value": "30000.000000" },
"equivalent": { "unit": "TRX", "value": "90677.230000" },
"used": { "unit": "USD", "value": "1250.400000" },
"available": { "unit": "USD", "value": "28749.600000" },
"creditApplied": { "unit": "USD", "value": "0" },
"status": "ok",
"periodStart": null,
"periodEnd": null,
"cappedBy": null
},
{
"id": 5,
"scope": "account",
"origin": "client",
"editable": true,
"canDisable": true,
"period": "day",
"productCode": "energy_5m",
"apiKeyId": null,
"enabled": true,
"revision": 1,
"limit": { "unit": "USD", "value": "200.000000" },
"equivalent": { "unit": "TRX", "value": "604.514867" },
"used": { "unit": "USD", "value": "35.200000" },
"available": { "unit": "USD", "value": "164.800000" },
"creditApplied": null,
"status": "ok",
"periodStart": "2026-10-19T00:00:00+00:00",
"periodEnd": "2026-10-20T00:00:00+00:00",
"cappedBy": null
}
],
"products": {
"energy_1h": { "unit": "USD", "spendable": "28749.600000", "limitingLimitIds": [1], "maxPerOrder": null, "status": "ok" },
"energy_5m": { "unit": "USD", "spendable": "164.800000", "limitingLimitIds": [5], "maxPerOrder": null, "status": "ok" }
},
"unit": "USD",
"asOf": "2026-10-19T20:24:26.525887+00:00",
"checkedApiKeyId": 6,
"valuationStatus": "ok",
"creditUsdc": "0",
"fx": { "usdPerTrx": "0.33084276", "at": "2026-10-19T20:24:23.449930+00:00" },
"fxStatus": "ok"
},
"timestamp": "2026-10-19T20:24:26+00:00"
}单个额度
| Field | Description |
|---|---|
id | 额度编号——用于修改、停用或启用您自己的额度 |
scope | account——适用于整个账户;key——适用于单个 API 密钥(apiKeyId) |
origin | netts——由 Netts 设置,只读;client——您自己设置的额度 |
editable, canDisable | 您是否可以修改或停用该额度 |
period | outstanding、day、week 或 order——参见统计内容 |
productCode | 该额度适用的产品,若为总额度则为 null |
enabled | false——额度已停用且不生效 |
revision | 当前版本号;修改额度时作为 expectedRevision 发送 |
limit, equivalent | 额度以及按当前汇率换算的另一种币种的参考价值 |
used, available | 已占用额度与剩余可用额度;对于已停用的额度和 order 额度为 null |
creditApplied | 计入 outstanding 额度中的多付金额形成的抵扣金 |
maxPerOrder | 针对 order 额度:单笔订单最大金额 |
periodStart, periodEnd | 针对 day 和 week:当前的 UTC 周期区间 |
cappedBy | 在 Netts 调低额度后,若您的额度高于 Netts 额度:替代生效的 Netts 额度 id |
status | ok、limit_reached、disabled、other_key(属于您其他密钥的额度)或 unavailable |
产品
products 展示了每个产品下一笔订单可以使用的金额:spendable 是所有适用额度中剩余的最小金额,limitingLimitIds 列出了决定该上限的额度。如果适用了 order 额度,maxPerOrder 则表示单笔订单的最大金额。
密钥维度的额度是针对发起此请求的密钥(checkedApiKeyId)进行计算的。如果当前无法计算相关数值,valuationStatus 将为 unavailable:额度仍会列出,但 used、available 和 spendable 为 null。在这种情况下一律不会显示为零或无限制。
contract-v1 响应
当带有 X-Netts-Billing-Format: contract-v1 时,额度和产品保持一致,且每个金额都是带币种的金额。该格式按每个账户单独启用。
json
{
"success": true,
"data": {
"limits": [
{
"id": 1,
"scope": "account",
"origin": "netts",
"editable": false,
"canDisable": false,
"period": "outstanding",
"productCode": null,
"apiKeyId": null,
"enabled": true,
"revision": 12,
"limit": { "amount": "0.00020000", "currency": "BTC" },
"equivalent": { "amount": "49.294668", "currency": "TRX" },
"used": { "amount": "0.00002940", "currency": "BTC" },
"available": { "amount": "0.00017060", "currency": "BTC" },
"creditApplied": { "amount": "0", "currency": "BTC" },
"status": "ok",
"periodStart": null,
"periodEnd": null,
"cappedBy": null
},
{
"id": 5,
"scope": "account",
"origin": "client",
"editable": true,
"canDisable": true,
"period": "outstanding",
"productCode": "energy_1h",
"apiKeyId": null,
"enabled": true,
"revision": 1,
"limit": { "amount": "0.00010000", "currency": "BTC" },
"equivalent": { "amount": "24.647334", "currency": "TRX" },
"used": { "amount": "0.00002940", "currency": "BTC" },
"available": { "amount": "0.00007060", "currency": "BTC" },
"creditApplied": { "amount": "0", "currency": "BTC" },
"status": "ok",
"periodStart": null,
"periodEnd": null,
"cappedBy": null
}
],
"products": {
"energy_1h": {
"spendable": { "amount": "0.00007060", "currency": "BTC" },
"maxPerOrder": null,
"limitingLimitIds": [5],
"status": "ok"
}
},
"asOf": "2026-10-23T19:26:56.812402+00:00",
"checkedApiKeyId": 6,
"valuationStatus": "ok",
"credit": { "amount": "0", "currency": "BTC" },
"exchangeRate": {
"base": "TRX",
"quote": "BTC",
"rate": "0.000004057233918579",
"at": "2026-10-23T19:26:50.321789+00:00"
},
"fxStatus": "ok"
},
"timestamp": "2026-10-23T19:26:56+00:00"
}示例中使用的是 BTC;您的实际响应会显示您合同所对应的币种。示例仅展示了一个产品;实际响应会列出所有产品。
您自己设置的额度会保留其设置时的币种。如果您合同的币种发生变更,该额度将以原币种保留在列表中并处于停用状态;通过修改额度为其设置新数值——随后它将采用 Netts 额度的币种——并将其启用。
| Field | Description |
|---|---|
limit, equivalent, used, available, creditApplied | 带币种的金额;equivalent 是按当前汇率换算的另一种币种的额度,仅供参考 |
products.*.spendable, products.*.maxPerOrder | 带币种的金额。没有独立的 unit 字段 |
credit | 您因多付而产生的抵扣金;即原始格式中的 creditUsdc |
exchangeRate | 用于换算 equivalent 的当前汇率;即原始格式中的 fx |
其他字段与原始格式相同。原始格式顶层的 unit 不会发送:每个金额都会标明自身的币种。
各产品共享账户级抵扣金:产品额度只会缩小该产品的可支出额,绝不会增加抵扣金。spendable 已经综合计算了所有相关额度。
错误响应
| HTTP | code | Meaning |
|---|---|---|
| 401 | -1, -2 | 密钥缺失或无效,或者 IP 不在白名单中——由 API 网关返回,参见响应格式 |
| 400 | unsupported_billing_format | 未知的 X-Netts-Billing-Format 值 |
| 403 | billing_read_required | 密钥缺少 billing.read 权限 |
| 403 | postpaid_required | 账户未开通后付费计费 |
| 403 | billing_format_not_enabled | 您的账户尚未启用 contract-v1 |
| 406 | billing_format_not_available | 请求了原始格式,但您的合同仅支持 contract-v1 |
所有代码均列于后付费计费中。