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

GET /apiv2/billing/limits ​

获取后付费账户上的所有额度限制 —— 包括 Netts 设置的信用额度以及您自己设置的额度 —— 附带每项额度的已用金额和剩余金额,以及每个产品仍可消费的金额。属于后付费计费的一部分。

接口 URL ​

GET https://netts.io/apiv2/billing/limits

请求头 ​

请求头必填描述
X-API-KEY是拥有 billing.read 权限的 API 密钥
X-Real-IP是来自密钥白名单中的地址

该请求无参数。

示例 ​

bash
curl -s 'https://netts.io/apiv2/billing/limits' \
  -H 'X-API-KEY: your-api-key' \
  -H 'X-Real-IP: 203.0.113.10'
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"
}

单项额度说明 ​

字段描述
id额度编号 —— 用于修改、停用或启用您自己的额度
scopeaccount —— 适用于整个账户;key —— 适用于单个 API 密钥(apiKeyId)
originnetts —— 由 Netts 设置,只读;client —— 您自己设置的额度
editable, canDisable您是否可以修改或停用此额度
periodoutstanding、day、week 或 order —— 参见统计项说明
productCode额度适用的产品代码,全局总额度为 null
enabledfalse —— 该额度已被停用且不生效
revision当前版本号;修改额度时作为 expectedRevision 传递
limit, equivalent额度值,以及供参考的按当前汇率折算的另一种货币价值
used, available已用和剩余金额;对于已停用的额度和 order 额度为 null
creditApplied来自超额支付并计入 outstanding 额度的抵扣金
maxPerOrder针对 order 额度:单笔订单最大金额
periodStart, periodEnd针对 day 和 week:当前 UTC 周期时间段
cappedBy在 Netts 下调额度后,若您的额度高于 Netts 额度:此处显示实际生效的 Netts 额度 id
statusok、limit_reached、disabled、other_key(属于您名下另一个密钥的额度)或 unavailable

产品 ​

products 显示每个产品下一笔订单可以使用的金额:spendable 是所有适用额度中剩余的最小金额,limitingLimitIds 指出了决定该金额的额度 ID。如果适用了 order 额度,maxPerOrder 为单笔订单最大金额。

密钥级别的额度限制针对发起此次请求的密钥 —— 即 checkedApiKeyId —— 进行计算。如果当前无法计算相关数值,valuationStatus 将为 unavailable:额度仍会列出,但 used、available 和 spendable 为 null。在这种情况下,绝不会显示为零或无限制。

错误响应 ​

HTTPcode含义
401-1, -2密钥缺失或无效,或者 IP 不在白名单中 —— 由 API 网关返回,参见响应格式
403billing_read_required密钥缺少 billing.read 权限
403postpaid_required该账户未开通后付费计费

所有错误代码均在后付费计费中列出。