Search datasets by contract address
curl --request POST \
--url https://api.dune.com/api/v1/datasets/search-by-contract \
--header 'Content-Type: application/json' \
--header 'X-Dune-Api-Key: <x-dune-api-key>' \
--data '
{
"contract_address": "<string>",
"blockchains": [
"<string>"
],
"include_schema": true,
"limit": 123,
"offset": 123
}
'import requests
url = "https://api.dune.com/api/v1/datasets/search-by-contract"
payload = {
"contract_address": "<string>",
"blockchains": ["<string>"],
"include_schema": True,
"limit": 123,
"offset": 123
}
headers = {
"X-Dune-Api-Key": "<x-dune-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Dune-Api-Key': '<x-dune-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contract_address: '<string>',
blockchains: ['<string>'],
include_schema: true,
limit: 123,
offset: 123
})
};
fetch('https://api.dune.com/api/v1/datasets/search-by-contract', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dune.com/api/v1/datasets/search-by-contract",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contract_address' => '<string>',
'blockchains' => [
'<string>'
],
'include_schema' => true,
'limit' => 123,
'offset' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Dune-Api-Key: <x-dune-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dune.com/api/v1/datasets/search-by-contract"
payload := strings.NewReader("{\n \"contract_address\": \"<string>\",\n \"blockchains\": [\n \"<string>\"\n ],\n \"include_schema\": true,\n \"limit\": 123,\n \"offset\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Dune-Api-Key", "<x-dune-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dune.com/api/v1/datasets/search-by-contract")
.header("X-Dune-Api-Key", "<x-dune-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"contract_address\": \"<string>\",\n \"blockchains\": [\n \"<string>\"\n ],\n \"include_schema\": true,\n \"limit\": 123,\n \"offset\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dune.com/api/v1/datasets/search-by-contract")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Dune-Api-Key"] = '<x-dune-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contract_address\": \"<string>\",\n \"blockchains\": [\n \"<string>\"\n ],\n \"include_schema\": true,\n \"limit\": 123,\n \"offset\": 123\n}"
response = http.request(request)
puts response.read_body{
"pagination": {
"has_more": true,
"limit": 123,
"next_offset": 123,
"offset": 123
},
"results": [
{
"blockchains": [
"<string>"
],
"category": "<string>",
"dataset_type": "<string>",
"description": "<string>",
"full_name": "<string>",
"metadata": {
"abi_type": "<string>",
"contract_name": "<string>",
"description": "<string>",
"page_rank_score": 123,
"project_name": "<string>",
"spell_metadata": [
123
],
"spell_type": "<string>"
},
"owner_scope": "<string>",
"schema": [
123
],
"visibility": "<string>"
}
],
"total": 123
}{
"error": "Bad Request"
}{
"error": "Invalid API Key"
}{
"error": "Not allowed to execute query. Query is archived, unsaved or not enough permissions"
}{
"error": "Internal error"
}Datasets
Search Datasets by Contract Address
Find decoded datasets associated with a smart contract address
POST
/
v1
/
datasets
/
search-by-contract
Search datasets by contract address
curl --request POST \
--url https://api.dune.com/api/v1/datasets/search-by-contract \
--header 'Content-Type: application/json' \
--header 'X-Dune-Api-Key: <x-dune-api-key>' \
--data '
{
"contract_address": "<string>",
"blockchains": [
"<string>"
],
"include_schema": true,
"limit": 123,
"offset": 123
}
'import requests
url = "https://api.dune.com/api/v1/datasets/search-by-contract"
payload = {
"contract_address": "<string>",
"blockchains": ["<string>"],
"include_schema": True,
"limit": 123,
"offset": 123
}
headers = {
"X-Dune-Api-Key": "<x-dune-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Dune-Api-Key': '<x-dune-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contract_address: '<string>',
blockchains: ['<string>'],
include_schema: true,
limit: 123,
offset: 123
})
};
fetch('https://api.dune.com/api/v1/datasets/search-by-contract', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dune.com/api/v1/datasets/search-by-contract",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contract_address' => '<string>',
'blockchains' => [
'<string>'
],
'include_schema' => true,
'limit' => 123,
'offset' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Dune-Api-Key: <x-dune-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dune.com/api/v1/datasets/search-by-contract"
payload := strings.NewReader("{\n \"contract_address\": \"<string>\",\n \"blockchains\": [\n \"<string>\"\n ],\n \"include_schema\": true,\n \"limit\": 123,\n \"offset\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Dune-Api-Key", "<x-dune-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dune.com/api/v1/datasets/search-by-contract")
.header("X-Dune-Api-Key", "<x-dune-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"contract_address\": \"<string>\",\n \"blockchains\": [\n \"<string>\"\n ],\n \"include_schema\": true,\n \"limit\": 123,\n \"offset\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dune.com/api/v1/datasets/search-by-contract")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Dune-Api-Key"] = '<x-dune-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contract_address\": \"<string>\",\n \"blockchains\": [\n \"<string>\"\n ],\n \"include_schema\": true,\n \"limit\": 123,\n \"offset\": 123\n}"
response = http.request(request)
puts response.read_body{
"pagination": {
"has_more": true,
"limit": 123,
"next_offset": 123,
"offset": 123
},
"results": [
{
"blockchains": [
"<string>"
],
"category": "<string>",
"dataset_type": "<string>",
"description": "<string>",
"full_name": "<string>",
"metadata": {
"abi_type": "<string>",
"contract_name": "<string>",
"description": "<string>",
"page_rank_score": 123,
"project_name": "<string>",
"spell_metadata": [
123
],
"spell_type": "<string>"
},
"owner_scope": "<string>",
"schema": [
123
],
"visibility": "<string>"
}
],
"total": 123
}{
"error": "Bad Request"
}{
"error": "Invalid API Key"
}{
"error": "Not allowed to execute query. Query is archived, unsaved or not enough permissions"
}{
"error": "Internal error"
}Minimum required API key scope:
ReadUse Cases
- Contract Analysis: Find all decoded datasets associated with a specific smart contract address.
- Blockchain Filtering: Narrow results to decoded tables on specific blockchains using the
blockchainsparameter. - Build Contract Explorers: Power contract exploration tools that surface relevant decoded tables for any contract address.
- Data Integration: Programmatically discover decoded event and function tables for a contract to build ETL pipelines.
- Schema Discovery: Retrieve the schema of decoded tables for a contract by setting
include_schematotrue.
Headers
API Key for the service
Query Parameters
API Key, alternative to using the HTTP header X-Dune-Api-Key
Body
application/json
Search by contract address request
Was this page helpful?
⌘I