stellarHorizonListLedgers — Stellar REST API
List retained Horizon ledgers.
GET
https://triport.io/rpc/stellar/horizon/ledgers?limit=1&order=desc- Network
- Stellar mainnet
- Scope
- stellar:rpc
- Auth
- x-token: $TRIPORT_API_KEY (or Authorization: Bearer)
- Rate limit
- stellar_read_rpc — 15 / 20 / 100 / 250 RPS sustained · short burst 30 / 40 / 200 / 500 (free / basic / pro / business) (plan policy); Burst capacity
Endpoint and plans: Stellar RPC endpoint.
Returns a cursor-paginated HAL page of ledgers inside the selected Horizon node's retention window.
Use it for recent ledger-header ingestion or close-time tracking. Use stellarHorizonGetLedger when one known sequence is required, or Soroban getLedgers when JSON-RPC/XDR is preferred.
The measured Horizon node retained 6,307,191 ledgers. This is a per-operator observation, not a network-wide archive guarantee.
Parameters
cursorstringoptionalOpaque Horizon paging token from a returned link.
orderstringoptionalSort direction:
asc or desc.limitintegeroptionalMaximum page size from 1 through 200; 201 was rejected in measurement.
Response
_linksobjectHAL navigation links; additional link relations may be present.
_links.next.hrefstringURL carrying the cursor for the next page.
_embeddedobjectContainer for the returned collection.
_embedded.recordsarrayPage of ledger HAL resources.
_embedded.records[].sequenceintegerLedger sequence.
_embedded.records[].paging_tokenstringOpaque cursor; keep it as a string.
_embedded.records[].closed_atstringLedger close timestamp.
Errors
See Stellar errors and the shared error reference.
| Status | Meaning | When it happens |
|---|---|---|
400 | Bad request | A query parameter is malformed or limit exceeds 200. |
401 | Unauthorized | The API key is missing or invalid. |
403 | Forbidden | The key lacks the required scope or tier. |
429 | Rate limited | The stellar_read_rpc RPS budget is exceeded. |
Examples
JavaScript (fetch)
const response = await fetch("https://triport.io/rpc/stellar/horizon/ledgers?limit=1&order=desc", {
headers: {
"Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
"Accept": "application/hal+json",
},
});
if (!response.ok) throw new Error(`Horizon returned ${response.status}`);
const payload = await response.json();
console.log(payload);Notes
limitis at most 200.- Keep paging tokens as strings to avoid integer precision loss.
- Related:
stellarHorizonGetLedgerand SorobangetLedgers. - Horizon is currently served by one measured operator on a best-effort basis without an SLA.
- This product surface is read-only; transaction submission is unavailable.