POST
/
v1
/
table
/
upload
/
csv
curl --request POST \
  --url https://api.dune.com/api/v1/table/upload/csv \
  --header 'Content-Type: application/json' \
  --header 'X-DUNE-API-KEY: <x-dune-api-key>' \
  --data '{
  "data": "DATE,DGS10,\n2023-12-04,4.28,\n2023-12-05,4.18,\n2023-12-06,4.12,\n2023-12-07,4.14,\n2023-12-08,4.23,\n2023-12-11,4.23",
  "description": "10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
  "table_name": "ten_year_us_interest_rates",
  "is_private": false
}'
{
  "success": true,
  "table_name": "ten_year_us_interest_rates"
}

Consider using the /create and /insert endpoints if you want more flexibility, performance, and the ability to append.

You can also upload CSV through the Dune UI by pressing the “create” dropdown.

For working with uploads, keep in mind that:

  • File has to be < 200 MB
  • Column names in the table can’t start with a special character or digits.
  • Private uploads require a Premium subscription.
  • If you upload to an existing table name, it will delete the old data and overwite it with your new data. Appends are only supported for the /create, /insert endpoints.
  • To delete an upload table, you must go to user settings (dune.com) -> data -> delete.

If you have larger datasets you want to upload, please contact us here

curl --request POST \
  --url https://api.dune.com/api/v1/table/upload/csv \
  --header 'Content-Type: application/json' \
  --header 'X-DUNE-API-KEY: <x-dune-api-key>' \
  --data '{
  "data": "DATE,DGS10,\n2023-12-04,4.28,\n2023-12-05,4.18,\n2023-12-06,4.12,\n2023-12-07,4.14,\n2023-12-08,4.23,\n2023-12-11,4.23",
  "description": "10 year daily interest rates, sourced from https://fred.stlouisfed.org/series/DGS10",
  "table_name": "ten_year_us_interest_rates",
  "is_private": false
}'

Upload via google sheet

To automate the upload of a Google Sheet’s contents to Dune via API, use the following Google Apps Script:

function uploadToDune() {
  var apiKey = "YOUR_DUNE_API_KEY"; // Replace with your actual Dune API key, keep the quotes
  var tableName = "example_table"; // Update with your desired table name
  var description = "Example table description";

  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var range = sheet.getDataRange();
  var values = range.getValues();

  // Convert data to CSV format
  var csvData = "";
  for (var i = 0; i < values.length; i++) {
    csvData += values[i].join(",") + "\n";
  }

  var payload = {
    data: csvData.trim(),
    description: description,
    table_name: tableName,
    is_private: false
  };

  var options = {
    method: "post",
    contentType: "application/json",
    headers: {
      "X-DUNE-API-KEY": apiKey
    },
    payload: JSON.stringify(payload)
  };

  var response = UrlFetchApp.fetch("https://api.dune.com/api/v1/table/upload/csv", options);
  Logger.log(response.getContentText());
}

Steps to Use:

  1. Open your Google Sheet
  2. Navigate to Extensions → Apps Script
  3. Replace the script with the code above
  4. Save and run uploadToDune
  5. (Optional) For easier execution, you can assign this script to a button in your Google Sheet:
    • Click “Insert” in the Google Sheets menu
    • Select “Drawing”
    • Create a button shape and add text like “Upload to Dune”
    • Click “Save and Close”
    • Right-click the button and select “Assign script”
    • Enter “uploadToDune” as the function name
  6. Clicking the button will now upload your active sheet’s data to Dune!

Headers

X-DUNE-API-KEY
string
required

API Key for accessing this service

Body

application/json
data
string

The data to be uploaded in CSV format.

description
string

Description of the upload.

table_name
string

The name of the table to store the data.

is_private
boolean

Indicates if the upload is private.

Response

200
application/json
OK
success
boolean
table_name
string