Skip to main content
POST
Create multiple observability spans in one request, optionally creating a request log alongside each span. Use this endpoint when ingesting telemetry data that is not already sent through OTLP.

Behavior Notes

  • When log_request is provided, the created request log is associated with the span by span_id.
  • If request_start_time or request_end_time is omitted from log_request, PromptLayer inherits the value from the parent span.
  • If a referenced prompt is not found, the span is still created but the request log creation for that span is skipped.
  • Bulk span creation is atomic; if any span creation fails, the entire batch is rolled back.

Authorizations

X-API-KEY
string
header
required

Body

application/json

Create multiple observability spans in a single request. Each span may include log_request to create an associated request log.

spans
Span · object[]
required
close_after
boolean
default:false

When true, all trace IDs in this batch are marked as closed after the spans are persisted. Subsequent span writes for those traces will be rejected with a trace_closed rejection reason. Defaults to false.

Response

Successful Response

success
boolean
required
spans
Spans · object[]
required
request_logs
Request Logs · object[] | null
rejected_span_ids
string[] | null

Span IDs that were dropped because they belong to a closed trace. Only present when one or more spans were rejected.

rejected_trace_ids
string[] | null

Trace IDs that were closed and caused span rejections. Only present when one or more spans were rejected.

rejection_reason
enum<string> | null

The reason spans were rejected. Currently only trace_closed is possible. Only present when one or more spans were rejected.

Available options:
trace_closed