🏎️Price API
Provides real-time and historical price data for tokens listed on PiperX. > Supports querying tokens without transactions (price = 0) and up to 7 days of hourly snapshots.
1. Get All Tokens
Fetch all tokens and their latest price on PiperX (V2 & V3), including tokens without transactions.
Endpoint
[GET]
https://piperxdb.piperxprotocol.workers.dev/api/piperxapi/getAllTokens
Example Request
curl https://piperxdb.piperxprotocol.workers.dev/api/piperxapi/getAllTokens
Example Response
{
"tokens": [
{
"id": "0x1514000000000000000000000000000000000000",
"name": "Wrapped IP",
"symbol": "WIP",
"decimals": 18,
"latestPriceUSD": "6757786",
"latestPriceNative": "1000000000000000000"
}
]
}
2. Get Historical Token Prices
Fetch 24-hour and 7-day price history of one or more tokens.
Endpoint
[POST]
https://piperxdb.piperxprotocol.workers.dev/api/piperxapi/getAllTokenPrices
Request Body
{
"addresses": ["0x1514000000000000000000000000000000000000"]
}
Note: If the
addresses
field is omitted or left empty, the API will return historical price data for all tokens.
Example Request
curl -X POST \
-H "Content-Type: application/json" \
-d '{"addresses": ["0x1514000000000000000000000000000000000000"]}' \
https://piperxdb.piperxprotocol.workers.dev/api/piperxapi/getAllTokenPrices
Example Response
{
"tokens": {
"0x1514000000000000000000000000000000000000": {
"symbol": "WIP",
"now": "4.450893",
"1h": "4.466922",
"2h": "4.466922",
"3h": "4.4358",
"4h": "4.462126",
"5h": "4.546206",
"6h": "4.608218",
"7h": "4.601109",
"8h": "4.783078",
"9h": "4.622222",
"10h": "4.315662",
"11h": "4.325639",
"12h": "4.380279",
"13h": "4.229204",
"14h": "4.170735",
"15h": "4.171767",
"16h": "4.232448",
"17h": "4.249791",
"18h": "4.262093",
"19h": "4.286277",
"20h": "4.256168",
"21h": "4.217988",
"22h": "4.285186",
"23h": "4.31172",
"24h": "4.305063",
"1d": "4.170735",
"2d": "4.352007",
"3d": "4.619924",
"4d": "3.493126",
"5d": "3.099228",
"6d": "3.043802",
"7d": "3.190185"
}
},
"timestamp": 1752495887019
}
Last updated