---
title: "Create dataset items from spans"
method: POST
path: "/v1/private/datasets/{dataset_id}/items/from-spans"
tags: ["Datasets"]
---

# Create dataset items from spans

`POST /v1/private/datasets/{dataset_id}/items/from-spans`

Create dataset items from spans with enriched metadata

## Path parameters

- `dataset_id` string, uuid, required

## Request body

- CreateDatasetItemsFromSpansRequest
  - `span_ids` string[], required — Set of span IDs to add to the dataset
  - `enrichment_options` SpanEnrichmentOptions, required — Options for enriching span data
    - `includeTags` boolean
    - `includeFeedbackScores` boolean
    - `includeComments` boolean
    - `includeUsage` boolean
    - `includeMetadata` boolean
  - `evaluators` EvaluatorItem[] — Optional evaluators to apply to the created items
    - `name` string, required
    - `type` 'llm_judge' | 'code_metric', required
    - `config` JsonNode, required
  - `execution_policy` ExecutionPolicy
    - `runs_per_item` integer
    - `pass_threshold` integer

## Response `204`

No content

---

[API](https://skmtc.net/comet-ml/apis/opik-rest-api.md) · [All operations](https://skmtc.net/comet-ml/apis/opik-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/comet-ml/opik-rest-api/versions/4ed2fbc97cc3/schema)
