Skip to main content

Historical Data

Historical Data APIs are designed to retrieve historical data that Nakji connectors have indexed.

Base URL: https://api.nakji.network/v1

All REST API endpoints support optional authentication headers, which is used to provide higher rate limits. Refer to our authentication for more information.

Endpoints

/data/<stream_name>

Get historical data from a given data stream. The data format this endpoint returns is the same as it is stored.

Request vars

  • stream_name: search filter (e.g. nakji.common.0_0_0.liquiditypool_change)
  • from (optional): time window lower bound. In unix time seconds.
  • to (optional): time window upper bound, defaults to now. In unix time seconds.
  • limit (optional): database query limit (max. 100). In int.
  • skip (optional): skip a specified number of rows before the beginning of the result set. In int.

You may also filter results by any string-typed field that exists for the specific stream that is being queried (eg buyer for the example below). This may cause a change in response latency.

Response

The response depends on the stream you are querying and is determined by the connector that the data stream is ingesting.

Examples

curl -i -X GET \
-H 'Origin: https://yourdomain' \ # This is required for authenticating your API Key
-H 'Authorization:Bearer <apikey>' \ # Enter your API key here
"https://api.nakji.network/v1/data/nakji.solanatoken.0_0_0.token_trade?from=1616805306&to=1649493698&buyer=AUGMGuqA2iJYVKTtGPyNaisFb45dTStARvxDqM13MMry"

{
"nftAddress": "GV31vcKJesTgTTxKxSuy9k9LiL9jB8Rcj4jy6hPMp9Mf",
"ts": {
"seconds": 1645349997
},
"transaction": "4hwKMv6TvYptKJqYw9Bpi95Di1NKVYo4WVTabVsnyjwXQNqoxS7keX3LU4H6v1CoCPbxGbHuMwA6AWpJ5Wkyb678",
"buyer": "AUGMGuqA2iJYVKTtGPyNaisFb45dTStARvxDqM13MMry",
"seller": "8dhgrufK7jQnxr4PcUtyDJTB5Et3U5WV4uAQoVcLK5j5",
"price": 12500000,
"soldOn": "magiceden"
}
curl -i -X GET \
-H 'Origin: https://yourdomain' \ # This is required for authenticating your API Key
-H 'Authorization:Bearer <apikey>' \ # Enter your API key here
"https://api.nakji.network/v1/data/nakji.common.0_0_0.liquiditypool_change?ns=daofi&s=0x2C98813dea4AA80F0F160748450f0ABFd51FB558&from=1616805306&to=1616915273&resolution=1"

{
"ns":"daofi",
"s":"0x2C98813dea4AA80F0F160748450f0ABFd51FB558",
"ts":"2021-03-27T05:05:48Z",
"block":12119181,
"idx":241,
"tx":"9uPiY9Fg2aVNNmUnwILz7gT2Z9D3svLp3j+1/tVep40=", // base64 encoded
"sender":"eiUNVjC0z1OXOd8sXay0xlnySI0=", // base64 encoded
"to":"FHgbdfaYtmrOvJq8L/iTQ5ke3tE=", // base64 encoded
"amount0In":100000000000000000,
"amount0Out":0,
"amount1In":0,
"amount1Out":367394634193879528
}

/pair

Retrieves metadata of a pair.

Request vars

  • network: network name (e.g. ethereum)
  • address: hex address within the network (e.g. 0xBB8a43724dE8BC071d7278bAcCB19363545fE758)
Example
curl -i -X GET \
-H 'Origin: https://yourdomain' \ # This is required for authenticating your API Key
-H 'Authorization:Bearer <apikey>' \ # Enter your API key here
"https://api.nakji.network/v1/pair?network=ethereum&address=0x67483a1229b1304d9df461fb8e7671b1bd66e3fa"

Response vars

  • network: network name (e.g. ethereum)
  • address: hex address within the network (e.g. 0xBB8a43724dE8BC071d7278bAcCB19363545fE758)
  • app: dApp name of where the data is from
  • token0: information on the first token of the pair. Includes address, decimals, name, and symbol
  • token1: information on the second token of the pair. Includes address, decimals, name, and symbol
Example
{
"network": "ethereum",
"address": "0x67483a1229b1304d9df461fb8e7671b1bd66e3fa",
"app": "uniswapv2",
"token0": {
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"decimals": 6,
"name": "USD Coin",
"symbol": "USDC"
},
"token1": {
"address": "0xD2dDa223b2617cB616c1580db421e4cFAe6a8a85",
"decimals": 18,
"name": "Bondly Token",
"symbol": "BONDLY"
}
}