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

# Start a run

> Start one managed-agent run. `generate` authors the recipe and stops at a preview; `update` edits it per `message`; `clarify` asks a read-only question; `execute` runs the approved preview for real. `generate` opens a preview run and `update`/`clarify`/`execute` resume that same run, so the `run_id` stays stable from preview through execution (a resuming call returns `status: "running"`). Only one run runs at a time per migration (409 with the active run_id otherwise).



## OpenAPI

````yaml /api-reference/openapi.json post /migrations/{migration_id}/runs
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/{migration_id}/runs:
    parameters:
      - $ref: '#/components/parameters/MigrationId'
    post:
      tags:
        - Runs
      summary: Start a run
      description: >-
        Start one managed-agent run. `generate` authors the recipe and stops at
        a preview; `update` edits it per `message`; `clarify` asks a read-only
        question; `execute` runs the approved preview for real. `generate` opens
        a preview run and `update`/`clarify`/`execute` resume that same run, so
        the `run_id` stays stable from preview through execution (a resuming
        call returns `status: "running"`). Only one run runs at a time per
        migration (409 with the active run_id otherwise).
      operationId: startRun
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - kind
              properties:
                kind:
                  type: string
                  enum:
                    - generate
                    - update
                    - clarify
                    - execute
                message:
                  type: string
                  description: >-
                    Required for update and clarify — your instruction or
                    question in plain language.
                extract_via_api:
                  type: boolean
                  description: >-
                    generate only. Controls live API extraction from a connected
                    source: true extracts via the connection (alongside any
                    files), false forces file-only, omitted extracts via API
                    only when no files were uploaded and a connection exists.
            examples:
              generate:
                summary: Generate a preview
                value:
                  kind: generate
              generate_api:
                summary: Generate from a live source
                value:
                  kind: generate
                  extract_via_api: true
              update:
                summary: Refine the recipe
                value:
                  kind: update
                  message: Trim whitespace from every phone number.
              clarify:
                summary: Ask a read-only question
                value:
                  kind: clarify
                  message: Which column did you map Email from?
              execute:
                summary: Execute for real
                value:
                  kind: execute
      responses:
        '201':
          description: >-
            The run was accepted. A `generate` is `queued`; a resuming
            `update`/`clarify`/`execute` is `running`. Poll `poll_url`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunAccepted'
              example:
                run_id: d4c3b2a1-9f8e-47d6-b5a4-c3d2e1f0a9b8
                status: queued
                poll_url: >-
                  https://app.vern.so/api/v1/migrations/c0a8012e-.../runs/d4c3b2a1-9f8e-47d6-b5a4-c3d2e1f0a9b8
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            A run is already in progress (the body carries the active run_id),
            there is no preview to act on / execute, or the approved preview is
            no longer resumable (generate a fresh one).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: A run is already in progress for this migration.
                run_id: d4c3b2a1-9f8e-47d6-b5a4-c3d2e1f0a9b8
        '429':
          $ref: '#/components/responses/RateLimited'
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:
    RunAccepted:
      type: object
      properties:
        run_id:
          type: string
          format: uuid
        status:
          type: string
          example: queued
        poll_url:
          type: string
          format: uri
    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'
    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.

````