---
title: "Agent Versions"
description: "REST endpoints for agent versions. Bearer-auth required."
section: "API"
group: "REST"
order: 12
---

## GET /api/agent-versions

List agent versions.

**Query parameters**

- `limit` (optional): Page size (1–100, default 100).
- `after` (optional): Keyset cursor — return the page after this row (next page).
- `before` (optional): Keyset cursor — return the page before this row (prev page).
- `ids` (optional): Comma-separated list of IDs. Narrows results to these IDs within the caller's accessible scope (does not bypass access checks).
- `filter` (optional): Nested filter expression (`<Entity>Filter`): AND/OR/NOT + per-field comparison operators + relation traversal. JSON-encoded on the query string.
- `orderBy` (optional): Multi-key sort (`<Entity>OrderBy[]`): array of `{ field: direction }` applied in order. Directions: asc/desc plus the four explicit nulls variants. JSON-encoded on the query string.
- `agent_id` (optional): Optional agent narrower. Admins see every version when omitted; non-admin callers must scope by agent.
- `parent_id` (optional): Shorthand: filter where `parentId` equals this value.
- `input_schema_id` (optional): Shorthand: filter where `inputSchemaId` equals this value.
- `output_schema_id` (optional): Shorthand: filter where `outputSchemaId` equals this value.

**Response**

```json
{
  "data": [
    {
      "id": "<...>",
      "agentId": "<...>",
      "name": "<...>",
      "parentId": "<...>",
      "instructions": "<...>",
      "models?": "<...>",
      "inputSchemaId": "<...>",
      "outputSchemaId": "<...>",
      "createdAt": "<...>",
      "updatedAt": "<...>"
    }
  ],
  "pageInfo": {
    "total": "number",
    "hasNextPage": "boolean",
    "hasPreviousPage": "boolean",
    "startCursor": "string",
    "endCursor": "string"
  }
}
```

## POST /api/agent-versions

Create new agent version

`agentId` lives in the body — create a version of that agent.

**Request body**

```json
{
  "name?": "string",
  "instructions?": "string",
  "models?": ["string"],
  "inputSchemaId?": "string",
  "outputSchemaId?": "string",
  "agentId": "string"
}
```

**Response**

```json
{
  "id": "string",
  "agentId": "string",
  "name": "string",
  "parentId": "string",
  "instructions": "string",
  "models?": [
    "anthropic/claude-opus-4-6 | anthropic/claude-sonnet-4-6 | anthropic/claude-haiku-4-5 | openai/gpt-5.4"
  ],
  "inputSchemaId": "string",
  "outputSchemaId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## GET /api/agent-versions/{id}

Get an agent version by ID.

**Path parameters**

- `id` (required): Agent version to retrieve.

**Response**

```json
{
  "id": "string",
  "agentId": "string",
  "name": "string",
  "parentId": "string",
  "instructions": "string",
  "models?": [
    "anthropic/claude-opus-4-6 | anthropic/claude-sonnet-4-6 | anthropic/claude-haiku-4-5 | openai/gpt-5.4"
  ],
  "inputSchemaId": "string",
  "outputSchemaId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## PATCH /api/agent-versions/{id}

Update agent version

**Path parameters**

- `id` (required): The agent version's prefixed ID (e.g. `agtver_...`).

**Request body**

```json
{
  "name?": "string",
  "instructions?": "string",
  "models?": ["string"],
  "inputSchemaId?": "string",
  "outputSchemaId?": "string"
}
```

**Response**

```json
{
  "id": "string",
  "agentId": "string",
  "name": "string",
  "parentId": "string",
  "instructions": "string",
  "models?": [
    "anthropic/claude-opus-4-6 | anthropic/claude-sonnet-4-6 | anthropic/claude-haiku-4-5 | openai/gpt-5.4"
  ],
  "inputSchemaId": "string",
  "outputSchemaId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## DELETE /api/agent-versions/{id}

Soft-delete an agent version.

**Path parameters**

- `id` (required): Agent version to delete.

**Response**

```json
{
  "success": "boolean"
}
```

## POST /api/agent-versions/{id}/fork

Fork a version (create new version from existing)

**Path parameters**

- `id` (required): The agent version's prefixed ID (e.g. `agtver_...`).

**Request body**

```json
{
  "name?": "string"
}
```

**Response**

```json
{
  "id": "string",
  "agentId": "string",
  "name": "string",
  "parentId": "string",
  "instructions": "string",
  "models?": [
    "anthropic/claude-opus-4-6 | anthropic/claude-sonnet-4-6 | anthropic/claude-haiku-4-5 | openai/gpt-5.4"
  ],
  "inputSchemaId": "string",
  "outputSchemaId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## DELETE /api/agent-versions/{id}/purge

Permanently delete a soft-deleted agent version.

**Path parameters**

- `id` (required): Soft-deleted agent version to permanently delete.

**Response**

```json
{
  "success": "boolean"
}
```

## POST /api/agent-versions/{id}/restore

Restore a soft-deleted agent version.

**Path parameters**

- `id` (required): Soft-deleted agent version to restore.

**Response**

```json
{
  "id": "string",
  "agentId": "string",
  "name": "string",
  "parentId": "string",
  "instructions": "string",
  "models?": [
    "anthropic/claude-opus-4-6 | anthropic/claude-sonnet-4-6 | anthropic/claude-haiku-4-5 | openai/gpt-5.4"
  ],
  "inputSchemaId": "string",
  "outputSchemaId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## POST /api/agent-versions/{id}/set-default

Set this version as the agent's default

**Path parameters**

- `id` (required): The agent version's prefixed ID (e.g. `agtver_...`).

**Response**

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "system": "boolean",
  "defaultVersionId": "string",
  "createdBy": "string",
  "runtimeUserId": "string",
  "deletedAt": "string",
  "retentionTier": "short | medium | long | none",
  "createdAt": "string",
  "updatedAt": "string"
}
```
