---
title: "Replace agent sections"
method: PUT
path: "/v1/agents/{id}/sections"
---

# Replace agent sections

`PUT /v1/agents/{id}/sections`

## Request

- Base URL: `https://api.runbear.io`
- URL: `https://api.runbear.io/v1/agents/{id}/sections`
- Auth: HTTP bearer

Make the agent's sections exactly the list sent, in that order. Existing sections are matched by name: a matched section keeps its ID and is changed only if its content or place differs, new names are added, and sections missing from the list are deleted. A request that changes nothing writes nothing, so it is safe to send on every deploy. Returns the sections in their new order. Returns 400 when the list repeats a name, 404 when the agent is not found, and 409 when the agent already has several sections with one name.

## Path parameters

- `id` string, uuid, required: Agent ID

## Request body

- AgentSectionsReplaceRequest
  - `sections` object[], required: Every section the agent should have, in the order they appear in its instructions, at most 100. Names must be unique.
    - `name` string, required: Section name, unique within the agent, at most 200 characters. Shown as the section heading in the agent's instructions.
    - `content` string, required: Section text, at most 100,000 characters.

## Response `200`

Default Response

- AgentSectionsListResponse
  - `sections` AgentSection[], required
    - `id` string, required: Section ID
    - `name` string, required: Section name
    - `content` string, required: Section text
    - `position` integer, required: Zero-based place of the section in the agent's instructions. Read-only: change the order with `PUT /v1/agents/{id}/sections`.
    - `createdAt` string, required: ISO 8601 timestamp when the section was created
    - `updatedAt` string, required: ISO 8601 timestamp when the section was last changed

## Other responses

- `400`: Default Response
- `403`: Default Response
- `404`: Default Response
- `409`: Default Response

---

[API](https://skmtc.dev/runbear/apis/runbear-api.md) - [All operations](https://skmtc.dev/runbear/apis/runbear-api/llms.txt) - [OpenAPI document](https://skmtc.dev/runbear/apis/runbear-api/revisions/c6a9c3066a5a?raw)
