

API Reference
Creating Datasets
Version: 4.0
Updated: 14th July 2024
Updated: 14th July 2024
Overview
Post a partial dataset JSON to create a new dataset.
- The following fields are required:
title
masthead
, the ID of one of the existing mastheads, from the site JSON.team
, the ID of one of the existing teams, from the teams JSON.
- All other fields are optional.
id
is automatically assigned.sharing
defaults topublic
.
Note
You cannot upload files while creating the dataset.
First, the dataset must be assigned an ID. Then you can use the upload files API.
First, the dataset must be assigned an ID. Then you can use the upload files API.
POST
https://data.website/api/datasetHTTP Headers
Authorization | API key. | string | Required |
Content-Type | Must be "application/json". Most clients will set this automatically. | string | Required |
HTTP Return Codes
200 | Returns the full dataset JSON. |
400 | Returns a JSON object explaining the error. |
403 | API key does not have editor permissions. |
Example: Minimal dataset
import requests, os, json
api_key = os.getenv("DATAPRESS_API_KEY")
headers = { "Authorization": api_key }
dataset = {
"title": "My new dataset",
"masthead": "the-masthead-slug", # from /api/site
"team": "tm123" # from /api/teams
}
url = f"https://data.website/api/dataset"
response = requests.post(url, json=dataset, headers=headers)
print(json.dumps(response.json(), indent=2))
{
"dataset": {
"id": "444xy", # Automatically assigned
"title": "My new dataset",
"masthead": "the-masthead-slug",
"team": "tm123",
// [...full JSON structure...]
}
}