Create spans batch
Create multiple spans in a single API call (transactional). See Spans. These endpoints serve spans, the steps inside a trace. Their REST path /traces keeps the old name of this entity.
Authorizations
API key authorization. Pass your API key in the Authorization header as a Bearer token. Both new (gsk_*) and legacy (gsk-) API keys are accepted, e.g. Authorization: Bearer gsk_... or Authorization: Bearer gsk-....
Body
ID of the trace this span belongs to
"ir_123"
Name of the span
Optional custom span ID
"id_123"
Optional description of the span
"Example Name"
Type of span
SPAN, GENERATION, EVENT, AGENT, TOOL, CHAIN, RETRIEVER, EVALUATOR, EMBEDDING, GUARDRAIL Input data for the span
Output data from the span (an object, or a plain string)
Error message if the span failed
"Error message"
Duration in milliseconds
Additional span attributes
Parent span ID for hierarchical spans (references id of another span in batch)
Start time of the span
End time of the span
Response
Spans created successfully
"trace_123"
"ir_123"
"fetch_user_data"
SPAN, GENERATION, EVENT, AGENT, TOOL, CHAIN, RETRIEVER, EVALUATOR, EMBEDDING, GUARDRAIL "TOOL"
Human-readable description of the operation. Maximum 1MB.
"Fetches user data from the database by ID"
Input parameters passed to the operation
Result returned by the operation. Usually an object; a plain string for retrieval-context spans
Error message if failed
"Connection timeout"
Execution time in milliseconds
45.5
Additional custom metadata
ID of parent span for hierarchical relationships
"trace_parent_123"