---
title: "Batch update spans"
method: PATCH
path: "/v1/private/spans/batch"
tags: ["Spans"]
---

# Batch update spans

`PATCH /v1/private/spans/batch`

Update multiple spans

## Request body

- SpanBatchUpdate — Request to batch update multiple spans
  - `ids` string[], required — List of span IDs to update (max 1000)
  - `update` SpanUpdate, required
    - `project_name` string — If null and project_id not specified, Default Project is assumed
    - `project_id` string, uuid — If null and project_name not specified, Default Project is assumed
    - `trace_id` string, uuid, required
    - `parent_span_id` string, uuid
    - `name` string
    - `type` 'general' | 'tool' | 'llm' | 'guardrail'
    - `end_time` string, date-time
    - `input` JsonListString
    - `output` JsonListString
    - `metadata` JsonListString
    - `model` string
    - `provider` string
    - `tags` string[] — Tags
    - `tags_to_add` string[] — Tags to add
    - `tags_to_remove` string[] — Tags to remove
    - `usage` object
    - `total_estimated_cost` number
    - `error_info` ErrorInfo
      - `exception_type` string, required
      - `message` string
      - `traceback` string, required
    - `ttft` number, double
    - `source` 'sdk' | 'experiment' | 'playground' | 'optimization' | 'evaluator'
    - `environment` string
  - `merge_tags` boolean — If true, merge tags with existing tags instead of replacing them. Default: false

## Response `204`

No Content

## Other responses

- `400` — Bad Request

## Changes

- **2026-07-02** `3144ea40dac0` — 1 info
  - added the new `evaluator` enum value to the request property `update/source`
- **2026-05-08** `b9100cf75dd3` — 1 info
  - added the new optional request property `update/environment`
- **2026-05-04** `d606e84c75e4` — 1 breaking, 1 warning
  - removed the enum value `evaluator` of the request property `update/source`
  - removed the request property `update/environment`

[Change history](https://skmtc.dev/comet-ml/apis/opik-rest-api/changes/v1/private/spans/batch/patch.md)

---

[API](https://skmtc.dev/comet-ml/apis/opik-rest-api.md) · [All operations](https://skmtc.dev/comet-ml/apis/opik-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/comet-ml/opik-rest-api/revisions/1a1bcfd67f99/schema)
