Skip to main content
Opik Documentation

Search documentation

Type to search this documentation.

Create/update dataset items

PUT/v1/private/datasets/itemsCreate/update dataset items

Create/update dataset items based on dataset item id. Each item's 'id' field is the stable identifier and upsert key. Provide it to update an existing item, or omit it to create a new one.

Set 'copy_from_dataset_id' and 'copy_from_version_id' together to read carry-forward rows from the supplied (dataset, version) pair instead of the destination's prior version. When the fields are null, carry-forward rows are read from the destination's prior version.

Request body

application/json
objectDatasetItemBatch_Write
batch_group_idstring · uuid

Optional batch group ID to group multiple batches into a single dataset version. If null, mutates the latest version instead of creating a new one.

copy_from_dataset_idstring · uuid

Optional. Dataset to read carry-forward rows from when materializing the new version. Required together with copy_from_version_id. When null, carry-forward rows are read from the destination dataset's prior version.

copy_from_version_idstring · uuid

Optional. Version within copy_from_dataset_id to read carry-forward rows from. Required together with copy_from_dataset_id.

dataset_idstring · uuid

If null, dataset_name must be provided

dataset_namestring

If null, dataset_id must be provided

pattern (?s)^\s*(\S.*\S|\S)\s*$

itemsarray of objectrequired

maxItems 1000 · minItems 1

Show child attributes

maxItems 1000 · minItems 1

Show array items
dataobjectrequired
descriptionstring

pattern (?s)^\s*(\S.*\S|\S)\s*$

evaluatorsarray of object
Show child attributes
Show array items
configobjectrequired
namestringrequired

minLength 1

typestringrequired

one of "llm_judge", "code_metric"

execution_policyobject
Show child attributes
pass_thresholdinteger · int32

maximum 100 · minimum 1

runs_per_iteminteger · int32

maximum 100 · minimum 1

idstring · uuid

Stable item identifier. On write, used as the upsert key. If omitted, a new ID is generated. Remains the same across dataset versions

sourcestringrequired

one of "manual", "trace", "span", "sdk"

span_idstring · uuid
tagsarray of string

uniqueItems true

Show child attributes

uniqueItems true

trace_idstring · uuid
project_idstring · uuid

Optional. Associates the batch with a project by ID. Takes precedence over project_name.

project_namestring

Optional. Associates the batch with a project by name. Ignored if project_id is provided.

pattern (?s)^\s*(\S.*\S|\S)\s*$

Example request
{
  "batch_group_id": "00000000-0000-0000-0000-000000000000",
  "copy_from_dataset_id": "00000000-0000-0000-0000-000000000000",
  "copy_from_version_id": "00000000-0000-0000-0000-000000000000",
  "dataset_id": "00000000-0000-0000-0000-000000000000",
  "dataset_name": "string",
  "items": [
    {
      "data": {},
      "description": "string",
      "evaluators": [
        {
          "config": {},
          "name": "string",
          "type": "code_metric"
        }
      ],
      "execution_policy": {
        "pass_threshold": 0,
        "runs_per_item": 0
      },
      "id": "00000000-0000-0000-0000-000000000000",
      "source": "manual",
      "span_id": "00000000-0000-0000-0000-000000000000",
      "tags": [
        "string"
      ],
      "trace_id": "00000000-0000-0000-0000-000000000000"
    }
  ],
  "project_id": "00000000-0000-0000-0000-000000000000",
  "project_name": "string"
}

Responses

204No content
Documentation menu