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

# Replace source knowledge

> `knowledge` replaces the whole document; an empty string clears it. Use `if_unmodified_since` for safe read-modify-write.



## OpenAPI

````yaml /api-reference/openapi.json patch /sources/{source}/knowledge
openapi: 3.1.0
info:
  title: Vern Migration API
  version: 1.0.0
  description: >-
    Run Vern as a headless migration engine. Create a migration, upload a
    customer's files, run the managed agent to generate a preview, then execute
    and export clean data. See the Migration API guides for concepts and
    walkthroughs.
servers:
  - url: https://app.vern.so/api/v1
security:
  - apiKey: []
tags:
  - name: Catalog
    description: Discover the sources and templates you set up in the Vern UI.
  - name: Migrations
    description: Create a migration workspace and upload a customer's files.
  - name: Runs
    description: 'Drive the managed agent: generate, refine, execute, answer, and observe.'
  - name: Export
    description: Download a migration's validated data as CSV.
  - name: Log
    description: The settled record of what a migration did.
  - name: Knowledge
    description: Durable context the agent reads before every run.
  - name: Exports
    description: Download imported data.
  - name: Extractions
    description: >-
      Turn an unstructured file into structured data, without running a
      migration.
paths:
  /sources/{source}/knowledge:
    parameters:
      - $ref: '#/components/parameters/SourceName'
    patch:
      tags:
        - Knowledge
      summary: Replace source knowledge
      description: >-
        `knowledge` replaces the whole document; an empty string clears it. Use
        `if_unmodified_since` for safe read-modify-write.
      operationId: updateSourceKnowledge
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KnowledgeWrite'
      responses:
        '200':
          description: Knowledge updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SourceKnowledge'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/SourceNotFound'
        '409':
          description: >-
            The source name is ambiguous, or a migration is currently running
            for this source and holds the knowledge lock.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '412':
          $ref: '#/components/responses/KnowledgeStale'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  parameters:
    SourceName:
      name: source
      in: path
      required: true
      schema:
        type: string
      description: >-
        The source's name, as returned by `GET /sources`. URL-encode names
        containing spaces.
      example: HubSpot
  schemas:
    KnowledgeWrite:
      type: object
      required:
        - knowledge
      properties:
        knowledge:
          type: string
          nullable: true
          description: Replaces the whole document. Empty string clears it.
        if_unmodified_since:
          type: string
          description: >-
            The `updated_at` you last read. Supply it to get `412` instead of
            silently overwriting a concurrent change.
    SourceKnowledge:
      type: object
      properties:
        source:
          type: string
        knowledge:
          type: string
          nullable: true
        updated_at:
          type: string
          nullable: true
    Error:
      type: object
      properties:
        error:
          type: string
          description: A human-readable error message.
      required:
        - error
  responses:
    BadRequest:
      description: Malformed request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: API key missing, malformed, or revoked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    SourceNotFound:
      description: No source with this name in your organisation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    KnowledgeStale:
      description: >-
        The document changed after the `if_unmodified_since` you supplied. The
        body carries the current `updated_at`; re-read, merge, and retry.
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - type: object
                properties:
                  updated_at:
                    type: string
                    nullable: true
    RateLimited:
      description: Rate limit hit — back off and retry.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Too many requests
    ServerError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your Vern API key. Create one at Settings → API keys.

````