---
title: "Archive a branch"
method: POST
path: "/agent/{id}/branches/{branchId}/archive"
tags: ["Agent Versioning - Branches"]
---

# Archive a branch

`POST /agent/{id}/branches/{branchId}/archive`

Archive a branch. `Main` cannot be archived. The live branch cannot be archived; make another branch live first. Archived branches are hidden from list views but their revisions remain queryable by ID.

## Path parameters

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

## Response `200`

Archived.

- object
  - `status` boolean
  - `data` object
    - `archived` boolean

## Other responses

- `400` — Invalid input
- `401` — Unauthorized access
- `403` — Forbidden. `Main` cannot be archived, the live branch cannot be archived, or the caller lacks write access.
- `404` — Resource not found. The referenced ID does not exist or does not belong to the caller's organization.
- `423` — Locked. A configuration freeze is active on this agent, or the resource is temporarily locked for another write. Retry after the freeze window ends.
- `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/274a178284a4/schema)
