---
title: "Get branch"
method: GET
path: "/agent/{id}/branches/{branchId}"
tags: ["Agent Versioning - Branches"]
---

# Get branch

`GET /agent/{id}/branches/{branchId}`

Return a single branch summary, including draft state (`openDraftId`, `hasOpenDraft`) and head revision.

## Path parameters

- `id` string, required
- `branchId` string, required

## Response `200`

Successful response.

- object
  - `status` boolean
  - `data` BranchSummary — Branch document plus derived fields used by list and detail views.
    - `branch` Branch — An `AgentBranch` document. An editable copy of an agent with its own draft slot and revision chain.
      - `_id` string — Branch ID (24-character ObjectId).
      - `agent` string — ID of the agent this branch belongs to.
      - `name` string — Branch name (unique per agent among active branches). `main` is reserved for the default branch.
      - `isDefault` boolean — True for the seeded `main` branch. The default branch cannot be renamed or archived.
      - `sourceBranchId` string, nullable — Head of the source branch at fork time. `null` for `main`.
      - `sourceRevisionId` string, nullable — Revision the branch was forked from. `null` for `main`.
      - `headRevisionId` string, nullable — ID of the branch's latest committed revision. `null` until the first commit.
      - `openDraftId` string, nullable — ID of the branch's single open draft. `null` when no draft is open.
      - `status` 'active' | 'archived' — Archived branches are hidden from list views and cannot receive draft edits or be made live.
      - `createdBy` string
      - `updatedBy` string
      - `createdAt` string, date-time
      - `updatedAt` string, date-time
    - `isLive` boolean — True when the agent's live config points at this branch.
    - `hasOpenDraft` boolean
    - `revisionsCount` integer
    - `headRevisionNumber` integer, nullable

## Other responses

- `400` — Invalid input
- `401` — Unauthorized access
- `403` — Forbidden access
- `404` — Resource not found. The referenced ID does not exist or does not belong to the caller's organization.
- `500` — Internal server error

---

[API](https://skmtc.net/smallest-inc/apis/agent-management-api.md) · [All operations](https://skmtc.net/smallest-inc/apis/agent-management-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/smallest-inc/agent-management-api/revisions/c2d0eb64b01a/schema)
