Get chain metrics
https://api.triport.io/v1/chains/solana-mainnet/metricsFetch the latest live health snapshot — latency, uptime, block height, sync state and more — for a single chain in the Triport registry.
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
idstringrequiredsolana-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_idstringstatusstringlive, degraded, or down. Always present.latency_p50_msnumber | nulllatency_p95_msnumber | nulluptime_24h_pctnumber | null99.98).uptime_7d_pctnumber | nullblock_heightnumber | nullblock_finalizednumber | nullpeersnumber | nullsync_statusboolean | nullgas_price_nativestring | nullepochnumber | nulltpsnumber | nulllast_seen_ago_secnumber | nullmeasured_atstringErrors
All errors return a JSON envelope of the form {"error": "<code>"}.
| Code | HTTP | Meaning | When it happens |
|---|---|---|---|
chain_not_found | 404 | Unknown chain id | The {id} is not in the registry, or no metrics snapshot exists for it yet. |
metrics_disabled | 503 | Metrics unavailable | The metrics aggregator is not wired on this deployment. |
method_not_allowed | 405 | Wrong HTTP method | A 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
Authorizationheader 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"); only0means a measured zero. - Snapshot freshness. Use
last_seen_ago_secandmeasured_atto detect stale data — a largelast_seen_ago_secwithstatus: "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 theGET /v1/chains/eventsSSE stream for live status and metric ticks.