Skip to content

Commit 145c605

Browse files
authored
Merge pull request duneanalytics#319 from duneanalytics/small-fixes
improve docs
2 parents 5823540 + cffccaa commit 145c605

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

docs/api/upload-api.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,25 @@ The Dune CSV Upload API allows you to upload CSV files in the Dune database. Thi
1010

1111
Currently, the API only supports uploading CSV files with a maximum size of 200 MB. The API will return an error if the file size exceeds this limit.
1212

13+
For now, all files will be stored in the ``dunecat`` schema in the Dune database. In the future, we will allow users to specify the schema where the data should be stored. The table name must be specified in the request payload.
14+
15+
```sql
16+
Select * from dunecat.example_table
17+
```
18+
1319
**All Data uploaded via this API is public and can be accessed by anyone.**
1420

21+
## How to use the API
1522

23+
Here are the key details you need to know to use the API.
1624

17-
## Authentication
25+
### Authentication
1826

1927
To authenticate with the API, you must include your API key in the request headers. The header should look like this:
2028

2129
``X-Dune-Api-Key : <your-api-key>``
2230

23-
## Endpoint
31+
### Endpoint
2432

2533
The API endpoint for uploading a CSV file is:
2634

@@ -32,7 +40,6 @@ POST https://api.dune.com/api/v1/table/upload/csv
3240

3341
The request payload should be a JSON object containing the following fields:
3442

35-
- `namespace`: (string) The schema in the Dune database. This is static for now and should be set to ``dunecat``.
3643
- `table_name`: (string) The target table in the database where the CSV data should be uploaded.
3744
- `description`: (string, optional) A brief description of the uploaded data. Will be displayed in the Dune UI in the future.
3845
- `data`: (string) The content of the CSV file, passed as a string.
@@ -41,7 +48,6 @@ The request payload should be a JSON object containing the following fields:
4148

4249
```json
4350
{
44-
"namespace": "dunecat",
4551
"table_name": "example_table",
4652
"description": "Sample data for testing",
4753
"data": "column1,column2\nvalue1,value2\nvalue3,value4"
@@ -79,8 +85,7 @@ with open(csv_file_path) as open_file:
7985
headers = {'X-Dune-Api-Key': api_key}
8086

8187
payload = {
82-
"namespace": "dunecat",
83-
"table_name": "test_name",
88+
"table_name": "example_table",
8489
"description": "test_description",
8590
"data": str(data)
8691
}
@@ -90,4 +95,14 @@ with open(csv_file_path) as open_file:
9095
print('Response status code:', response.status_code)
9196
print('Response content:', response.content)
9297

93-
```
98+
```
99+
100+
101+
## Querying for the data in Dune
102+
103+
Once the data has been uploaded, you can query it using the following SQL query:
104+
105+
```sql
106+
Select * from dunecat.example_table
107+
```
108+

0 commit comments

Comments
 (0)