# List agent versions

List immutable versions for an agent branch using a stable cursor.

## Endpoint

`GET /api/v1/workspaces/{workspace_id}/agents/{agent_id}/versions`

## Authentication

| Class | Authentication | Minimum role | API key |
| --- | --- | --- | --- |
| customer-api | Bearer API key or dashboard session cookie; dashboard mutations also require X-CX-Request: 1. | member | Allowed |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `workspace_id` | path | `string` | Yes | — |
| `agent_id` | path | `string` | Yes | — |
| `branch_id` | query | `string` | Yes | — |
| `cursor` | query | `string or null` | No | — |
| `limit` | query | `integer` | No | — |

## Request body

This operation has no request body.

## Example

```bash
curl --request GET 'https://operade.ai/api/v1/workspaces/ws_demo/agents/agt_demo/versions?branch_id=br_demo' \
  --header 'Authorization: Bearer YOUR_API_KEY'
```

## Responses

| Status | Description | Content |
| --- | --- | --- |
| 4XX | Handled client error | application/json: `ErrorResponse` |
| 200 | Successful Response | application/json: `VersionListResponse` |

### 4XX application/json response schema

| Field path | Type | Reference | Format | Nullable | Required | Enum | Description |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `$` | `object` | ErrorResponse | — | No | Yes | — | — |
| `error` | `object` | ErrorItem | — | No | Yes | — | — |
| `error.code` | `string` | — | — | No | Yes | — | — |
| `error.details` | `object` | — | — | No | No | — | — |
| `error.message` | `string` | — | — | No | Yes | — | — |

### 200 application/json response schema

| Field path | Type | Reference | Format | Nullable | Required | Enum | Description |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `$` | `object` | VersionListResponse | — | No | Yes | — | — |
| `items` | `array<BranchVersion>` | — | — | No | Yes | — | — |
| `items[]` | `object` | BranchVersion | — | No | Yes | — | — |
| `items[].branch_id` | `string` | — | — | No | Yes | — | — |
| `items[].created_at` | `string` | — | date-time | No | Yes | — | — |
| `items[].created_by` | `object` | NamedActor | — | No | Yes | — | — |
| `items[].created_by.email` | `string` | — | — | No | Yes | — | — |
| `items[].created_by.id` | `string` | — | — | No | Yes | — | — |
| `items[].created_by.name` | `string` | — | — | No | Yes | — | — |
| `items[].description` | `string` | — | — | No | Yes | — | — |
| `items[].id` | `string` | — | — | No | Yes | — | — |
| `items[].label` | `string` | — | — | No | Yes | — | — |
| `items[].merged_from_version_id` | `string or null` | — | — | Yes | Yes | — | — |
| `items[].out_of_branch_parent_id` | `string or null` | — | — | Yes | Yes | — | — |
| `items[].parent_version_id` | `string or null` | — | — | Yes | Yes | — | — |
| `items[].rebased_from_version_id` | `string or null` | — | — | Yes | Yes | — | — |
| `items[].reverted_from_version_id` | `string or null` | — | — | Yes | Yes | — | — |
| `next_cursor` | `string or null` | — | — | Yes | Yes | — | — |

### Response example

```json
{
  "items": [],
  "next_cursor": "string"
}
```

## Errors

Reviewed common and route-declared errors are summarized here; the list is not exhaustive. Start with the [distributed error index](/docs/reference/api/errors) to find each code's canonical domain page.

| Status | Code | Description |
| --- | --- | --- |
| 401 | `unauthenticated` | Authentication is missing, invalid, or revoked. |
| 403 | `forbidden` | The authenticated caller does not have access to this operation. |
| 404 | `not_found` | The requested workspace resource was not found. |

## Related operations

- [Get an agent version](/docs/api-reference/versions/get-agent-version) — `GET /api/v1/workspaces/{workspace_id}/agents/{agent_id}/versions/{version_id}`
- [Revert an agent version](/docs/api-reference/versions/revert-agent-version) — `POST /api/v1/workspaces/{workspace_id}/agents/{agent_id}/versions/{version_id}/revert`
