---
title: "Edit Trace"
method: PUT
path: "/traces/{trace_id}"
tags: ["Traces"]
---

# Edit Trace

`PUT /traces/{trace_id}`

Replace a trace's spans using the canonical `Trace` shape.

Path `trace_id` must match the `trace_id` inside the payload's
`trace.trace_id`. Mismatches return `400`. The payload must
describe exactly one trace.

Edit re-ingests the spans through the same stream as
`POST /tracing/spans/ingest`. Returns `202 Accepted` once the
spans are queued. The worker reconciles the trace asynchronously.

## Path parameters

- `trace_id` string, required

## Request body

- TraceRequest — Ingest or edit payload for a single canonical `Trace`.
  - `trace` TraceInput
    - `spans` object, nullable
    - `trace_id` string, nullable

## Response `202`

Successful Response

- TraceIdResponse
  - `count` integer — `1` if a `trace_id` was returned, `0` otherwise.
  - `trace_id` string, nullable — 32-char hex UUID identifying the trace that was created or edited.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/agenta-ai/apis/agenta-api.md) · [All operations](https://skmtc.net/agenta-ai/apis/agenta-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/agenta-ai/agenta-api/versions/2e1079696f45/schema)
