curl --request POST \
--url https://api.dune.com/api/v1/uploads \
--header 'X-DUNE-API-KEY: <x-dune-api-key>' \
--header 'Content-Type: application/json' \
--data '{
"namespace":"my_user",
"table_name":"interest_rates",
"description": "10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
"is_private": false,
"schema": [{"name": "date", "type": "timestamp"}, {"name": "dgs10", "type": "double", "nullable": true}]
}'
from dune_client.client import DuneClient
dune = DuneClient()
table = dune.create_table(
namespace="my_user",
table_name="interest_rates",
description="10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
schema= [
{"name": "date", "type": "timestamp"},
{"name": "dgs10", "type": "double", "nullable": True}
],
is_private=False
)
import { DuneClient, ColumnType } from "@duneanalytics/client-sdk";
client = new DuneClient(process.env.DUNE_API_KEY!);
const result = await client.table.create({
namespace: "my_user",
table_name: "interest_rates",
schema: [
{"name": "date", "type": ColumnType.Timestamp},
{"name": "dgs10", "type": ColumnType.Double}
]
});
import requests
url = "https://api.dune.com/api/v1/uploads"
payload = {
"namespace": "my_user",
"table_name": "interest_rates",
"description": "10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
"schema": [{"name": "date", "type": "timestamp"}, {"name": "dgs10", "type": "double", "nullable": True}],
"is_private": False
}
headers = {
"X-DUNE-API-KEY": "<x-dune-api-key>",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
const url = "https://api.dune.com/api/v1/uploads";
const payload = {
"namespace": "my_user",
"table_name": "interest_rates",
"description": "10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
"schema": [{"name": "date", "type": "timestamp"}, {"name": "dgs10", "type": "double", "nullable": true}],
"is_private": false
};
const headers = {
"X-DUNE-API-KEY": "<x-dune-api-key>",
"Content-Type": "application/json"
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
{
"already_existed": true,
"example_query": "<string>",
"full_name": "<string>",
"message": "<string>",
"namespace": "<string>",
"table_name": "<string>"
}{
"already_existed": true,
"example_query": "<string>",
"full_name": "<string>",
"message": "<string>",
"namespace": "<string>",
"table_name": "<string>"
}{
"error": "Bad Request"
}{
"error": "Object not found"
}{
"error": "Internal error"
}Data Uploads
Create Table
Creates an empty uploaded table that can be inserted into with the /insert endpoint. Each successful table creation consumes 10 credits.
POST
/
v1
/
uploads
curl --request POST \
--url https://api.dune.com/api/v1/uploads \
--header 'X-DUNE-API-KEY: <x-dune-api-key>' \
--header 'Content-Type: application/json' \
--data '{
"namespace":"my_user",
"table_name":"interest_rates",
"description": "10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
"is_private": false,
"schema": [{"name": "date", "type": "timestamp"}, {"name": "dgs10", "type": "double", "nullable": true}]
}'
from dune_client.client import DuneClient
dune = DuneClient()
table = dune.create_table(
namespace="my_user",
table_name="interest_rates",
description="10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
schema= [
{"name": "date", "type": "timestamp"},
{"name": "dgs10", "type": "double", "nullable": True}
],
is_private=False
)
import { DuneClient, ColumnType } from "@duneanalytics/client-sdk";
client = new DuneClient(process.env.DUNE_API_KEY!);
const result = await client.table.create({
namespace: "my_user",
table_name: "interest_rates",
schema: [
{"name": "date", "type": ColumnType.Timestamp},
{"name": "dgs10", "type": ColumnType.Double}
]
});
import requests
url = "https://api.dune.com/api/v1/uploads"
payload = {
"namespace": "my_user",
"table_name": "interest_rates",
"description": "10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
"schema": [{"name": "date", "type": "timestamp"}, {"name": "dgs10", "type": "double", "nullable": True}],
"is_private": False
}
headers = {
"X-DUNE-API-KEY": "<x-dune-api-key>",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
const url = "https://api.dune.com/api/v1/uploads";
const payload = {
"namespace": "my_user",
"table_name": "interest_rates",
"description": "10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
"schema": [{"name": "date", "type": "timestamp"}, {"name": "dgs10", "type": "double", "nullable": true}],
"is_private": false
};
const headers = {
"X-DUNE-API-KEY": "<x-dune-api-key>",
"Content-Type": "application/json"
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
{
"already_existed": true,
"example_query": "<string>",
"full_name": "<string>",
"message": "<string>",
"namespace": "<string>",
"table_name": "<string>"
}{
"already_existed": true,
"example_query": "<string>",
"full_name": "<string>",
"message": "<string>",
"namespace": "<string>",
"table_name": "<string>"
}{
"error": "Bad Request"
}{
"error": "Object not found"
}{
"error": "Internal error"
}Minimum required API key scope:
Read/Write- If a table already exists with the same name, the request will fail.
- Column names in the table can’t start with a special character or a digit.
- Each successful table creation consumes credits based on the table size created. Minimum charge is 1 credit.
- To delete a table, you can go to
user settings (dune.com) -> data -> deleteor use the /delete endpoint.
Migrating from the old API? See the Migration Guide for help updating your code.
Schema
You need to define the schema of your data by providingschema array of columns in the request. Each column has three parameters:
name: the name of the field
type: the data type of the field
Dune supports ISO 8601 timestamp format
curl --request POST \
--url https://api.dune.com/api/v1/uploads \
--header 'X-DUNE-API-KEY: <x-dune-api-key>' \
--header 'Content-Type: application/json' \
--data '{
"namespace":"my_user",
"table_name":"interest_rates",
"description": "10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
"is_private": false,
"schema": [{"name": "date", "type": "timestamp"}, {"name": "dgs10", "type": "double", "nullable": true}]
}'
from dune_client.client import DuneClient
dune = DuneClient()
table = dune.create_table(
namespace="my_user",
table_name="interest_rates",
description="10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
schema= [
{"name": "date", "type": "timestamp"},
{"name": "dgs10", "type": "double", "nullable": True}
],
is_private=False
)
import { DuneClient, ColumnType } from "@duneanalytics/client-sdk";
client = new DuneClient(process.env.DUNE_API_KEY!);
const result = await client.table.create({
namespace: "my_user",
table_name: "interest_rates",
schema: [
{"name": "date", "type": ColumnType.Timestamp},
{"name": "dgs10", "type": ColumnType.Double}
]
});
import requests
url = "https://api.dune.com/api/v1/uploads"
payload = {
"namespace": "my_user",
"table_name": "interest_rates",
"description": "10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
"schema": [{"name": "date", "type": "timestamp"}, {"name": "dgs10", "type": "double", "nullable": True}],
"is_private": False
}
headers = {
"X-DUNE-API-KEY": "<x-dune-api-key>",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
const url = "https://api.dune.com/api/v1/uploads";
const payload = {
"namespace": "my_user",
"table_name": "interest_rates",
"description": "10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
"schema": [{"name": "date", "type": "timestamp"}, {"name": "dgs10", "type": "double", "nullable": true}],
"is_private": false
};
const headers = {
"X-DUNE-API-KEY": "<x-dune-api-key>",
"Content-Type": "application/json"
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Headers
API Key for the service
Query Parameters
Alternative to using the X-Dune-Api-Key header
Body
*/*
payload
Was this page helpful?
⌘I