> ## 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 customer knowledge

> `knowledge` **replaces** the whole document; an empty string clears it.
The agent rewrites this field the same way, so read, merge, then write.

Pass `if_unmodified_since` with the `updated_at` you read to make that
safe: if it changed underneath you the write is refused with `412`
rather than overwriting.




## OpenAPI

````yaml /api-reference/openapi.json patch /migrations/{migration_id}/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:
  /migrations/{migration_id}/knowledge:
    parameters:
      - $ref: '#/components/parameters/MigrationId'
    patch:
      tags:
        - Knowledge
      summary: Replace customer knowledge
      description: |
        `knowledge` **replaces** the whole document; an empty string clears it.
        The agent rewrites this field the same way, so read, merge, then write.

        Pass `if_unmodified_since` with the `updated_at` you read to make that
        safe: if it changed underneath you the write is refused with `412`
        rather than overwriting.
      operationId: updateMigrationKnowledge
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KnowledgeWrite'
      responses:
        '200':
          description: Knowledge updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MigrationKnowledge'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/MigrationNotFound'
        '409':
          $ref: '#/components/responses/KnowledgeLocked'
        '412':
          $ref: '#/components/responses/KnowledgeStale'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  parameters:
    MigrationId:
      name: migration_id
      in: path
      required: true
      description: The migration ID returned by Create a migration.
      schema:
        type: string
        format: uuid
      example: c0a8012e-4f1b-4d3a-9b2c-7e6f5a4b3c2d
  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.
    MigrationKnowledge:
      type: object
      properties:
        migration_id:
          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'
    MigrationNotFound:
      description: >-
        No migration with this id in your organisation. Returned rather than
        `403` so the existence of another organisation's migration is not
        disclosed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    KnowledgeLocked:
      description: A migration is currently running and may be rewriting this document.
      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.

````