---
title: "Create spans"
method: POST
path: "/v1/private/spans/batch"
tags: ["Spans"]
---

# Create spans

`POST /v1/private/spans/batch`

Create spans

## Request body

- SpanBatchWrite
  - `spans` SpanWrite[], required
    - `id` string, uuid
    - `project_name` string — If null, the default project is used
    - `trace_id` string, uuid
    - `parent_span_id` string, uuid
    - `name` string
    - `type` 'general' | 'tool' | 'llm' | 'guardrail'
    - `start_time` string, date-time, required
    - `end_time` string, date-time
    - `input` JsonListStringWrite
    - `output` JsonListStringWrite
    - `metadata` JsonListStringWrite
    - `model` string
    - `provider` string
    - `tags` string[]
    - `usage` object
    - `error_info` ErrorInfoWrite
      - `exception_type` string, required
      - `message` string
      - `traceback` string, required
    - `last_updated_at` string, date-time
    - `total_estimated_cost` number
    - `total_estimated_cost_version` string
    - `ttft` number, double — Time to first token in milliseconds
    - `source` 'sdk' | 'experiment' | 'playground' | 'optimization' | 'evaluator'
    - `environment` string

## 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)
