Add new data

Add a new data item. You can add a maximum of 10000 files directly through this API. Use addOrganizationDataFile to add additional files. Don't trust the code generated by the widget, there are examples of using this API in Python, cURL and Node.js under the parameters.

This API requires multipart form data to be posted, which our documentation cannot properly render. This is how you call the API in a variety of languages:

import requests

API_KEY = 'ei_...'

r =
    '' + ORGANIZATION_ID + '/data/add',
        'x-api-key': API_KEY
        ('name', (None, 'data item name')),
        ('dataset', (None, 'dataset')),
        ('metadata', (None, '{"key":"value"}')),
        ('bucketName', (None, 'Internal datasets')),
        ('files[]', ('hello.txt', open('/Users/janjongboom/Downloads/hello.txt', 'rb'), 'text/plain')),
        ('files[]', ('world.png', open('/Users/janjongboom/Downloads/world.png', 'rb'), 'image/png')),

print('request returned', r, r.content)
curl -X POST -H "x-api-key: ei_YOUR_API_KEY" \ \
    -F bucketName="Internal datasets" \
    -F dataset="dataset" \
    -F name="data item name" \
    -F metadata='{"key":"value"}' \
    -F files[][email protected]/Users/janjongboom/Downloads/hello.txt -F files[][email protected]/Users/janjongboom/Downloads/world.png
const request = require('request');
const fs = require('fs');

const API_KEY = 'ei_...';

// Make the request with an empty 'formData' object, so we can manipulate this later
let req =`${ORGANIZATION_ID}/data/add`, {
    headers: {
        'Content-Type': 'multipart/form-data',
        'x-api-key': API_KEY
    formData: { }
}, (_err, resp, body) => {
    if (_err) {
        return console.error('Error when doing request', _err);
    else if (resp.statusCode !== 200) {
        return console.error('statusCode was not 200, but ' + resp.statusCode);
    else {
        console.log('Request succeeded', body);

// the request actually gets sent at the next tick so we can still manipulate this
let form = req.form();
form.append('name', 'data item name');
form.append('dataset', 'dataset');
form.append('bucketName', 'Internal datasets');
form.append('metadata', JSON.stringify({
    key: 'value',
form.append('files[]', fs.readFileSync('/Users/janjongboom/Downloads/hello.txt'), {
    contentType: 'text/plain',
    filename: 'hello.txt'
form.append('files[]', fs.readFileSync('/Users/janjongboom/Downloads/world.png'), {
    contentType: 'image/png',
    filename: 'world.png'
Click Try It! to start a request and see the response here!