Nansen Query Documentation
  • Introduction
  • Overview
    • 📍Getting Started
    • 📍Benefits of Curation
  • Data
    • 🗃️Data Sources
    • 🗃️Data Catalog
      • 🗃️Raw Events
      • 🗃️Aggregates
        • Entity Stats
        • Address Stats
        • Token Usage Stats
        • Transaction Stats
        • Address & Their Relationships
      • 🗃️Dex Trades
        • 🗃️Dex Trader P&L
        • 🗃️Dex Trader Use Cases
        • 🗃️Advanced Topics
        • 🗃️Trader P&L FAQ
      • 🗃️Decoded Contracts
      • 🗃️NFTs
      • 🗃️Governance
      • 🗃️Solana
        • 🗃️Solana Aggregates
    • 🗃️Repeated / Nested Fields
    • 🗃️Adding New Projects
    • 🗃️Data Marketplace
  • Web App
    • 🖥️Overview
    • 🖥️Getting Started: Web App
    • 🖥️My Queries
    • 🖥️Query Editor
    • 🖥️Visualizations
    • 🖥️Dashboards
    • 🖥️Dashboard Editor
    • 🖥️Refresh Schedules
    • ⚙️Custom Query APIs
      • ⚙️API Keys
      • ⚙️Execute A Query
      • ⚙️Get Query Results
  • Database Access
    • 📂Database Overview
    • 📂Getting Started: Database
    • 📂Sample Queries
      • 📂Wallet Examples
      • 📂Token Examples
      • 📂Trader P&L
      • 📂Project Examples
      • 📂Solana Queries
      • 📂Blockchain Examples
    • 📂Sample Python Code
      • 📂Wallet Examples
      • 📂Token Examples
    • 📂Cost Optimization
    • 📂Database FAQs
  • Other
    • ⁉️General FAQs
    • 🏷️Wallet Labels
Powered by GitBook
On this page
  • Get a cached result for this query ID as JSON
  • Get a cached result for this query ID as CSV
  • Get Query Results in Google Sheets
  1. Web App
  2. Custom Query APIs

Get Query Results

API key can be the user or query API key

Use this endpoint to get a cached result for any URL as a JSON file:

Get a cached result for this query ID as JSON

GET https://query.nansen.ai/api/queries/<url>/results.json?api_key=<api_key>

Only works for non-parameterized queries. If you attempt to GET results for a parameterized query you’ll receive the error: no cached result found for this query.

Query Parameters

Name
Type
Description

api_key*

String

If you prefer to get the results as a CSV file, use this endpoint:

Get a cached result for this query ID as CSV

GET https://query.nansen.ai/api/queries/<url>/results.csv?api_key=<api_key>

Only works for non-parameterized queries. If you attempt to GET results for a parameterized query you’ll receive the error: no cached result found for this query.

Query Parameters

Name
Type
Description

api_key*

String

Note the workflow for getting query results are:

1) Use the [User] key and the [URL] to initiate a query execution.

When the query has been initiated, it will return a job_id

2) Check the status of the query using the job_id.

When the status return 3, the query will have finished and the results can be retrieved.

3) Retrieve the results using the [User] or [API] key and the [URL]

Query Result JSON Structure

The result JSON includes two important sections, both contained in the "data" section.

  • A "columns" section, which contains the metadata for the result

  • A "rows" sections, which contain the actual result

The metadata can assist in properly processing the returned result.

{
    "query_result": {
		...
		"data": {
		   "columns": [
		                {...
		                }
		   ],
	           "rows": [
		             {
		             DATA HERE
		             }
		   ],
                   "metadata": {
                       		...
                   }
                },
                ...
     }
}

If you want to do a fresh query execution or get results for parameterized queries, see the following instructions:

Get Query Results in Google Sheets

To get your query results in Google Sheets automatically, please follow these steps:

Step 1: Go to the query you are interested in and click on Show API Key

Step 2: Copy the results in csv format URL

Step 3: Use the =importdata function on the google sheet you wish the results to be exported. Please use the following format: =importdata("csv link")

PreviousExecute A QueryNextDatabase Overview

Last updated 1 year ago

⚙️
⚙️
⚙️Execute A Query