Execute A Query

In order to execute one of your queries call the following endpoint
By default, a query will return the most recent cached result. To change this behavior, set max_age to 0. See below for more details.
post
https://query.nansen.ai/api
/queries/<id>/refresh?api_key=<user_api_key>
Initiates a new query execution or returns a cached result
Here’s an example JSON object including different parameter types to be included in the request body:
{
"parameters": {
"number_param": 100,
"date_param": "2020-01-01",
"date_range_param": {
"start": "2020-01-01",
"end": "2020-12-31"
}
},
"max_age": 1800
}
}
Note that queries by themselves also have a refresh rate. If the data needed is only every hour, you can set a refresh rate on the query to be 1 hour and retrieve the most recent result, without needing to trigger a refresh.

Jobs

get
https://query.nansen.ai/api
/jobs/<job_id>?api_key=<user_api_key>
Checks the status of the Query job
  • GET: Returns a query task result (job)
    • Possible statuses:
      • 1 == PENDING (waiting to be executed)
      • 2 == STARTED (executing)
      • 3 == SUCCESS
      • 4 == FAILURE
      • 5 == CANCELLED
    • When status is success, the job will include a query_result_id