---
title: "Create Span"
method: POST
path: "/spans"
tags: ["spans"]
---

# Create Span

`POST /spans`

Create a new span

## Request body

- CreateSpanRequest
  - `name` string, required — The name of the span, something descriptive about the span that will be used to identify it when querying
  - `start_time` string, date-time, nullable — The start time of the span in UTC
  - `id` string, uuid, nullable — The id of the span
  - `trace_id` string, uuid, nullable — The id of the trace
  - `parent_id` string, uuid, nullable — The id of the parent span
  - `type` string, nullable — The type of the span
  - `end_time` string, date-time, nullable — The end time of the span in UTC
  - `input` string, nullable — The input of the span
  - `output` string, nullable — The output of the span
  - `error` string, nullable — In case of an error, the error message
  - `meta` object, nullable — The metadata of the span
  - `score` integer, nullable — The score of the span

## Response `200`

Successful Response

- CreateSpanResponse
  - `name` string, required — The name of the span, something descriptive about the span that will be used to identify it when querying
  - `start_time` string, date-time, nullable — The start time of the span in UTC
  - `id` string, uuid, required
  - `trace_id` string, uuid, nullable — The id of the trace
  - `parent_id` string, uuid, nullable — The id of the parent span
  - `type` string, nullable — The type of the span
  - `end_time` string, date-time, nullable — The end time of the span in UTC
  - `input` string, nullable — The input of the span
  - `output` string, nullable — The output of the span
  - `error` string, nullable — In case of an error, the error message
  - `meta` object, nullable — The metadata of the span
  - `score` integer, nullable — The score of the span

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `402` — Payment Required (out of credits)
- `404` — Not Found
- `422` — Request Validation Error

---

[API](https://skmtc.dev/opper/apis/opper-api-v2.md) · [All operations](https://skmtc.dev/opper/apis/opper-api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/opper/opper-api-v2/revisions/d3ccdaa15678/schema)
