How to get live XRP Ledger token data with curl (no API key)

2026-11-20来源 dev.toEnglish

The XRP Ledger has its own exchange built in. Tokens trade on its order book and in its AMM pools, with no smart contract in between, and over 20,000 tokens are listed. https://api.xrpl.to/v1 serves their prices, volume, holders and candles as plain JSON. You need no key and no account to start.

Below are four calls: a token list, one token, its price candles, and a live stream. Each one shows the request and the response it returned. The first three need curl and jq; the stream needs Node.js 22 or newer, or a browser console.

1. List the most traded tokens

Request

curl -s "https://api.xrpl.to/v1/tokens?limit=3&sort=vol24hxrp&lightweight=true&skip_metrics=true" \ | jq '.tokens[] | {name, md5, exch, pro24h, vol24hxrp, holders}' 

Response

{ "name": "RLUSD", "md5": "0dd550278b74cb6690fdae351e8e0df3", "exch": 1.0356437509773888, "pro24h": 1.4624728813930732, "vol24hxrp": 7221263.98096, "holders": 68179 } { "name": "USDC", "md5": "1c54f16ec1b45eef983f202b9954999b", "exch": 1.034584308692936, "pro24h": 1.3472060604135638, "vol24hxrp": 1010112.610833, "holders": 10504 } { "name": "FUZZY", "md5": "b05f7c8e58b832c74267d988567dea33", "exch": 0.0000557543008463956, "pro24h": -3.373375525796729, "vol24hxrp": 74729.499899, "holders": 11989 } 
  • exch: price in XRP
  • pro24h: price change over 24 hours, in percent
  • vol24hxrp: volume over 24 hours, in XRP
  • holders: accounts that hold the token

sort also takes marketcap, holders, pro24h, tvl and trendingScore. lightweight=true cuts each token down to about 50 fields and skip_metrics=true leaves out the market-wide totals, so the reply stays small.

RLUSD and USDC are US-dollar stablecoins, so their price in XRP goes up when XRP goes down.

2. Get one token

Every token has an id called md5: the MD5 hash of its issuer address, an underscore, and its currency code.

printf '%s' 'rMxCKbEDwqr76QuheSUMdEGf4B9xJ8m5De_524C555344000000000000000000000000000000' | md5sum # 0dd550278b74cb6690fdae351e8e0df3 

The same endpoints also take issuer-currency as the id, and XRP for XRP itself.

Request

curl -s "https://api.xrpl.to/v1/token/0dd550278b74cb6690fdae351e8e0df3?skip_metrics=true" \ | jq '.token | {name, issuer, currency, usd, exch, pro24h, marketcap, holders}' 

Response

{ "name": "RLUSD", "issuer": "rMxCKbEDwqr76QuheSUMdEGf4B9xJ8m5De", "currency": "524C555344000000000000000000000000000000", "usd": "1.0012603784449394918", "exch": 1.0356437509773888, "pro24h": 1.4624728813930732, "marketcap": 772376377.734121, "holders": 68179 } 

usd is a string so no digits are lost. marketcap is in XRP. The full token object has about 150 fields; the docs list them all.

3. Get price candles

Request

curl -s "https://api.xrpl.to/v1/ohlc/0dd550278b74cb6690fdae351e8e0df3?interval=1h&range=1D&vs_currency=USD" \ | jq -c '.ohlc[-3:][]' 

Response

[1795150800000,1.00126369,1.00167607,1.00032782,1.00121049,177440.013] [1795154400000,1.00121049,1.0017886,1.00039614,1.00081648,150731.688] [1795158000000,1.00081648,1.00153127,1.0004539,1.00126038,41366.5597] 

Each row is [time, open, high, low, close, volume], with the time in Unix milliseconds. interval goes from 1m to 1w, range from 1D to ALL, and vs_currency takes XRP, USD, EUR, JPY or CNH.

4. Stream live updates

Request

const md5 = '0dd550278b74cb6690fdae351e8e0df3'; // RLUSD const ws = new WebSocket(`wss://api.xrpl.to/ws/token/${md5}?fields=price&delta=true`); ws.onmessage = (event) => { const { type, token } = JSON.parse(event.data); console.log(type, token); }; 

Response

initial { md5: '0dd550278b74cb6690fdae351e8e0df3', exch: 1.0352741241592012, usd: '1.0009030232371157202', pro5m: 0.153867481615233, pro1h: -0.18583012934514365, pro24h: 1.4262603797667195, pro7d: 6.651799193329011, maxMin24h: [ 1.0561052833533586, 1.0033332387654907 ], vol24hxrp: 7220264.715337, marketcap: 772100712.4557126 } update { md5: '0dd550278b74cb6690fdae351e8e0df3', vol24hxrp: 7220265.235337 } update { md5: '0dd550278b74cb6690fdae351e8e0df3', usd: '1.0009547869433236802' } update { md5: '0dd550278b74cb6690fdae351e8e0df3', vol24hxrp: 7220256.272491 } 

The first message has every price field. With delta=true, each update after it carries only the fields that changed. The other streams work the same way: /ws/ohlc/{md5} for candles, /ws/history/{md5} for trades, /ws/orderbook for order book depth and /ws/ledger for every ledger close.

Limits

Without a key you get 2 requests a second, 30 a minute and 333 a day. Every response has x-ratelimit-* headers that show what is left. A free key raises this to 10 requests a second and 1 million credits a month; create one on the dashboard.

Credit

If your app, site or bot shows this data, put a visible link to xrpl.to on the same screen:

<a href="https://xrpl.to" target="_blank" rel="noopener">Data by xrpl.to</a> 

Storing the data and serving it again from your own API needs written permission first: email hello@xrpl.to.

Next

原文:https://www.a8q9.cn/en/article/how-to-get-live-xrp-ledger-token-data-with-curl-no-api-key-643bcd.html

相关文章