# Versions

The Versions API provides centralized access to version history for all versioned AI entities. Rather than per-entity version endpoints, this unified API handles versioning for connections, profiles, contexts, prompts, and agents.

## Endpoints

| Method | Endpoint                                                                                                                                  | Description                               |
| ------ | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
| GET    | [`/umbraco/ai/management/api/v1/versions/supported-types`](/ai-in-umbraco/management-api/versions/supported-types.md)                     | List entity types that support versioning |
| GET    | [`/umbraco/ai/management/api/v1/versions/{entityType}/{entityId}`](/ai-in-umbraco/management-api/versions/history.md)                     | Get version history for an entity         |
| GET    | [`/umbraco/ai/management/api/v1/versions/{entityType}/{entityId}/{version}`](/ai-in-umbraco/management-api/versions/get-version.md)       | Get a specific version snapshot           |
| GET    | [`/umbraco/ai/management/api/v1/versions/{entityType}/{entityId}/{from}/compare/{to}`](/ai-in-umbraco/management-api/versions/compare.md) | Compare two versions                      |
| POST   | [`/umbraco/ai/management/api/v1/versions/{entityType}/{entityId}/{version}/rollback`](/ai-in-umbraco/management-api/versions/rollback.md) | Rollback to a previous version            |

## Base URL

```
/umbraco/ai/management/api/v1
```

## Supported Entity Types

| Entity Type  | Package           | Description                     |
| ------------ | ----------------- | ------------------------------- |
| `connection` | Umbraco.AI        | API connections and credentials |
| `profile`    | Umbraco.AI        | AI profile configurations       |
| `context`    | Umbraco.AI        | Context resources and content   |
| `prompt`     | Umbraco.AI.Prompt | Prompt templates                |
| `agent`      | Umbraco.AI.Agent  | Agent definitions               |

## Version Object

{% code title="Version" %}

```json
{
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "entityType": "profile",
    "version": 3,
    "dateCreated": "2024-01-20T14:45:00Z",
    "createdByUserId": "user-guid",
    "changeDescription": "Updated temperature setting"
}
```

{% endcode %}

## Properties

| Property            | Type     | Description                     |
| ------------------- | -------- | ------------------------------- |
| `id`                | guid     | Version record identifier       |
| `entityId`          | guid     | ID of the versioned entity      |
| `entityType`        | string   | Type discriminator              |
| `version`           | int      | Sequential version number       |
| `dateCreated`       | datetime | When this version was created   |
| `createdByUserId`   | guid     | User who created this version   |
| `changeDescription` | string   | Optional description of changes |

## Version Snapshots

When you request a specific version, the response includes a `snapshot` field containing the complete entity state at that version:

{% code title="Version with Snapshot" %}

```json
{
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "entityType": "profile",
    "version": 3,
    "dateCreated": "2024-01-20T14:45:00Z",
    "snapshot": {
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "alias": "content-assistant",
        "name": "Content Assistant",
        "capability": "Chat",
        "model": {
            "providerId": "openai",
            "modelId": "gpt-4o"
        },
        "settings": {
            "$type": "chat",
            "temperature": 0.7
        }
    }
}
```

{% endcode %}

## Related

* [Version History Concept](/ai-in-umbraco/concepts/versioning.md)
* [Version History Backoffice](/ai-in-umbraco/backoffice/version-history.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.umbraco.com/ai-in-umbraco/management-api/versions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
