TriportRPC

Get chain metrics

GEThttps://api.triport.io/v1/chains/solana-mainnet/metrics

Fetch the latest live health snapshot — latency, uptime, block height, sync state and more — for a single chain in the Triport registry.

— (any chain in the registry)— (public observability data)

Returns the most recent ChainMetrics snapshot for the chain identified by {id}. Metrics are observability data — they describe the live health of a chain's upstream, not anything tied to your account — so this endpoint is public and requires no authentication.

Use it to render status badges, latency readouts, block-height tickers, or "is this chain healthy right now?" indicators in a dashboard. For a bucketed time series rather than a single snapshot, use GET /v1/chains/{id}/metrics/series. For the chain's static descriptor (name, protocols, capabilities) use GET /v1/chains/{id}.

The null-vs-zero invariant

Every numeric field in the response is typed number | null. null means "no observation available" — it is not the same as 0. A real measured value of 0 is meaningful (e.g. a genuine latency_p50_ms of 0, or peers: 0), so clients must branch on presence, not truthiness:

// correct
if (m.latency_p50_ms != null) render(m.latency_p50_ms);
// WRONG — hides a real 0 and treats it as "no data"
if (m.latency_p50_ms) render(m.latency_p50_ms);

Only chain_id, status, and measured_at are always present. Everything else may be null until the collector has gathered a sample for that field.

Parameters

Path parameters

idstringrequired
Chain identifier from the registry (e.g. solana-mainnet). The value is URL-encoded by clients.

Response

200 OK — the latest snapshot:

The example above is a non-EVM (Solana) chain, so peers and gas_price_native are null while epoch and tps are populated. An EVM chain would typically populate peers and gas_price_native and leave epoch/tps null. Which fields carry data depends on what the upstream exposes — always handle null for any numeric field.

chain_idstring
Echoes the requested chain id. Always present.
statusstring
Health status: live, degraded, or down. Always present.
latency_p50_msnumber | null
Median request latency in milliseconds.
latency_p95_msnumber | null
95th-percentile request latency in milliseconds.
uptime_24h_pctnumber | null
Uptime over the last 24 hours, as a percentage (e.g. 99.98).
uptime_7d_pctnumber | null
Uptime over the last 7 days, as a percentage.
block_heightnumber | null
Latest observed block / slot height.
block_finalizednumber | null
Latest finalized block / slot height.
peersnumber | null
Connected peer count (typically EVM chains).
sync_statusboolean | null
Whether the upstream reports as fully synced.
gas_price_nativestring | null
Current gas price in the chain's native unit, as a decimal string (typically EVM chains).
epochnumber | null
Current epoch (typically Solana).
tpsnumber | null
Transactions per second (typically Solana).
last_seen_ago_secnumber | null
Seconds since the last successful observation.
measured_atstring
RFC 3339 / ISO 8601 timestamp of when this snapshot was taken. Always present.

Errors

All errors return a JSON envelope of the form {"error": "<code>"}.

CodeHTTPMeaningWhen it happens
chain_not_found404Unknown chain idThe {id} is not in the registry, or no metrics snapshot exists for it yet.
metrics_disabled503Metrics unavailableThe metrics aggregator is not wired on this deployment.
method_not_allowed405Wrong HTTP methodA method other than GET was used.

See the shared errors reference for the full error envelope and conventions.

Examples

JavaScript (fetch)

const res = await fetch(
  `https://api.triport.io/v1/chains/${encodeURIComponent("solana-mainnet")}/metrics`,
);
if (!res.ok) {
  const { error } = await res.json();
  throw new Error(error);
}
const m = await res.json();


// Respect the null-vs-zero invariant.
const p50 = m.latency_p50_ms != null ? `${m.latency_p50_ms} ms` : "—";
console.log(`${m.chain_id}: ${m.status}, p50 ${p50}`);

TypeScript SDK (@triport/sdk)

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


const client = new Triport(); // no API key needed for public chain metrics


const m = await client.chains.metrics("solana-mainnet");


if (m.latency_p50_ms != null) {
  console.log(`p50 latency: ${m.latency_p50_ms} ms`);
}

Python (triport-sdk)

from triport import Triport


client = Triport()  # no API key needed for public chain metrics


m = client.chains.metrics("solana-mainnet")


# `is not None`, never a truthiness check — a real 0 is meaningful.
if m.latency_p50_ms is not None:
    print(f"p50 latency: {m.latency_p50_ms} ms")

Notes

  • Public endpoint. No Authorization header is required; sending one has no effect on the response.
  • Null vs zero. Re-read the invariant above before rendering. Any numeric field can be null ("no observation"); only 0 means a measured zero.
  • Snapshot freshness. Use last_seen_ago_sec and measured_at to detect stale data — a large last_seen_ago_sec with status: "down" indicates the upstream has gone silent.
  • Related endpoints: GET /v1/chains (registry list), GET /v1/chains/{id} (descriptor + latest metrics in one call), GET /v1/chains/{id}/metrics/series (bucketed history), and the GET /v1/chains/events SSE stream for live status and metric ticks.