---
title: "Update a rule's text"
method: PATCH
path: "/v2/teamspaces/{teamspaceId}/rules/{ruleId}"
tags: ["Teamspace Admin"]
---

# Update a rule's text

`PATCH /v2/teamspaces/{teamspaceId}/rules/{ruleId}`

## Request

- Base URL: `https://context7.com/api`
- URL: `https://context7.com/api/v2/teamspaces/{teamspaceId}/rules/{ruleId}`
- Auth: HTTP bearer

Replaces the text. Send the rule's `libraryId` for a library rule (the id does not move a rule between libraries). Owners and admins only, paid owner plan.

## Request body

- object
  - `text` string, required
  - `libraryId` string, nullable: Library id starting with `/`. Omit or null for a rule on every library.

## Response `200`

Rule updated

- TeamspaceRuleResponse
  - `success` boolean
  - `data` object
    - `text` string, required
    - `createdBy` string, required: User id of the author.
    - `createdAt` integer, required: Unix time in milliseconds.
    - `libraryType` 'repo' | 'llmstxt' | 'website' | 'openapi' | 'pdf' | 'docx' | 'file' | 'confluence' | 'notion'
    - `docsUrl` string, uri
    - `id` string, uuid: Returned on create only.

## Other responses

- `400`: Bad Request - Invalid input parameters
- `401`: Unauthorized - Invalid or missing API key
- `403`: Forbidden - Insufficient permissions or plan restrictions
- `404`: Not Found - Resource doesn't exist
- `500`: Internal Server Error

## Changes

- **2026-10-22** `e17589fd8767`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/context7/apis/context7-public-api/changes/v2/teamspaces/:teamspaceId/rules/:ruleId/patch.md)

---

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