⚙️Predefined Endpoints

Getting Started

The API requires an access token for all requests. Tokens are time sensitive and generated on demand based on your Nansen web login credentials. Please use the instructions in Access Token to retrieve your token. Tokens are valid for one hour and a new one must be requested after one hour.

The base URL for the API is below:

https://query.api.nansen.ai

For all the endpoints, if a request with the same parameters has been requested before, we will return the cached version. If you want the updated data, please pass in "accept_stale": false (default is true) with the params. Please note, we do set a TTL on each endpoint so some endpoints may not refresh as frequently as others.

To always return the freshest results, use "accept_stale": false. However, there is a chance that the query might time out if the result requires significant amount of processing, such as when the most recent blocks contain significant amount of relevant transactions.

The parameters must be passed in a field called params. An example of a body with accept_stale is below:

{
    "params": {
        "params1": "value1",
	"params2": "value2"
    },
    "accept_stale": false
}

Usage Example

API requests must adhere to the following format. This is an example query for Token God Mode's Last 7 Day Balance Change endpoint.

curl -i -H "Accept: application/json" \
    -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer TOKEN" \
    -d '{"params": {"token": "0x..."}}' \
    https://query.api.nansen.ai/v1/questions/api_tgm_balance_change_7d

Last updated