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

# Version Service

> Version Service API methods in the Galtea SDK

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

The Version Service in the Galtea SDK allows you to manage different iterations of your [products](https://docs.galtea.ai/v5.16/concepts/product.md) through [versions](https://docs.galtea.ai/v5.16/concepts/product/version.md).
This Service is exposed by the `galtea.versions` object.

> [!NOTE]
>
> Remember that we will be using the `galtea` object. More information [here](https://docs.galtea.ai/v5.16/sdk/api/galtea.md).

## Quick Example

First, initialize the Galtea SDK:

```python theme={"system"}
galtea = Galtea(api_key="YOUR_API_KEY")
```

Get the version that holds an agent state, or create it:

```python theme={"system"}
nightly_facts = {"model": "gpt-4o-mini", "prompt_version": "12"}

nightly_version = galtea.versions.get_or_create(
    product_id=product_id,
    facts=nightly_facts,
    name="Nightly build " + run_identifier,
    auto_detect_commit_hash=True,
)

# The same facts always answer the same version, so a second job reuses the first one.
same_version = galtea.versions.get_or_create(
    product_id=product_id,
    facts=nightly_facts,
    auto_detect_commit_hash=True,
)
```

Create a version when you need to set other fields, such as a system prompt or an endpoint connection:

```python theme={"system"}
version = galtea.versions.create(
    product_id=product_id,
    description="Demo version created via SDK",
)
```

List versions for a product:

```python theme={"system"}
versions = galtea.versions.list(product_id=product_id, limit=5)
```

Get a version by ID:

```python theme={"system"}
version = galtea.versions.get(version_id=version_id)
```

## Service Methods

* [Get or Create Version](https://docs.galtea.ai/v5.16/sdk/api/version/get-or-create.md)
* [Create Version](https://docs.galtea.ai/v5.16/sdk/api/version/create.md)
* [Listing Versions](https://docs.galtea.ai/v5.16/sdk/api/version/list.md)
* [Retrieving Version](https://docs.galtea.ai/v5.16/sdk/api/version/get.md)
* [Retrieving Version By Name](https://docs.galtea.ai/v5.16/sdk/api/version/get-by-name.md)
* [Updating Version](https://docs.galtea.ai/v5.16/sdk/api/version/update.md)
* [Deleting Version](https://docs.galtea.ai/v5.16/sdk/api/version/delete.md)

## Related

> [card] [Version](https://docs.galtea.ai/v5.16/concepts/product/version.md)
>
> A specific iteration of a product


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