Get a dataset by slug
curl --request GET \
--url https://api.dune.com/api/v1/datasets/{slug} \
--header 'X-Dune-Api-Key: <x-dune-api-key>'import requests
url = "https://api.dune.com/api/v1/datasets/{slug}"
headers = {"X-Dune-Api-Key": "<x-dune-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Dune-Api-Key': '<x-dune-api-key>'}};
fetch('https://api.dune.com/api/v1/datasets/{slug}', 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/{slug}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.dune.com/api/v1/datasets/{slug}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Dune-Api-Key", "<x-dune-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.dune.com/api/v1/datasets/{slug}")
.header("X-Dune-Api-Key", "<x-dune-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dune.com/api/v1/datasets/{slug}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Dune-Api-Key"] = '<x-dune-api-key>'
response = http.request(request)
puts response.read_body{
"columns": [
{
"metadata": {
"description": "<string>",
"filtering_column": true
},
"name": "<string>",
"nullable": true,
"type": "<string>"
}
],
"created_at": "<string>",
"full_name": "<string>",
"is_private": true,
"metadata": "<unknown>",
"owner": {
"handle": "<string>",
"type": "<string>"
},
"type": "<string>",
"updated_at": "<string>"
}{
"error": "Bad Request"
}{
"error": "Invalid API Key"
}{
"error": "Not allowed to execute query. Query is archived, unsaved or not enough permissions"
}{
"error": "Object not found"
}{
"error": "Internal error"
}Datasets
Get Dataset
Retrieve dataset information including columns, metadata, and ownership details
GET
/
v1
/
datasets
/
{slug}
Get a dataset by slug
curl --request GET \
--url https://api.dune.com/api/v1/datasets/{slug} \
--header 'X-Dune-Api-Key: <x-dune-api-key>'import requests
url = "https://api.dune.com/api/v1/datasets/{slug}"
headers = {"X-Dune-Api-Key": "<x-dune-api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Dune-Api-Key': '<x-dune-api-key>'}};
fetch('https://api.dune.com/api/v1/datasets/{slug}', 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/{slug}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.dune.com/api/v1/datasets/{slug}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Dune-Api-Key", "<x-dune-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.dune.com/api/v1/datasets/{slug}")
.header("X-Dune-Api-Key", "<x-dune-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dune.com/api/v1/datasets/{slug}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Dune-Api-Key"] = '<x-dune-api-key>'
response = http.request(request)
puts response.read_body{
"columns": [
{
"metadata": {
"description": "<string>",
"filtering_column": true
},
"name": "<string>",
"nullable": true,
"type": "<string>"
}
],
"created_at": "<string>",
"full_name": "<string>",
"is_private": true,
"metadata": "<unknown>",
"owner": {
"handle": "<string>",
"type": "<string>"
},
"type": "<string>",
"updated_at": "<string>"
}{
"error": "Bad Request"
}{
"error": "Invalid API Key"
}{
"error": "Not allowed to execute query. Query is archived, unsaved or not enough permissions"
}{
"error": "Object not found"
}{
"error": "Internal error"
}Minimum required API key scope:
Read- Retrieve detailed information about a specific dataset by its slug - Returns
complete schema including all columns with data types - Includes ownership
details and metadata - Example slugs:
dex.trades,tokens.erc20,ethereum.transactions
Use Cases
- Schema Discovery: Retrieve the complete schema of a dataset including column names, data types, and nullability.
- Table Exploration: Understand the structure of a dataset before writing queries against it.
- Data Integration: Programmatically fetch table schemas for ETL pipelines and data integration tools.
- Documentation Generation: Automatically generate documentation for datasets based on their schemas.
- Validation: Verify dataset structure and columns before building queries or applications.
Headers
API Key for the service
Path Parameters
Dataset slug (e.g., 'dex.trades')
Query Parameters
API Key, alternative to using the HTTP header X-Dune-Api-Key
Was this page helpful?