> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coderabbit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Learning

> Replaces canonical learning text and refreshes its LanceDB embedding. The text is trimmed and recognized credentials are redacted before persistence and indexing. Enterprise plan and learning:write permission required.

export const EnterprisePlanBadge = ({tip = "This feature is available exclusively as part of the Enterprise plan. Please refer to our pricing page for more information about our plans and features.", title = "Enterprise Plan", cta = "Read more", href = "https://coderabbit.ai/pricing", disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="building-2" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

<EnterprisePlanBadge />

## Update Learning

<Info>
  Requires the `learning:write` permission. Workspace API key owners must also remain workspace admins.
</Info>

## API key eligibility

User and workspace API keys can update Learnings. Legacy organization API keys and agentic API keys cannot use this endpoint. A workspace API key must select one organization for every request by providing that organization's Git provider ID as `org_id`.

## Update behavior

An update replaces the canonical Learning text after trimming whitespace and redacting recognized credentials. CodeRabbit then rebuilds the shared review-index record and its embedding from the canonical Learning metadata.

If the canonical update succeeds but the index refresh fails, repeat the same request. The retry rebuilds the derived index from the canonical record.

## Rate limit

The Learnings write endpoints share a limit of 10 requests per minute per organization.


## OpenAPI

````yaml patch /v1/learnings/{learning_id}
openapi: 3.0.3
info:
  title: CodeRabbit API spec
  version: 1.0.0
servers:
  - url: https://api.coderabbit.ai
security:
  - ApiKeyAuth: []
paths:
  /v1/learnings/{learning_id}:
    patch:
      tags:
        - Learnings
      summary: Update a learning
      description: >-
        Replaces canonical learning text and refreshes its LanceDB embedding.
        The text is trimmed and recognized credentials are redacted before
        persistence and indexing. Enterprise plan and learning:write permission
        required.
      operationId: learnings-update
      parameters:
        - in: path
          name: learning_id
          required: true
          schema:
            type: string
          description: Learning ID returned by GET /v1/learnings.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - learning
              additionalProperties: false
              properties:
                org_id:
                  type: string
                  description: >-
                    Required for workspace API keys; the git-provider
                    organization ID to target. Ignored for organization keys.
                learning:
                  type: string
                  minLength: 1
      responses:
        '204':
          description: Learning updated and, when shared, reindexed.
        '400':
          description: >-
            Invalid learning ID, text, request body, or missing workspace
            org_id.
        '401':
          description: Invalid key or missing authenticated identity.
        '403':
          description: >-
            Enterprise plan or learning:write permission required; agentic keys
            are forbidden.
        '404':
          description: >-
            Learning not found in the target organization, or the organization
            is not in the workspace.
        '410':
          description: Legacy organization keys cannot update learnings.
        '429':
          description: Rate limit exceeded.
        '500':
          description: PostgreSQL, LanceDB, or internal service update failed.
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-coderabbitai-api-key
      description: >-
        API key for authentication. You can create an API key from the
        CodeRabbit dashboard.

````