文档
定价GitHub控制台

Public API

Account

Account routes tell you whose account an API key belongs to: the plan with its limits and how much of them is used (GET /v1/account), and the requests and credits the account spent per day (GET /v1/usage). The numbers are the same as in the cabinet. All routes require signed headers (see Authentication). Base URL: see Overview. Success responses use ok: true plus the fields below. A field without a value is not written (it is never null): read a missing field as "no value".

planusagecreditslimitsAccount

← Public API

GET /v1/account

The plan of the account with its limits and what is used of them (credits, RPS, address watch slots, payment slots, payments of the month).

响应字段

名称类型描述
okbooleantrue on success.
planobjectCurrent plan. Absent when the account has no plan. (可选)
plan.slugstringPlan slug.
plan.namestringPlan display name.
plan.included_creditsnumberCredits included in the plan period.
plan.credit_usednumberCredits used in the current plan period.
plan.rps_limitnumberPlan limit of requests per second (RPC endpoints).
plan.rps_usednumberCurrent requests per second of your endpoints (at most rps_limit).
plan.webhook_address_slotsnumberPlan cap for concurrently watched addresses.
plan.address_slots_usednumberWatched addresses currently in use.
plan.payment_slotsnumberPlan cap for payments that hold a slot at the same time.
plan.payment_slots_usednumberPayments currently holding a slot.
plan.payments_per_monthnumberPlan cap for payments created per month.
plan.payments_per_month_usednumberPayments created in the current month.
plan.price_monthly_centsnumberMonthly price in cents.
plan.billing_periodstringBilling period of the subscription, e.g. monthly. Absent when none. (可选)
plan.subscription_statusstringSubscription status. Absent when none. (可选)
plan.started_atstringStart of the plan period, ISO-8601 UTC without offset (e.g. 2026-08-01T00:00). Absent when none. (可选)
plan.expires_atstringEnd of the plan period, ISO-8601 UTC without offset. Absent when none. (可选)
  • The account is the owner of the API key (the billing workspace). It takes no query parameters or body.
  • plan is absent when the account has no plan. The response is then just { "ok": true }.
  • There is no user_id and no plan id in the response: the plan is identified by slug.
  • rps_used is the current requests-per-second load of your endpoints, never above rps_limit. rps_limit applies to RPC traffic on your endpoints; it is not the rate limit of this API (100 requests per minute per account).
  • webhook_address_slots, payment_slots and payments_per_month are the caps of the plan; the matching *_used fields are the current usage. payments_per_month_used counts the payments of the current month.
  • billing_period, subscription_status, started_at and expires_at are written only when the account has a subscription period. started_at and expires_at are ISO-8601 date-times in UTC written without an offset (for example 2026-08-01T00:00; seconds are dropped when zero).

请求示例

import { createHash, createHmac } from 'node:crypto'

const API_KEY = process.env.PUBLIC_API_KEY! // cabinet UUID
const SECRET = process.env.PUBLIC_API_SECRET! // sk_live_…
const BASE = 'https://api.rpcnode.dev'

// path: as the server receives it, with the query; body: the exact string that is sent
async function call(method: string, path: string, body = '') {
  const timestamp = Math.floor(Date.now() / 1000)
  const bodyHash = createHash('sha256').update(body).digest('hex')
  const signature = createHmac('sha256', SECRET)
    .update([timestamp, method, path, bodyHash].join('\n'))
    .digest('hex')
  const res = await fetch(BASE + path, {
    method,
    headers: {
      'X-Api-Key': API_KEY,
      'X-Timestamp': String(timestamp),
      'X-Signature': signature,
      ...(body ? { 'Content-Type': 'application/json' } : {}),
    },
    body: body || undefined,
  })
  return res.json()
}

console.log(await call('GET', '/v1/account'))

请求已在示例代码中完成签名——签名规则见Authentication。

响应示例

{
  "ok": true,
  "plan": {
    "slug": "pro",
    "name": "Pro",
    "included_credits": 1000000,
    "credit_used": 12000,
    "rps_limit": 50,
    "rps_used": 3,
    "webhook_address_slots": 100,
    "address_slots_used": 2,
    "payment_slots": 20,
    "payment_slots_used": 1,
    "payments_per_month": 500,
    "payments_per_month_used": 14,
    "price_monthly_cents": 4900,
    "billing_period": "monthly",
    "subscription_status": "active",
    "started_at": "2026-08-01T00:00",
    "expires_at": "2026-09-01T00:00"
  }
}

GET /v1/usage

Requests and credits of the whole account by day over the last 7, 30 or 90 days, with the top methods and a webhook breakdown.

查询参数

名称类型描述
daysintegerWindow length in days: 7, 30 or 90. Default 30. (可选)

响应字段

名称类型描述
okbooleantrue on success.
usage.daysnumberSelected window length.
usage.total_requestsnumberRequests in the window.
usage.total_creditsnumberCredits in the window.
usage.series[]arrayOne point per day, oldest to newest.
usage.series[].datestringDay, YYYY-MM-DD (UTC).
usage.series[].requestsnumberRequests that day.
usage.series[].creditsnumberCredits that day.
usage.methods[]arrayTop methods of the window (at most 20).
usage.methods[].methodstringRPC method or webhook:* kind.
usage.methods[].requestsnumberRequests of this method.
usage.methods[].creditsnumberCredits of this method.
usage.webhooksobjectWebhook delivery slice of the window. Included in total_credits.
usage.webhooks.requestsnumberDeliveries counted, all kinds.
usage.webhooks.creditsnumberCredits spent on deliveries, all kinds.
usage.webhooks.address_watch_requestsnumberAddress Watch deliveries (webhook:address-watch).
usage.webhooks.address_watch_creditsnumberCredits for Address Watch deliveries.
usage.webhooks.payment_requestsnumberPayment deliveries (webhook:payment).
usage.webhooks.payment_creditsnumberCredits for payment deliveries.
usage.webhooks.block_requestsnumberBlock deliveries (webhook:block).
usage.webhooks.block_creditsnumberCredits for block deliveries.
usage.webhooks.tx_watch_requestsnumberTx Watch deliveries (webhook:tx-watch).
usage.webhooks.tx_watch_creditsnumberCredits for Tx Watch deliveries.
  • Any other value of days is rejected with 400 common.validation_failed and errors: [{ "field": "days", "error": "days must be 7, 30 or 90." }]; it is not replaced by the default.
  • The query string is part of the signed path (see Authentication): sign /v1/usage?days=30 exactly as you send it.
  • The usage covers all endpoints of the account together, including credits spent on webhook deliveries.
  • series has exactly one point per day, oldest first, ending today (UTC dates). Days without usage are zeros. total_requests and total_credits are the sums of series.
  • methods lists up to 20 methods, the most credits first (then requests, then name). Webhook deliveries appear there as webhook:address-watch, webhook:payment, webhook:block and webhook:tx-watch.
  • webhooks covers the whole window, not only the 20 methods listed in methods. Its requests and credits are the sum of the four kinds and are already part of total_credits.
  • Plan-period counters (credit_used, included_credits, slots) are not in this response: use GET /v1/account for them.

请求示例

import { createHash, createHmac } from 'node:crypto'

const API_KEY = process.env.PUBLIC_API_KEY! // cabinet UUID
const SECRET = process.env.PUBLIC_API_SECRET! // sk_live_…
const BASE = 'https://api.rpcnode.dev'

// path: as the server receives it, with the query; body: the exact string that is sent
async function call(method: string, path: string, body = '') {
  const timestamp = Math.floor(Date.now() / 1000)
  const bodyHash = createHash('sha256').update(body).digest('hex')
  const signature = createHmac('sha256', SECRET)
    .update([timestamp, method, path, bodyHash].join('\n'))
    .digest('hex')
  const res = await fetch(BASE + path, {
    method,
    headers: {
      'X-Api-Key': API_KEY,
      'X-Timestamp': String(timestamp),
      'X-Signature': signature,
      ...(body ? { 'Content-Type': 'application/json' } : {}),
    },
    body: body || undefined,
  })
  return res.json()
}

console.log(await call('GET', '/v1/usage'))

请求已在示例代码中完成签名——签名规则见Authentication。

响应示例

{
  "ok": true,
  "usage": {
    "days": 7,
    "total_requests": 5400,
    "total_credits": 12000,
    "series": [
      { "date": "2026-08-01", "requests": 0, "credits": 0 },
      { "date": "2026-08-02", "requests": 700, "credits": 1500 },
      { "date": "2026-08-03", "requests": 900, "credits": 2100 },
      { "date": "2026-08-04", "requests": 800, "credits": 1700 },
      { "date": "2026-08-05", "requests": 1000, "credits": 2300 },
      { "date": "2026-08-06", "requests": 1100, "credits": 2400 },
      { "date": "2026-08-07", "requests": 900, "credits": 2000 }
    ],
    "methods": [
      { "method": "webhook:payment", "requests": 4, "credits": 2000 },
      { "method": "eth_getBlockByNumber", "requests": 600, "credits": 4800 },
      { "method": "webhook:address-watch", "requests": 30, "credits": 900 },
      { "method": "eth_call", "requests": 4766, "credits": 4300 }
    ],
    "webhooks": {
      "requests": 34,
      "credits": 2900,
      "address_watch_requests": 30,
      "address_watch_credits": 900,
      "block_requests": 0,
      "block_credits": 0,
      "payment_requests": 4,
      "payment_credits": 2000,
      "tx_watch_requests": 0,
      "tx_watch_credits": 0
    }
  }
}

提示

  • Sign every request with X-Api-Key, X-Timestamp and X-Signature (see Authentication). For GET /v1/usage?days=30 the signed path includes the query string.
  • Use GET /v1/account to check slot headroom before adding addresses or creating payments; manage the watches themselves under Address Watch.
  • The API itself is limited to 100 requests per minute per account on every plan, separately from the RPS limit of your endpoints. On 429 wait for the Retry-After header.
  • Errors use { ok: false, error_code, error } and, for a rejected request, an errors list naming each field. See Authentication for the auth errors.