POST
/
v1
/
table
/
create
curl --request POST \
  --url https://api.dune.com/api/v1/table/create \
  --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}]
}'
{
  "namespace": "my_user",
  "table_name": "my_data",
  "full_name": "dune.my_user.my_data",
  "example_query": "select * from dune.my_user.my_data",
  "already_existed": false,
  "message": "Table created successfully"
}
The resulting table will be empty, and can be inserted into with the /insert endpoint.
  • 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 10 credits.
  • To delete a table, you can go to user settings (dune.com) -> data -> delete or use the /delete endpoint.

Schema

You need to define the schema of your data by providing schema 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
nullable: if the column is nullable (true/false, true by default)
curl --request POST \
  --url https://api.dune.com/api/v1/table/create \
  --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}]
}'

Authorizations

x-dune-api-key
string
header
required

The API key of your team or user.

Body

application/json

Create a new Dune Table for uploads

table_name
string
required

The name of the table to create. Must begin with a lowercase letter and contain only lowercase letters, digits, and underscores.

Example:

"my_data"

schema
object[]
required

An ordered list of columns that define the table schema. Cannot be empty.

namespace
string

The namespace of the table to create. Only the name of your associated API key is allowed at the moment, i.e. either my_user or my_team. (Optional. Default is the namespace of your API key.)

Example:

"my_user"

is_private
boolean
default:false

If true, the table will be private. If private it is only visible to the team or user that your API key is associated with.

description
string

A description of the table.

Response

The Dune table namespace.table_name already existed with the same data as the request.

namespace
string

The namespace of the table.

Example:

"my_user"

table_name
string

The name of the table.

Example:

"my_data"

full_name
string

The full name of the table, as it should be referred to in a query.

Example:

"dune.my_user.my_data"

example_query
string

An example query to use on Dune querying your new table.

Example:

"select * from dune.my_user.my_data"

already_existed
boolean

Whether the request already existed.

Example:

false

message
string

A message explaining whether the table was created in this request or not. The same information is encoded in already_existed.

Example:

"Table created successfully"