TriportRPC

Get usage metrics

GEThttps://api.triport.io/v1/usage?range=24h&group=method

Returns aggregated request usage for the signed-in account over a time range, broken down by RPC method or by chain.

GET /v1/usage powers the usage dashboard in the Triport console. It returns top-level totals (calls, errors, bytes) for the selected time range together with a breakdown ("buckets") of the busiest dimensions — either by RPC method or by chain.

This is a console endpoint, not a data-plane RPC method. It is authenticated with the browser session cookie established at sign-in, not with an API key, and it reports on usage accrued by all of your API keys in aggregate. There is no required API scope.

Responses are cached server-side for 60 seconds per (account, range, group) combination. A served cache entry carries the header X-Cache: HIT; a freshly computed response carries X-Cache: MISS. Because of this, two identical requests made within the same minute return byte-identical bodies.

Parameters

All parameters are query-string parameters; there is no request body.

rangestringoptional
Time window to aggregate over. One of 1h, 24h, 7d, 30d. Defaults to 24h. Any other value returns invalid_range.
groupstringoptional
Breakdown dimension for the buckets array. One of method or chain. Defaults to method. Any other value returns invalid_group.

Response

Response fields

FieldTypeDescription
rangestringEcho of the effective range (the default 24h when omitted).
groupstringEcho of the effective group (the default method when omitted).
totalsobjectAccount-wide aggregate over the range.
totals.callsintegerTotal number of calls.
totals.errorsintegerNumber of calls that returned an error.
totals.bytesintegerTotal response bytes served.
bucketsarrayTop 20 rows by call volume for the chosen group. Empty array when there is no usage in the range.
buckets[].bucketstringThe dimension value — an RPC method name when group=method, or a chain name when group=chain.
buckets[].callsintegerCalls attributed to this bucket.
buckets[].errorsintegerErrored calls attributed to this bucket.
buckets[].avg_msnumberAverage response latency for this bucket, in milliseconds.
over_quotabooleantrue when the account's total calls exceed the included-call allowance of its active plan. false when within allowance or when no metered plan applies.

Response headers

HeaderDescription
X-CacheHIT when served from the 60-second server-side cache, MISS when freshly computed.

Errors

CodeHTTPWhen it happens
invalid_range400range is set to a value other than 1h, 24h, 7d, or 30d.
invalid_group400group is set to a value other than method or chain.
unauthenticated401No valid session cookie is present.
method_not_allowed405Any HTTP method other than GET.

See errors.md for the full error envelope.

Examples

JavaScript (fetch)

const res = await fetch(
  "https://api.triport.io/v1/usage?range=7d&group=chain",
  { credentials: "include" } // sends the session cookie
);
const usage = await res.json();
console.log(`Calls (7d): ${usage.totals.calls}`);
for (const row of usage.buckets) {
  console.log(`${row.bucket}: ${row.calls} calls, ${row.avg_ms} ms avg`);
}

TypeScript SDK (@triport/sdk)

import { TriportConsole } from "@triport/sdk";


const console = new TriportConsole(); // uses the active browser session
const usage = await console.usage.get({ range: "30d", group: "method" });


if (usage.over_quota) {
  console.warn("Account is over its included-call allowance");
}

Python (triport-sdk)

from triport import ConsoleClient


console = ConsoleClient(session=TRIPORT_SESSION)
usage = console.usage(range="24h", group="chain")


print(f"Total calls: {usage.totals.calls}")
for row in usage.buckets:
    print(f"{row.bucket}: {row.calls} calls, {row.avg_ms:.1f} ms avg")

Notes

  • The buckets array is capped at the top 20 rows by call volume; lower-volume methods or chains are not returned individually and are not summed into a remainder row. Use totals for the complete figure.
  • totals always reflects the full range regardless of how many buckets are returned, so sum(buckets[].calls) can be less than totals.calls.
  • Caching is keyed on (account, range, group). Switching either range or group produces a distinct cache entry, so the first request after a change is always an X-Cache: MISS.
  • This endpoint is account-scoped and aggregates across every API key. To see the set of endpoints provisioned for a single key, use the per-key endpoint catalogue under /v1/keys/{id}/endpoints.