---
title: "Ingest traces (OTLP)"
description: "Accepts [OTLP/HTTP](https://opentelemetry.io/docs/specs/otlp/) JSON or protobuf. The span fields accepted by `POST /api/request-logs/` are not valid here. The `Sample two-span trace` example creates a workflow root span and one chat child span. Before rerunning it, replace `traceId` and `spanId` with new 32-hex and 16-hex IDs to create a separate trace."
---

<a id="playground-button:docs/apis/traces/ingest-traces-otlp"></a>

**POST** `https://api.respan.ai/api/v2/traces`

Accepts [OTLP/HTTP](https://opentelemetry.io/docs/specs/otlp/) JSON or protobuf. The span fields accepted by `POST /api/request-logs/` are not valid here. The `Sample two-span trace` example creates a workflow root span and one chat child span. Before rerunning it, replace `traceId` and `spanId` with new 32-hex and 16-hex IDs to create a separate trace.

For SDK setup, see the [Tracing quickstart](/docs/documentation/features/tracing/quickstart) or the [OpenTelemetry integration](/docs/integrations/opentelemetry), which configures the exporter automatically.

## Servers

`https://api.respan.ai` — Respan API Server

<a id="request.auth"></a>

## Authentication

<a id="request.auth.Authorization"></a>

### RespanApiKey

Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer &lt;RESPAN_API_KEY&gt;. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -&gt; Providers or respan_params.credential_override in the request body, not in this authentication field.

HTTP scheme: `bearer`; format: `Respan API key`.


```http
Authorization: Bearer $RESPAN_API_KEY
```


<a id="request"></a>

## Request body

A request body is required.

### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Required body | — |
| <a id="request.body.resourceSpans"></a>`resourceSpans` | `array<object>` | Required in parent | Array of resource spans. Each element represents spans from a single resource (service). |
| `resourceSpans[]` | `object` | Array item | — |
| `resourceSpans[].resource` | `object` | Optional | Resource metadata. Set `service.name` attribute to identify your application. |
| `resourceSpans[].resource.attributes` | `array<object>` | Optional | Key-value attributes identifying the resource. |
| `resourceSpans[].resource.attributes[]` | `object` | Array item | — |
| `resourceSpans[].resource.attributes[].key` | `string` | Optional | Example: `"service.name"` |
| `resourceSpans[].resource.attributes[].value` | `object` | Optional | OTLP typed value. Use `stringValue`, `intValue`, `doubleValue`, `boolValue`, `arrayValue`, or `kvlistValue`.<br />Example: `{"stringValue":"my-service"}` |
| `resourceSpans[].scopeSpans` | `array<object>` | Optional | Array of instrumentation scope spans. |
| `resourceSpans[].scopeSpans[]` | `object` | Array item | — |
| `resourceSpans[].scopeSpans[].scope` | `object` | Optional | Instrumentation scope (library name and version). |
| `resourceSpans[].scopeSpans[].scope.name` | `string` | Optional | Example: `"manual"` |
| `resourceSpans[].scopeSpans[].scope.version` | `string` | Optional | Example: `"1.0.0"` |
| `resourceSpans[].scopeSpans[].spans` | `array<object>` | Optional | Array of span objects. |
| `resourceSpans[].scopeSpans[].spans[]` | `object` | Array item | — |
| `resourceSpans[].scopeSpans[].spans[].traceId` | `string` | Required in parent | Hex-encoded trace ID (32 hex chars).<br />Example: `"0af7651916cd43dd8448eb211c80319c"` |
| `resourceSpans[].scopeSpans[].spans[].spanId` | `string` | Required in parent | Hex-encoded span ID (16 hex chars).<br />Example: `"b7ad6b7169203332"` |
| `resourceSpans[].scopeSpans[].spans[].parentSpanId` | `string` | Optional | Parent span ID. Empty for root spans.<br />Example: `""` |
| `resourceSpans[].scopeSpans[].spans[].name` | `string` | Required in parent | Span operation name.<br />Example: `"my-operation"` |
| `resourceSpans[].scopeSpans[].spans[].startTimeUnixNano` | `string` | Required in parent | Start time as nanoseconds since Unix epoch.<br />Example: `"1700000000000000000"` |
| `resourceSpans[].scopeSpans[].spans[].endTimeUnixNano` | `string` | Required in parent | End time as nanoseconds since Unix epoch.<br />Example: `"1700000001000000000"` |
| `resourceSpans[].scopeSpans[].spans[].status` | `object` | Optional | Span status. |
| `resourceSpans[].scopeSpans[].spans[].status.code` | `integer` | Optional | `1` = OK, `2` = ERROR.<br />Allowed: `1`, `2`<br />Example: `1` |
| `resourceSpans[].scopeSpans[].spans[].status.message` | `string` | Optional | Error description (when code=2).<br />Example: `""` |
| `resourceSpans[].scopeSpans[].spans[].attributes` | `array<object>` | Optional | Span attributes as OTLP key-value pairs. Values use OTLP typed wrappers: `stringValue`, `intValue`, `doubleValue`, `boolValue`, `arrayValue`, or `kvlistValue`.<br /><br />**Trace shape:** use `traceloop.span.kind` (`workflow`, `task`, `tool`, `chat`, etc.) to classify spans, and `traceloop.workflow.name` to make the workflow name searchable. For chat/completion child spans, include `llm.request.type` (`chat` or `completion`) so model, messages, and token fields are promoted.<br /><br />**LLM fields:** `gen_ai.request.model`, `gen_ai.response.model`, `gen_ai.usage.prompt_tokens`, `gen_ai.usage.completion_tokens`, `gen_ai.usage.total_tokens`, `gen_ai.prompt.{N}.role`, `gen_ai.prompt.{N}.content`, `gen_ai.completion.{N}.role`, `gen_ai.completion.{N}.content`.<br /><br />**Respan fields:** `respan.customer_params.customer_identifier`, `respan.customer_params.email`, `respan.customer_params.name`, `respan.threads.thread_identifier`, `respan.trace.trace_group_identifier`, and `respan.metadata.<key>` for custom metadata.<br /><br />All other attributes are stored in metadata and queryable via metadata filters. |
| `resourceSpans[].scopeSpans[].spans[].attributes[]` | `object` | Array item | — |
| `resourceSpans[].scopeSpans[].spans[].attributes[].key` | `string` | Optional | Example: `"gen_ai.request.model"` |
| `resourceSpans[].scopeSpans[].spans[].attributes[].value` | `object` | Optional | Example: `{"stringValue":"gpt-4"}` |
| `resourceSpans[].scopeSpans[].spans[].events` | `array<object>` | Optional | Span events (e.g. exceptions). Each has `name`, `timeUnixNano`, and `attributes`. |
| `resourceSpans[].scopeSpans[].spans[].events[]` | `object` | Array item | — |


<details class="api-schema-source">
<summary>OpenAPI request schema</summary>


```json
{
  "type": "object",
  "required": [
    "resourceSpans"
  ],
  "properties": {
    "resourceSpans": {
      "type": "array",
      "description": "Array of resource spans. Each element represents spans from a single resource (service).",
      "items": {
        "type": "object",
        "properties": {
          "resource": {
            "type": "object",
            "description": "Resource metadata. Set `service.name` attribute to identify your application.",
            "properties": {
              "attributes": {
                "type": "array",
                "description": "Key-value attributes identifying the resource.",
                "items": {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "example": "service.name"
                    },
                    "value": {
                      "type": "object",
                      "description": "OTLP typed value. Use `stringValue`, `intValue`, `doubleValue`, `boolValue`, `arrayValue`, or `kvlistValue`.",
                      "example": {
                        "stringValue": "my-service"
                      }
                    }
                  }
                }
              }
            }
          },
          "scopeSpans": {
            "type": "array",
            "description": "Array of instrumentation scope spans.",
            "items": {
              "type": "object",
              "properties": {
                "scope": {
                  "type": "object",
                  "description": "Instrumentation scope (library name and version).",
                  "properties": {
                    "name": {
                      "type": "string",
                      "example": "manual"
                    },
                    "version": {
                      "type": "string",
                      "example": "1.0.0"
                    }
                  }
                },
                "spans": {
                  "type": "array",
                  "description": "Array of span objects.",
                  "items": {
                    "type": "object",
                    "required": [
                      "traceId",
                      "spanId",
                      "name",
                      "startTimeUnixNano",
                      "endTimeUnixNano"
                    ],
                    "properties": {
                      "traceId": {
                        "type": "string",
                        "description": "Hex-encoded trace ID (32 hex chars).",
                        "example": "0af7651916cd43dd8448eb211c80319c"
                      },
                      "spanId": {
                        "type": "string",
                        "description": "Hex-encoded span ID (16 hex chars).",
                        "example": "b7ad6b7169203332"
                      },
                      "parentSpanId": {
                        "type": "string",
                        "description": "Parent span ID. Empty for root spans.",
                        "example": ""
                      },
                      "name": {
                        "type": "string",
                        "description": "Span operation name.",
                        "example": "my-operation"
                      },
                      "startTimeUnixNano": {
                        "type": "string",
                        "description": "Start time as nanoseconds since Unix epoch.",
                        "example": "1700000000000000000"
                      },
                      "endTimeUnixNano": {
                        "type": "string",
                        "description": "End time as nanoseconds since Unix epoch.",
                        "example": "1700000001000000000"
                      },
                      "status": {
                        "type": "object",
                        "description": "Span status.",
                        "properties": {
                          "code": {
                            "type": "integer",
                            "description": "`1` = OK, `2` = ERROR.",
                            "enum": [
                              1,
                              2
                            ],
                            "example": 1
                          },
                          "message": {
                            "type": "string",
                            "description": "Error description (when code=2).",
                            "example": ""
                          }
                        }
                      },
                      "attributes": {
                        "type": "array",
                        "description": "Span attributes as OTLP key-value pairs. Values use OTLP typed wrappers: `stringValue`, `intValue`, `doubleValue`, `boolValue`, `arrayValue`, or `kvlistValue`.\n\n**Trace shape:** use `traceloop.span.kind` (`workflow`, `task`, `tool`, `chat`, etc.) to classify spans, and `traceloop.workflow.name` to make the workflow name searchable. For chat/completion child spans, include `llm.request.type` (`chat` or `completion`) so model, messages, and token fields are promoted.\n\n**LLM fields:** `gen_ai.request.model`, `gen_ai.response.model`, `gen_ai.usage.prompt_tokens`, `gen_ai.usage.completion_tokens`, `gen_ai.usage.total_tokens`, `gen_ai.prompt.{N}.role`, `gen_ai.prompt.{N}.content`, `gen_ai.completion.{N}.role`, `gen_ai.completion.{N}.content`.\n\n**Respan fields:** `respan.customer_params.customer_identifier`, `respan.customer_params.email`, `respan.customer_params.name`, `respan.threads.thread_identifier`, `respan.trace.trace_group_identifier`, and `respan.metadata.<key>` for custom metadata.\n\nAll other attributes are stored in metadata and queryable via metadata filters.",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "example": "gen_ai.request.model"
                            },
                            "value": {
                              "type": "object",
                              "example": {
                                "stringValue": "gpt-4"
                              }
                            }
                          }
                        }
                      },
                      "events": {
                        "type": "array",
                        "description": "Span events (e.g. exceptions). Each has `name`, `timeUnixNano`, and `attributes`.",
                        "items": {
                          "type": "object"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
```

</details>

##### Sample two-span trace

Creates a visible sample trace: a workflow root span plus a chat child span. Replace traceId/spanId values before rerunning to avoid appending to the same trace.


```json
{
  "resourceSpans": [
    {
      "resource": {
        "attributes": [
          {
            "key": "service.name",
            "value": {
              "stringValue": "respan-docs-api-reference"
            }
          }
        ]
      },
      "scopeSpans": [
        {
          "scope": {
            "name": "manual-api-reference",
            "version": "1.0.0"
          },
          "spans": [
            {
              "traceId": "11111111111111111111111111111111",
              "spanId": "2222222222222222",
              "name": "sample_trace",
              "startTimeUnixNano": "1780000000000000000",
              "endTimeUnixNano": "1780000001000000000",
              "attributes": [
                {
                  "key": "traceloop.span.kind",
                  "value": {
                    "stringValue": "workflow"
                  }
                },
                {
                  "key": "traceloop.workflow.name",
                  "value": {
                    "stringValue": "api-reference-sample-trace"
                  }
                },
                {
                  "key": "respan.trace.trace_group_identifier",
                  "value": {
                    "stringValue": "api-reference-sample-trace"
                  }
                },
                {
                  "key": "respan.customer_params.customer_identifier",
                  "value": {
                    "stringValue": "docs-sample-user"
                  }
                },
                {
                  "key": "respan.metadata.source",
                  "value": {
                    "stringValue": "api-reference-create-trace"
                  }
                }
              ],
              "status": {
                "code": 1
              }
            },
            {
              "traceId": "11111111111111111111111111111111",
              "spanId": "3333333333333333",
              "parentSpanId": "2222222222222222",
              "name": "sample_llm_call",
              "startTimeUnixNano": "1780000000100000000",
              "endTimeUnixNano": "1780000000900000000",
              "attributes": [
                {
                  "key": "traceloop.span.kind",
                  "value": {
                    "stringValue": "chat"
                  }
                },
                {
                  "key": "llm.request.type",
                  "value": {
                    "stringValue": "chat"
                  }
                },
                {
                  "key": "traceloop.workflow.name",
                  "value": {
                    "stringValue": "api-reference-sample-trace"
                  }
                },
                {
                  "key": "respan.trace.trace_group_identifier",
                  "value": {
                    "stringValue": "api-reference-sample-trace"
                  }
                },
                {
                  "key": "respan.customer_params.customer_identifier",
                  "value": {
                    "stringValue": "docs-sample-user"
                  }
                },
                {
                  "key": "gen_ai.system",
                  "value": {
                    "stringValue": "openai"
                  }
                },
                {
                  "key": "gen_ai.request.model",
                  "value": {
                    "stringValue": "gpt-4o-mini"
                  }
                },
                {
                  "key": "gen_ai.response.model",
                  "value": {
                    "stringValue": "gpt-4o-mini"
                  }
                },
                {
                  "key": "gen_ai.prompt.0.role",
                  "value": {
                    "stringValue": "user"
                  }
                },
                {
                  "key": "gen_ai.prompt.0.content",
                  "value": {
                    "stringValue": "Hello from the Create a trace API reference."
                  }
                },
                {
                  "key": "gen_ai.completion.0.role",
                  "value": {
                    "stringValue": "assistant"
                  }
                },
                {
                  "key": "gen_ai.completion.0.content",
                  "value": {
                    "stringValue": "Hello! This is a sample trace."
                  }
                },
                {
                  "key": "gen_ai.usage.prompt_tokens",
                  "value": {
                    "intValue": "9"
                  }
                },
                {
                  "key": "gen_ai.usage.completion_tokens",
                  "value": {
                    "intValue": "8"
                  }
                },
                {
                  "key": "gen_ai.usage.total_tokens",
                  "value": {
                    "intValue": "17"
                  }
                }
              ],
              "status": {
                "code": 1
              }
            }
          ]
        }
      ]
    }
  ]
}
```


<a id="response"></a>

## Responses

### 200

Spans accepted.

#### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Body | — |
| <a id="response.body.partialSuccess"></a>`partialSuccess` | `object` | Optional | — |
| `partialSuccess.rejectedSpans` | `integer` | Optional | Number of spans that failed to ingest.<br />Example: `0` |
| `partialSuccess.errorMessage` | `string` | Optional | Error description (empty on success).<br />Example: `""` |


<details class="api-schema-source">
<summary>OpenAPI response schema</summary>


```json
{
  "type": "object",
  "properties": {
    "partialSuccess": {
      "type": "object",
      "properties": {
        "rejectedSpans": {
          "type": "integer",
          "description": "Number of spans that failed to ingest.",
          "example": 0
        },
        "errorMessage": {
          "type": "string",
          "description": "Error description (empty on success).",
          "example": ""
        }
      }
    }
  }
}
```

</details>

##### Example


```json
{
  "partialSuccess": {
    "rejectedSpans": 0,
    "errorMessage": ""
  }
}
```


<a id="response.error"></a>

### 400

The payload isn't valid OTLP JSON.

#### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Body | — |
| `detail` | `string` | Required in parent | — |


<details class="api-schema-source">
<summary>OpenAPI response schema</summary>


```json
{
  "type": "object",
  "required": [
    "detail"
  ],
  "properties": {
    "detail": {
      "type": "string"
    }
  }
}
```

</details>

##### Example


```json
{
  "detail": "Invalid JSON in OTLP trace payload: Expecting value: line 1 column 20 (char 19)"
}
```


### 403

The API key is missing, invalid or expired.

#### application/json


| Field | Type | Requirement | Description and constraints |
| --- | --- | --- | --- |
| `$` | `object` | Body | — |
| `detail` | `string` | Required in parent | — |


<details class="api-schema-source">
<summary>OpenAPI response schema</summary>


```json
{
  "type": "object",
  "required": [
    "detail"
  ],
  "properties": {
    "detail": {
      "type": "string"
    }
  }
}
```

</details>

##### Example


```json
{
  "detail": "Your API key is invalid or expired, please check your API key in the platform settings."
}
```


## OpenAPI source

The operation and referenced components below retain the complete OpenAPI definitions, including constraints and examples.

<!-- openapi-operation:start -->
<details class="api-schema-source">
<summary>OpenAPI operation</summary>


```json
{
  "summary": "Ingest traces (OTLP)",
  "operationId": "createTrace",
  "tags": [
    "Traces"
  ],
  "description": "Accepts [OTLP/HTTP](https://opentelemetry.io/docs/specs/otlp/) JSON or protobuf. The span fields accepted by `POST /api/request-logs/` are not valid here. The `Sample two-span trace` example creates a workflow root span and one chat child span. Before rerunning it, replace `traceId` and `spanId` with new 32-hex and 16-hex IDs to create a separate trace.\n\nFor SDK setup, see the [Tracing quickstart](/docs/documentation/features/tracing/quickstart) or the [OpenTelemetry integration](/docs/integrations/opentelemetry), which configures the exporter automatically.",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "resourceSpans"
          ],
          "properties": {
            "resourceSpans": {
              "type": "array",
              "description": "Array of resource spans. Each element represents spans from a single resource (service).",
              "items": {
                "type": "object",
                "properties": {
                  "resource": {
                    "type": "object",
                    "description": "Resource metadata. Set `service.name` attribute to identify your application.",
                    "properties": {
                      "attributes": {
                        "type": "array",
                        "description": "Key-value attributes identifying the resource.",
                        "items": {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "example": "service.name"
                            },
                            "value": {
                              "type": "object",
                              "description": "OTLP typed value. Use `stringValue`, `intValue`, `doubleValue`, `boolValue`, `arrayValue`, or `kvlistValue`.",
                              "example": {
                                "stringValue": "my-service"
                              }
                            }
                          }
                        }
                      }
                    }
                  },
                  "scopeSpans": {
                    "type": "array",
                    "description": "Array of instrumentation scope spans.",
                    "items": {
                      "type": "object",
                      "properties": {
                        "scope": {
                          "type": "object",
                          "description": "Instrumentation scope (library name and version).",
                          "properties": {
                            "name": {
                              "type": "string",
                              "example": "manual"
                            },
                            "version": {
                              "type": "string",
                              "example": "1.0.0"
                            }
                          }
                        },
                        "spans": {
                          "type": "array",
                          "description": "Array of span objects.",
                          "items": {
                            "type": "object",
                            "required": [
                              "traceId",
                              "spanId",
                              "name",
                              "startTimeUnixNano",
                              "endTimeUnixNano"
                            ],
                            "properties": {
                              "traceId": {
                                "type": "string",
                                "description": "Hex-encoded trace ID (32 hex chars).",
                                "example": "0af7651916cd43dd8448eb211c80319c"
                              },
                              "spanId": {
                                "type": "string",
                                "description": "Hex-encoded span ID (16 hex chars).",
                                "example": "b7ad6b7169203332"
                              },
                              "parentSpanId": {
                                "type": "string",
                                "description": "Parent span ID. Empty for root spans.",
                                "example": ""
                              },
                              "name": {
                                "type": "string",
                                "description": "Span operation name.",
                                "example": "my-operation"
                              },
                              "startTimeUnixNano": {
                                "type": "string",
                                "description": "Start time as nanoseconds since Unix epoch.",
                                "example": "1700000000000000000"
                              },
                              "endTimeUnixNano": {
                                "type": "string",
                                "description": "End time as nanoseconds since Unix epoch.",
                                "example": "1700000001000000000"
                              },
                              "status": {
                                "type": "object",
                                "description": "Span status.",
                                "properties": {
                                  "code": {
                                    "type": "integer",
                                    "description": "`1` = OK, `2` = ERROR.",
                                    "enum": [
                                      1,
                                      2
                                    ],
                                    "example": 1
                                  },
                                  "message": {
                                    "type": "string",
                                    "description": "Error description (when code=2).",
                                    "example": ""
                                  }
                                }
                              },
                              "attributes": {
                                "type": "array",
                                "description": "Span attributes as OTLP key-value pairs. Values use OTLP typed wrappers: `stringValue`, `intValue`, `doubleValue`, `boolValue`, `arrayValue`, or `kvlistValue`.\n\n**Trace shape:** use `traceloop.span.kind` (`workflow`, `task`, `tool`, `chat`, etc.) to classify spans, and `traceloop.workflow.name` to make the workflow name searchable. For chat/completion child spans, include `llm.request.type` (`chat` or `completion`) so model, messages, and token fields are promoted.\n\n**LLM fields:** `gen_ai.request.model`, `gen_ai.response.model`, `gen_ai.usage.prompt_tokens`, `gen_ai.usage.completion_tokens`, `gen_ai.usage.total_tokens`, `gen_ai.prompt.{N}.role`, `gen_ai.prompt.{N}.content`, `gen_ai.completion.{N}.role`, `gen_ai.completion.{N}.content`.\n\n**Respan fields:** `respan.customer_params.customer_identifier`, `respan.customer_params.email`, `respan.customer_params.name`, `respan.threads.thread_identifier`, `respan.trace.trace_group_identifier`, and `respan.metadata.<key>` for custom metadata.\n\nAll other attributes are stored in metadata and queryable via metadata filters.",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "key": {
                                      "type": "string",
                                      "example": "gen_ai.request.model"
                                    },
                                    "value": {
                                      "type": "object",
                                      "example": {
                                        "stringValue": "gpt-4"
                                      }
                                    }
                                  }
                                }
                              },
                              "events": {
                                "type": "array",
                                "description": "Span events (e.g. exceptions). Each has `name`, `timeUnixNano`, and `attributes`.",
                                "items": {
                                  "type": "object"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "examples": {
          "sampleTwoSpanTrace": {
            "summary": "Sample two-span trace",
            "description": "Creates a visible sample trace: a workflow root span plus a chat child span. Replace traceId/spanId values before rerunning to avoid appending to the same trace.",
            "value": {
              "resourceSpans": [
                {
                  "resource": {
                    "attributes": [
                      {
                        "key": "service.name",
                        "value": {
                          "stringValue": "respan-docs-api-reference"
                        }
                      }
                    ]
                  },
                  "scopeSpans": [
                    {
                      "scope": {
                        "name": "manual-api-reference",
                        "version": "1.0.0"
                      },
                      "spans": [
                        {
                          "traceId": "11111111111111111111111111111111",
                          "spanId": "2222222222222222",
                          "name": "sample_trace",
                          "startTimeUnixNano": "1780000000000000000",
                          "endTimeUnixNano": "1780000001000000000",
                          "attributes": [
                            {
                              "key": "traceloop.span.kind",
                              "value": {
                                "stringValue": "workflow"
                              }
                            },
                            {
                              "key": "traceloop.workflow.name",
                              "value": {
                                "stringValue": "api-reference-sample-trace"
                              }
                            },
                            {
                              "key": "respan.trace.trace_group_identifier",
                              "value": {
                                "stringValue": "api-reference-sample-trace"
                              }
                            },
                            {
                              "key": "respan.customer_params.customer_identifier",
                              "value": {
                                "stringValue": "docs-sample-user"
                              }
                            },
                            {
                              "key": "respan.metadata.source",
                              "value": {
                                "stringValue": "api-reference-create-trace"
                              }
                            }
                          ],
                          "status": {
                            "code": 1
                          }
                        },
                        {
                          "traceId": "11111111111111111111111111111111",
                          "spanId": "3333333333333333",
                          "parentSpanId": "2222222222222222",
                          "name": "sample_llm_call",
                          "startTimeUnixNano": "1780000000100000000",
                          "endTimeUnixNano": "1780000000900000000",
                          "attributes": [
                            {
                              "key": "traceloop.span.kind",
                              "value": {
                                "stringValue": "chat"
                              }
                            },
                            {
                              "key": "llm.request.type",
                              "value": {
                                "stringValue": "chat"
                              }
                            },
                            {
                              "key": "traceloop.workflow.name",
                              "value": {
                                "stringValue": "api-reference-sample-trace"
                              }
                            },
                            {
                              "key": "respan.trace.trace_group_identifier",
                              "value": {
                                "stringValue": "api-reference-sample-trace"
                              }
                            },
                            {
                              "key": "respan.customer_params.customer_identifier",
                              "value": {
                                "stringValue": "docs-sample-user"
                              }
                            },
                            {
                              "key": "gen_ai.system",
                              "value": {
                                "stringValue": "openai"
                              }
                            },
                            {
                              "key": "gen_ai.request.model",
                              "value": {
                                "stringValue": "gpt-4o-mini"
                              }
                            },
                            {
                              "key": "gen_ai.response.model",
                              "value": {
                                "stringValue": "gpt-4o-mini"
                              }
                            },
                            {
                              "key": "gen_ai.prompt.0.role",
                              "value": {
                                "stringValue": "user"
                              }
                            },
                            {
                              "key": "gen_ai.prompt.0.content",
                              "value": {
                                "stringValue": "Hello from the Create a trace API reference."
                              }
                            },
                            {
                              "key": "gen_ai.completion.0.role",
                              "value": {
                                "stringValue": "assistant"
                              }
                            },
                            {
                              "key": "gen_ai.completion.0.content",
                              "value": {
                                "stringValue": "Hello! This is a sample trace."
                              }
                            },
                            {
                              "key": "gen_ai.usage.prompt_tokens",
                              "value": {
                                "intValue": "9"
                              }
                            },
                            {
                              "key": "gen_ai.usage.completion_tokens",
                              "value": {
                                "intValue": "8"
                              }
                            },
                            {
                              "key": "gen_ai.usage.total_tokens",
                              "value": {
                                "intValue": "17"
                              }
                            }
                          ],
                          "status": {
                            "code": 1
                          }
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Spans accepted.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "partialSuccess": {
                "type": "object",
                "properties": {
                  "rejectedSpans": {
                    "type": "integer",
                    "description": "Number of spans that failed to ingest.",
                    "example": 0
                  },
                  "errorMessage": {
                    "type": "string",
                    "description": "Error description (empty on success).",
                    "example": ""
                  }
                }
              }
            }
          },
          "example": {
            "partialSuccess": {
              "rejectedSpans": 0,
              "errorMessage": ""
            }
          }
        }
      }
    },
    "400": {
      "description": "The payload isn't valid OTLP JSON.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "detail"
            ],
            "properties": {
              "detail": {
                "type": "string"
              }
            }
          },
          "example": {
            "detail": "Invalid JSON in OTLP trace payload: Expecting value: line 1 column 20 (char 19)"
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/InvalidApiKey"
    }
  },
  "security": [
    {
      "RespanApiKey": []
    }
  ]
}
```

</details>
<!-- openapi-operation:end -->

<!-- openapi-path-item:start -->
<details class="api-schema-source">
<summary>OpenAPI path metadata</summary>


```json
{}
```

</details>
<!-- openapi-path-item:end -->

<!-- openapi-components:start -->
<details class="api-schema-source">
<summary>Referenced OpenAPI components</summary>


```json
{
  "responses": {
    "InvalidApiKey": {
      "description": "The API key is missing, invalid or expired.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "detail"
            ],
            "properties": {
              "detail": {
                "type": "string"
              }
            }
          },
          "example": {
            "detail": "Your API key is invalid or expired, please check your API key in the platform settings."
          }
        }
      }
    }
  },
  "securitySchemes": {
    "RespanApiKey": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "Respan API key",
      "description": "Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.",
      "x-fern-bearer": {
        "name": "respanApiKey",
        "env": "RESPAN_API_KEY"
      }
    }
  }
}
```

</details>
<!-- openapi-components:end -->
