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

## Returns

Returns a [Span](/concepts/product/version/session/span) 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

<ResponseField name="trace_id" type="string" required>
  The ID of the trace this span belongs to.
</ResponseField>

<ResponseField name="name" type="string" required>
  The name of the tool or function that was called.
</ResponseField>

<ResponseField name="type" type="string" optional>
  SpanType value: `SPAN`, `GENERATION`, `EVENT`, `AGENT`, `TOOL`, `CHAIN`, `RETRIEVER`, `EVALUATOR`, `EMBEDDING`, `GUARDRAIL`. See [Span Types](/concepts/product/version/session/span#span-types) for details. Other string values are sent to the API unchanged, so values added in newer API versions can be used; the API rejects invalid ones.
</ResponseField>

<ResponseField name="description" type="string" optional>
  Human-readable description of what this operation does. Useful for documentation and debugging. Maximum size: 1MB.
</ResponseField>

<ResponseField name="input_data" type="any" optional>
  The input data passed to the tool/function. Accepts any JSON-serializable value. Maximum size: 10MB.
</ResponseField>

<ResponseField name="output_data" type="any" optional>
  The output data returned by the tool/function. Accepts any JSON-serializable value. Maximum size: 10MB.
</ResponseField>

<ResponseField name="error" type="string" optional>
  Error message if the tool call failed.
</ResponseField>

<ResponseField name="latency_ms" type="float" optional>
  The time in milliseconds the tool call took.
</ResponseField>

<ResponseField name="metadata" type="any" optional>
  Additional metadata about the span. Accepts any JSON-serializable value. Maximum size: 10MB.
</ResponseField>

<ResponseField name="start_time" type="string" optional>
  ISO 8601 timestamp when the span started.
</ResponseField>

<ResponseField name="end_time" type="string" optional>
  ISO 8601 timestamp when the span ended.
</ResponseField>
