---
title: "Swarm Versions"
description: "REST endpoints for swarm versions. Bearer-auth required."
section: "API"
group: "REST"
order: 66
---

## GET /api/swarm-versions

List swarm 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.
- `swarm_id` (required): Swarm whose versions to list.
- `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.
- `entry_node_id` (optional): Shorthand: filter where `entryNodeId` equals this value.

**Response**

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

## POST /api/swarm-versions

Create swarm version

**Request body**

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

**Response**

```json
{
  "id": "string",
  "swarmId": "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",
  "entryNodeId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

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

Get a swarm version by ID.

**Path parameters**

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

**Response**

```json
{
  "id": "string",
  "swarmId": "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",
  "entryNodeId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

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

Update swarm version

**Path parameters**

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

**Request body**

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

**Response**

```json
{
  "id": "string",
  "swarmId": "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",
  "entryNodeId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

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

Soft-delete a swarm version.

**Path parameters**

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

**Response**

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

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

Fork a swarm version

**Path parameters**

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

**Request body**

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

**Response**

```json
{
  "id": "string",
  "swarmId": "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",
  "entryNodeId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

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

Permanently delete a soft-deleted swarm version.

**Path parameters**

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

**Response**

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

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

Restore a soft-deleted swarm version.

**Path parameters**

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

**Response**

```json
{
  "id": "string",
  "swarmId": "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",
  "entryNodeId": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```

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

Set default swarm version

**Path parameters**

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

**Response**

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "defaultVersionId": "string",
  "createdBy": "string",
  "runtimeUserId": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```
