# List agent branches

List active or archived branches for an agent.

## Endpoint

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

## 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 | — |
| `archived` | query | `boolean` | 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/branches' \
  --header 'Authorization: Bearer YOUR_API_KEY'
```

## Responses

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

### 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` | AgentBranchListResponse | — | No | Yes | — | — |
| `items` | `array<AgentBranch>` | — | — | No | Yes | — | — |
| `items[]` | `object` | AgentBranch | — | No | Yes | — | — |
| `items[].archived_at` | `string or null` | — | date-time | Yes | Yes | — | — |
| `items[].conversations_7d` | `integer` | — | — | 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[].has_draft` | `boolean` | — | — | No | Yes | — | — |
| `items[].id` | `string` | — | — | No | Yes | — | — |
| `items[].is_live` | `boolean` | — | — | No | Yes | — | — |
| `items[].is_main` | `boolean` | — | — | No | Yes | — | — |
| `items[].is_protected` | `boolean` | — | — | No | Yes | — | — |
| `items[].name` | `string` | — | — | No | Yes | — | — |
| `items[].status` | `string` | — | — | No | Yes | "Main", "Up to date", "Behind Main" | — |
| `items[].tip_version_id` | `string` | — | — | No | Yes | — | — |
| `items[].traffic_percentage` | `number` | — | — | No | Yes | — | — |
| `items[].updated_at` | `string` | — | date-time | No | Yes | — | — |

### Response example

```json
{
  "items": []
}
```

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

- [Create an agent branch](/docs/api-reference/branches/create-agent-branch) — `POST /api/v1/workspaces/{workspace_id}/agents/{agent_id}/branches`
- [Get an agent branch](/docs/api-reference/branches/get-agent-branch) — `GET /api/v1/workspaces/{workspace_id}/agents/{agent_id}/branches/{branch_id}`
- [Merge an agent branch](/docs/api-reference/branches/merge-agent-branch) — `POST /api/v1/workspaces/{workspace_id}/agents/{agent_id}/branches/{source_branch_id}/merge`
