Skip to content

Add items to an existing dataset

POST/v5/dataset-items/batch

Add one or more items in a single batch to a dataset that already exists.

Use this to append items to an existing dataset; to create a dataset together with its initial items in one call, use POST /v5/datasets instead (this endpoint does not create datasets). Items are only ever added in a batch — there is no single-item create endpoint. The target dataset is identified by the required dataset_id in the request body, and each entry in data (at least one is required) becomes one item, optionally paired with the files entry at the same list index — when files is supplied it must be the same length as data. Each referenced file must exist and be a supported media format, and item keys may not collide with reserved dataset- or evaluation-item field names. The target dataset must not be archived. The batch is applied as a new dataset version snapshot rather than mutating existing versions, and the created items are returned.

Body ParametersJSONExpand Collapse
data: array of map[unknown]

Items to be added to the dataset

dataset_id: string

Identifier of the target dataset

files: optional array of map[string]

Files to be associated to the dataset

ReturnsExpand Collapse
items: array of DatasetItem { id, content_hash, created_at, 7 more }
id: string

The unique identifier of the entity.

content_hash: string
created_at: string

The date and time when the entity was created in ISO format.

formatdate-time
created_by: Identity { id, type, object }

The identity that created the entity.

id: string
type: "user" or "service_account"
One of the following:
"user"
"service_account"
object: optional "identity"
data: map[unknown]
updated_at: string

The date and time when the entity was last updated in ISO format.

formatdate-time
archived_at: optional string

The date and time when the entity was archived in ISO format.

formatdate-time
dataset_id: optional string
files: optional map[string]
object: optional "dataset.item"
object: optional "list"

Add items to an existing dataset

curl https://api.egp.scale.com/v5/dataset-items/batch \
    -H 'Content-Type: application/json' \
    -H "x-api-key: $SGP_API_KEY" \
    -d '{
          "data": [
            {
              "foo": "bar"
            }
          ],
          "dataset_id": "dataset_id"
        }'
{
  "items": [
    {
      "id": "id",
      "content_hash": "content_hash",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": {
        "id": "id",
        "type": "user",
        "object": "identity"
      },
      "data": {
        "foo": "bar"
      },
      "updated_at": "2019-12-27T18:11:19.117Z",
      "archived_at": "2019-12-27T18:11:19.117Z",
      "dataset_id": "dataset_id",
      "files": {
        "foo": "string"
      },
      "object": "dataset.item"
    }
  ],
  "object": "list"
}
Returns Examples
{
  "items": [
    {
      "id": "id",
      "content_hash": "content_hash",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": {
        "id": "id",
        "type": "user",
        "object": "identity"
      },
      "data": {
        "foo": "bar"
      },
      "updated_at": "2019-12-27T18:11:19.117Z",
      "archived_at": "2019-12-27T18:11:19.117Z",
      "dataset_id": "dataset_id",
      "files": {
        "foo": "string"
      },
      "object": "dataset.item"
    }
  ],
  "object": "list"
}