> ## 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

> Create a single span directly via the API.

> [!WARNING]
>
> You are reading the docs of Galtea 5.12. [Read this page in the latest version](https://docs.galtea.ai/sdk/api/span/create.md).

## Returns

Returns a [Span](https://docs.galtea.ai/v5.12/concepts/product/version/session/span.md) object.

## Example

```python theme={"system"}
manual_span = galtea.spans.create(
    trace_id=trace_id,
    name="manual_db_call",
    type=SpanType.TOOL,
    start_time="2023-01-01T12:00:00Z",
    end_time="2023-01-01T12:00:01Z",
)
```

## Parameters

**trace\_id** `string` *required*

The ID of the trace this span belongs to.

**name** `string` *required*

The name of the tool or function that was called.

**type** `string`

SpanType value: `SPAN`, `GENERATION`, `EVENT`, `AGENT`, `TOOL`, `CHAIN`, `RETRIEVER`, `EVALUATOR`, `EMBEDDING`, `GUARDRAIL`. See [Span Types](https://docs.galtea.ai/v5.12/concepts/product/version/session/span.md#span-types) for details. Other string values are sent to the API unchanged. The API never drops a span for an unrecognized type. It normalizes the value to a known span type and keeps your original label in the span's `metadata`, under the key `galtea.span.original_type`.

**description** `string`

Human-readable description of what this operation does. Useful for documentation and debugging. Maximum size: 1MB.

**input\_data** `any`

The input data passed to the tool/function. Accepts any JSON-serializable value. Maximum size: 10MB.

**output\_data** `any`

The output data returned by the tool/function. Accepts any JSON-serializable value. Maximum size: 10MB.

**error** `string`

Error message if the tool call failed.

**latency\_ms** `float`

The time in milliseconds the tool call took.

**metadata** `any`

Additional metadata about the span. Accepts any JSON-serializable value. Maximum size: 10MB.

**start\_time** `string`

ISO 8601 timestamp when the span started.

**end\_time** `string`

ISO 8601 timestamp when the span ended.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.