---
title: "Replace customer knowledge"
method: PATCH
path: "/migrations/{migration_id}/knowledge"
tags: ["Knowledge"]
---

# Replace customer knowledge

`PATCH /migrations/{migration_id}/knowledge`

## Request

- Base URL: `https://app.vern.so/api/v1`
- URL: `https://app.vern.so/api/v1/migrations/{migration_id}/knowledge`
- Auth: API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/vern-so/apis/vern-api/docs/migrations/:migration_id/knowledge/patch.ts> (a function with typed inputs; its response is checked against the schema)

`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.

## Request body

- KnowledgeWrite
  - `knowledge` string, nullable, required: Replaces the whole document. Empty string clears it.
  - `if_unmodified_since` string: The `updated_at` you last read. Supply it to get `412` instead of silently overwriting a concurrent change.

## Response `200`

Knowledge updated.

- MigrationKnowledge
  - `migration_id` string
  - `knowledge` string, nullable
  - `updated_at` string, nullable

## Other responses

- `400`: Malformed request.
- `401`: API key missing, malformed, or revoked.
- `404`: No migration with this id in your organisation. Returned rather than `403` so the existence of another organisation's migration is not disclosed.
- `409`: A migration is currently running and may be rewriting this document.
- `412`: The document changed after the `if_unmodified_since` you supplied. The body carries the current `updated_at`; re-read, merge, and retry.
- `429`: Rate limit hit. Counted per account, not per API key. Creating a migration and starting a `generate` run are limited to 30/hour each; answering a run is limited to 30/hour; reads allow 30/minute and writes 30/minute. `Retry-After` gives the seconds until the window resets, alongside `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`.
- `500`: Unexpected server error.

## Changes

- **2026-08-21** `f23b9ff77f72`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/vern-so/apis/vern-api/changes/migrations/:migration_id/knowledge/patch.md)

---

[API](https://skmtc.dev/vern-so/apis/vern-api.md) - [All operations](https://skmtc.dev/vern-so/apis/vern-api/llms.txt) - [OpenAPI document](https://skmtc.dev/vern-so/apis/vern-api/revisions/6ae61af2db81?raw)
