---
title: "Update a migration"
method: PATCH
path: "/migrations/{migration_id}"
tags: ["Migrations"]
---

# Update a migration

`PATCH /migrations/{migration_id}`

## Request

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

The API version of the app's "Edit company" and "Add New Sheet". Send only the fields to change; any other field is a 400. `templates` ADDS templates: each slug without a sheet gets a new, empty one, and slugs that already have one are skipped — templates are never removed. Changing `source` or adding `templates` is refused with 409 (`code: imports_in_flight`) while an import is in progress, including a preview waiting for approval; `name` and `external_id` can always change.

## Request body

- object
  - `name` string: New display name. Must be non-blank.
  - `source` string, nullable: Source name to bind, or null for a sourceless migration.
  - `external_id` string, nullable: A new external ID, unique among your migrations, or null to clear it.
  - `templates` string[]: Template slugs to add.

## Response `200`

The updated migration.

- object
  - `migration` Migration
    - `id` string, uuid: The migration ID — pass it to every later call.
    - `name` string
    - `external_id` string, nullable: Your own identifier for this customer.
    - `source` string, nullable
    - `status` 'awaiting_files' | 'ready' | 'awaiting_approval' | 'completed': Omitted from `GET /migrations` list items.
    - `templates` object[]
      - `slug` string
      - `name` string
    - `archived` boolean: Archived migrations stay readable and exportable but refuse uploads, runs and edits. Restore one from the Archived page in Vern.
    - `created_at` string, date-time
    - `url` string, uri: Opens the company in Vern. `/companies/open/{key}` also accepts the `external_id`.

## Other responses

- `400`: Malformed request.
- `401`: API key missing, malformed, or revoked.
- `404`: No such migration, or the named source doesn't exist.
- `409`: The migration is archived (`code: migration_archived`), an import is in progress (`code: imports_in_flight`, with the blocking `runs`), the `external_id` is already used by another migration, or the source name is ambiguous.
- `429`: Rate limit hit. Counted per account (company), not per API key or IP. Each endpoint is in one class: reads 30/minute, writes 30/minute, jobs (starting an export) 15/hour, agent (starting a run, answering, submitting credentials) 30/hour. Creating a migration and starting a `generate` run also have their own 30/hour caps. A separate per-IP ceiling absorbs floods before authentication. `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-11-08** `0ae6ef5f1887`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/vern-so/apis/vern-api/changes/migrations/:migration_id/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/0ae6ef5f1887?raw)
