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

# Create a migration

> Create a migration workspace for one customer — a workbook with one sheet per template. Requires API-key auth specifically. `external_id` makes creation idempotent: re-sending the same one (with the same source) returns the existing migration with a 200.



## OpenAPI

````yaml /api-reference/openapi.json post /migrations
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.
paths:
  /migrations:
    post:
      tags:
        - Migrations
      summary: Create a migration
      description: >-
        Create a migration workspace for one customer — a workbook with one
        sheet per template. Requires API-key auth specifically. `external_id`
        makes creation idempotent: re-sending the same one (with the same
        source) returns the existing migration with a 200.
      operationId: createMigration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  description: >-
                    Display name for the migration (e.g. the customer's org
                    name).
                source:
                  type: string
                  description: >-
                    The source name this migration comes from. Optional — omit
                    for a sourceless migration.
                external_id:
                  type: string
                  maxLength: 255
                  pattern: ^[a-zA-Z0-9_-]+$
                  description: >-
                    Your own identifier for this customer. Alphanumeric,
                    hyphens, underscores. Makes creation idempotent.
                templates:
                  type: array
                  items:
                    type: string
                  description: >-
                    Template slugs to create sheets from. Omit to use every
                    active template.
            example:
              name: Acme Corp
              source: Salesforce
              external_id: acme-001
              templates:
                - contacts
      responses:
        '201':
          description: >-
            The created migration (200 when an existing migration is returned
            via external_id idempotency).
          content:
            application/json:
              schema:
                type: object
                properties:
                  migration:
                    $ref: '#/components/schemas/Migration'
              example:
                migration:
                  id: c0a8012e-4f1b-4d3a-9b2c-7e6f5a4b3c2d
                  name: Acme Corp
                  source: Salesforce
                  status: awaiting_files
                  templates:
                    - slug: contacts
                      name: Contacts
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    Migration:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The migration ID — pass it to every later call.
        name:
          type: string
        source:
          type:
            - string
            - 'null'
        status:
          type: string
          enum:
            - awaiting_files
            - ready
            - awaiting_approval
            - completed
        templates:
          type: array
          items:
            type: object
            properties:
              slug:
                type: string
              name:
                type: string
    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'
    NotFound:
      description: The referenced resource isn't in your account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: A uniqueness or state conflict.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limit hit — back off and retry.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Too many requests
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your Vern API key. Create one at Settings → API keys.

````