POST
/
v1
/
blockchain
/
{chain}
/
{table_name}
/
insert
curl --request POST \
  --url https://api.dune.com/api/v1/blockchain/my_chain/blocks/insert \
  --header 'X-DUNE-API-KEY: <x-dune-api-key>' \
  --header 'Content-Type: text/csv' \
  --upload-file blocks.csv
{
  "rows_written": 9000,
  "bytes_written": 90
}

The Insert endpoint allows you to push your raw blockchain data onto Dune. Supported tables and required schemas are listed below.

On the initial insert, the endpoint will automatically create a table for you under the associated namespace under your API key, e.g. my_chain.blocks.

Supported tables and required schemas

  • Ensure that data in the files strictly conforms to the specified schema and uses identical column names.
  • For columns of type varbinary, submit the data in string format. See varbinary values for more info.
  • The maximum allowable request size is 1.2GB.

Consistency

A request to this endpoint has two possible outcomes: Either all of the data in the request was inserted, or none of it was. It’s not possible for parts of the request data to be inserted, while the rest is not inserted. In other words, please use and trust the status codes that the endpoint returns. A status code of 200 means that the data in the request was successfully inserted. If you get any other status code, you can safely retry your request after addressing the issue that the error message indicated.

Concurrent requests

A limited number of concurrent insertion requests per table is supported. However, there will be a slight performance penalty as we serialize the writes behind the scenes to ensure data integrity. Larger number of concurrent requests per table may result in an increased number of failures. Therefore, we recommend managing your requests within a 5-10 threshold to maintain optimal performance.

Supported filetypes

CSV files (Content-Type: text/csv)

CSV files must use a comma as delimiter, and the column names in the header must match the column names of the table.

JSON files (Content-Type: application/x-ndjson)

These are files where each line is a complete JSON object which creates one table row. Each line must have keys that match the column names of the table.

Authorizations

x-dune-api-key
string
headerrequired

The API key of your team or user.

Path Parameters

chain
string
required

The blockchain of the table to insert into (e.g. my_chain).

table_name
string
required

The name of one of the supported tables to insert into (e.g. blocks).

Body

The body is of type file.

Response

200 - application/json
rows_written
number

The number of rows that were written to the table.

bytes_written
number

The number of bytes that were written to the table.