Using HTTP
Every method that answers once is plain HTTP too, on https://api.intea.rs, for clients that don’t need anything live:
| Path | Method |
|---|---|
/tokens |
tokens.get |
/tokens/search |
tokens.search |
/trades |
trades.query |
/transfers |
transfers.query |
/activity |
activity.query |
/candles |
candles.get |
/prices/at |
prices.at |
/balances |
balances.get |
/holders |
holders.get |
/positions |
positions.get |
/schema |
schema |
The response’s body is what the method’s result would be on the WebSocket.
GET or POST
Section titled “GET or POST”A GET takes the params in its URL. A POST takes them as a JSON body, exactly as params on the WebSocket, up to 64 KiB, for what’s too long for a URL:
curl -X POST https://api.intea.rs/tokens \ -d '{"fields": ["symbol", "price_usd"], "ids": ["wrap.near", "usdt.tether-token.near"]}'Params in a URL
Section titled “Params in a URL”- A list is comma-separated:
fields=symbol,price_usd. - An object’s keys are dotted:
min_change.price_usd=0.1%25(%is URL-encoded), orfields.trade=amount_in,amount_outforactivity.query. where’s params go withoutwhere:min_reputation=NotFake,min.liquidity_usd=1000.sort=volume_usd_24hsorts ascending, andsort=-volume_usd_24hdescending.prices.at’s queries areat=<token>:<timestamp_millis>, comma-separated.- A param given twice, or one the method doesn’t take, is a
bad_request.
For example, the 10 tokens with the most volume in the last 24 hours:
GET https://api.intea.rs/tokens?fields=symbol,price_usd,volume_usd_24h&sort=-volume_usd_24h&limit=10&min_reputation=NotFakeErrors
Section titled “Errors”An error is { "error": { "code": "...", "message": "..." } }, with the status:
| Status | Codes |
|---|---|
404 |
not_found, and unknown_method for a path nothing is served at |
500 |
internal |
400 |
every other code |
See Errors for what each code means.
Caching and compression
Section titled “Caching and compression”Responses can be cached for a second (Cache-Control: public, max-age=1). Responses only about the past can be cached for a day (max-age=86400):
- history with a
cursor(newest first), with abefore_millisthe latest block has passed, or oldest first with anext_cursor; - candles up to a
to_milliswhose candle has closed; prices.atof times the latest block has passed.
None of them are cached when a token asked about doesn’t exist, since it may yet. A cached response keeps the height and latest_id it was first answered with.
Responses allow any origin (CORS), and are compressed with gzip or zstd when the request’s Accept-Encoding allows it. The X-Credits-Used header has the credits the response would cost.