> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galtea.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Span Batch

> Create multiple spans in a single API call.

## Returns

Returns a list of [Span](/concepts/product/version/session/span) objects.

## Example

```python theme={"system"}
galtea.spans.create_batch(
    [
        SpanBase(
            trace_id=trace_id,
            name="batch_span_1",
            type=SpanType.SPAN,
        )
    ]
)
```

## Parameters

<ResponseField name="spans" type="list[SpanBase]" required>
  List of span objects to create. Each span should include `trace_id`, `name`, and optionally other fields.
</ResponseField>

## SpanBase Fields

| Field             | Type       | Required | Description                                                                                                                                                        |
| ----------------- | ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `trace_id`        | `str`      | Yes      | ID of the trace this span belongs to                                                                                                                               |
| `name`            | `str`      | Yes      | Name of the traced operation                                                                                                                                       |
| `id`              | `str`      | No       | Client-generated ID (auto-generated if not provided)                                                                                                               |
| `type`            | `SpanType` | No       | Type: SPAN, GENERATION, EVENT, AGENT, TOOL, CHAIN, RETRIEVER, EVALUATOR, EMBEDDING, GUARDRAIL. See [Span Types](/concepts/product/version/session/span#span-types) |
| `parent_trace_id` | `str`      | No       | ID of parent span                                                                                                                                                  |
| `input_data`      | `dict`     | No       | Input parameters                                                                                                                                                   |
| `output_data`     | `dict`     | No       | Output result                                                                                                                                                      |
| `error`           | `str`      | No       | Error message if failed                                                                                                                                            |
| `latency_ms`      | `float`    | No       | Execution time in milliseconds                                                                                                                                     |
| `start_time`      | `str`      | No       | ISO 8601 timestamp when the span started                                                                                                                           |
| `end_time`        | `str`      | No       | ISO 8601 timestamp when the span ended                                                                                                                             |
| `metadata`        | `dict`     | No       | Additional custom metadata                                                                                                                                         |

<Note>
  For `type`, other string values are sent to the API unchanged, so values added in newer API versions can be used; the API rejects invalid ones.
</Note>
