---
title: "Rename a library or replace its sources and repositories"
method: PATCH
path: "/api/projects/{project_id}/business_knowledge/libraries/{id}/"
tags: ["business_knowledge"]
---

# Rename a library or replace its sources and repositories

`PATCH /api/projects/{project_id}/business_knowledge/libraries/{id}/`

## Request

- Base URL: `https://us.posthog.com`
- URL: `https://us.posthog.com/api/projects/{project_id}/business_knowledge/libraries/{id}/`
- Auth: HTTP bearer

Send only the fields you want to change. `source_ids` replaces every source in the library. `repos` replaces this environment's repositories and leaves repositories that only another environment allows.

## Path parameters

- `id` string, required
- `project_id` string, required

## Request body

- PatchedKnowledgeLibraryUpdate
  - `name` string: New name. Omit to keep the current name.
  - `source_ids` string[]: Replaces every source in this library. Omit to leave sources unchanged. An empty list removes them all.
  - `repos` string[]: Replaces this environment's repositories in the library. Omit to leave them unchanged. Repositories only another environment allows stay.

## Response `200`

- KnowledgeLibrary
  - `id` string, uuid, required: Library id.
  - `name` string, required: Library name. Unique in this project, ignoring case.
  - `is_default` boolean, required: True for the library new learned sources join. There is at most one.
  - `source_count` integer, required: How many sources are in this library.
  - `repos` string[], required: Selected repositories in this library that this environment is allowed to read.

## Changes

> 52 revisions in range; 1 not diffed.

- **2026-10-15** `d7a9d45fe2ed`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/posthog/apis/posthog-api/changes/api/projects/:project_id/business_knowledge/libraries/:id/patch.md)

---

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