---
title: "Create Trace"
method: POST
path: "/preview/tracing/traces/"
tags: ["Deprecated"]
---

# Create Trace

`POST /preview/tracing/traces/`

## Query parameters

- `sync` boolean

## Request body

- OTelTracingRequest
  - `spans` OTelFlatSpanInput[], nullable
    - `created_at` string, date-time, nullable
    - `updated_at` string, date-time, nullable
    - `deleted_at` string, date-time, nullable
    - `created_by_id` string, uuid, nullable
    - `updated_by_id` string, uuid, nullable
    - `deleted_by_id` string, uuid, nullable
    - `trace_id` string, required
    - `span_id` string, required
    - `parent_id` string, nullable
    - `trace_type` 'invocation' | 'annotation' | 'unknown'
    - `span_type` 'agent' | 'chain' | 'workflow' | 'task' | 'tool' | 'embedding' | 'query' | 'llm' | 'completion' | 'chat' | 'rerank' | 'unknown'
    - `span_kind` 'SPAN_KIND_UNSPECIFIED' | 'SPAN_KIND_INTERNAL' | 'SPAN_KIND_SERVER' | 'SPAN_KIND_CLIENT' | 'SPAN_KIND_PRODUCER' | 'SPAN_KIND_CONSUMER'
    - `span_name` string, nullable
    - `start_time` union
      - string, date-time
      - integer
    - `end_time` union
      - string, date-time
      - integer
    - `status_code` 'STATUS_CODE_UNSET' | 'STATUS_CODE_OK' | 'STATUS_CODE_ERROR'
    - `status_message` string, nullable
    - `attributes` object, nullable
    - `references` OTelReferenceInput[], nullable
      - `version` string, nullable
      - `slug` string, nullable
      - `id` string, uuid, nullable
      - `attributes` object, nullable
    - `links` OTelLinkInput[], nullable
      - `span_id` string, required
      - `trace_id` string, required
      - `attributes` object, nullable
    - `hashes` OTelHashInput[], nullable
      - `id` string, uuid, nullable
      - `attributes` object, nullable
    - `exception` object, nullable
    - `events` OTelEventInput[], nullable
      - `name` string, required
      - `timestamp` union, required
        - string, date-time
        - integer
      - `attributes` object, nullable
  - `traces` object, nullable

## Response `202`

Successful Response

- OTelLinksResponse
  - `count` integer
  - `links` OTelLinkOutput[], nullable
    - `span_id` string, required
    - `trace_id` string, required
    - `attributes` object, nullable

## Other responses

- `422` — Validation Error

## Changes

- **2026-01-14** `53da4c9de2b7` — 3 breaking, 6 info
  - removed `#/components/schemas/OTelStatusCode-Input` from the `spans/anyOf[subschema #1]/items/status_code` request property `anyOf` list
  - removed `#/components/schemas/OTelStatusCode-Input` from the `traces/anyOf[subschema #1]/additionalProperties/spans/anyOf[subschema #1]/additionalProperties/anyOf[subschema #1: OTelSpan]/status_code` request property `anyOf` list
  - removed `#/components/schemas/OTelStatusCode-Input` from the `traces/anyOf[subschema #1]/additionalProperties/spans/anyOf[subschema #1]/additionalProperties/anyOf[subschema #2]/items/status_code` request property `anyOf` list
  - api tag `Deprecated` added
  - …5 more
- **2025-11-05** `e62506c24377` — 2 breaking, 17 info
  - the response property `count` became optional for the status `202`
  - removed the required property `version` from the response with the `202` status
  - api operation id `add_trace` removed and replaced with `create_trace`
  - added the new optional request property `spans/anyOf[subschema #1]/items/exception`
  - …15 more
- **2025-06-27** `e3e84db47198` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/agenta-ai/apis/agenta-api/changes/preview/tracing/traces/post.md)

---

[API](https://skmtc.dev/agenta-ai/apis/agenta-api.md) · [All operations](https://skmtc.dev/agenta-ai/apis/agenta-api/llms.txt) · [OpenAPI document](https://skmtc.dev/agenta-ai/apis/agenta-api/revisions/53da4c9de2b7?raw)
