---
title: "Create Trace"
method: POST
path: "/traces/"
tags: ["Traces"]
---

# Create Trace

`POST /traces/`

Create a single trace from the canonical `Trace` shape.

Accepts one trace (`trace_id` plus a nested `spans` tree) and
returns the resulting `trace_id`. The payload is internally
normalized into the same ingest pipeline as
`POST /tracing/spans/ingest`.

Returns `202 Accepted`. The async write contract applies — see
[Tracing — Async write
contract](/reference/api-guide/tracing#async-write-contract-202).

Use this when you want to operate on whole traces in the
list-shaped `Trace` payload. For flat-list ingestion or multiple
traces in one call, use `POST /traces/ingest` (plural).

## 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/revisions/ea6421d829f1/schema)
