> ## 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). Needs an active plan.



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


    **Rate limits** are counted per account (company), not per key or IP, in
    four classes: reads 30/minute, writes 30/minute, jobs (starting an export)
    15/hour, and agent calls (starting a run, answering, submitting credentials)
    30/hour. Creating a migration and starting a `generate` run each also have a
    30/hour cap. A `429` carries `Retry-After` plus `X-RateLimit-Limit`,
    `X-RateLimit-Remaining` and `X-RateLimit-Reset`.


    **Errors** are `{"error": "..."}`; some add a machine-readable `code` (e.g.
    `migration_archived`, `imports_in_flight`, `knowledge_too_long`,
    `storage_quota_exceeded`, `DOCUMENT_EXTRACTION_DISABLED`,
    `run_concurrency_limit`). An archived migration stays readable and
    exportable, but every call that changes it returns `409` with `code:
    migration_archived`.


    **Region**: accounts hosted in Australia use
    `https://au.app.vern.so/api/v1`. A key sent to the other region's base URL
    is answered `421` with `{"error", "code": "wrong_region", "region",
    "base_url", "mcp_url", "app_url"}` — switch to `base_url`.
servers:
  - url: https://app.vern.so/api/v1
    description: US-hosted accounts
  - url: https://au.app.vern.so/api/v1
    description: Australia-hosted accounts
security:
  - apiKey: []
tags:
  - name: Catalog
    description: Discover the sources and templates you set up in the Vern UI.
  - name: Migrations
    description: >-
      Create, list, update and archive migration workspaces, 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.
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). Needs an active plan.
      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.
                instructions:
                  type:
                    - string
                    - 'null'
                  maxLength: 200
                  description: >-
                    generate only. Optional guidance for this migration (at most
                    200 characters), e.g. "Only import active customers". The
                    agent follows it but it cannot override Vern's rules, a
                    locked template or the Memory setting. Kept for every later
                    leg of the run and returned on the run as `instructions`.
                    Longer than 200 characters returns 400 with code
                    instructions_too_long.
            examples:
              generate:
                summary: Generate a preview
                value:
                  kind: generate
              generate_api:
                summary: Generate from a live source
                value:
                  kind: generate
                  extract_via_api: true
              generate_instructions:
                summary: Generate with instructions
                value:
                  kind: generate
                  instructions: Only import active customers and keep their original IDs.
              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'
        '403':
          $ref: '#/components/responses/PlanRequired'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            A run is already in progress (the body carries the active run_id),
            the migration has no target templates, there is no preview to act on
            / execute, the approved preview is no longer resumable (generate a
            fresh one), or the migration is archived (`code:
            migration_archived`).
          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
        '422':
          $ref: '#/components/responses/KnowledgeBlocksRun'
        '429':
          $ref: '#/components/responses/RunStartLimited'
        '500':
          $ref: '#/components/responses/ServerError'
        '503':
          description: >-
            `execute` only: the go-ahead could not be delivered to the waiting
            run. Nothing was started — retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
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.
        code:
          type: string
          description: >-
            A machine-readable code, on errors whose status alone is ambiguous
            (e.g. migration_archived, imports_in_flight, knowledge_too_long).
      required:
        - error
    OverLimitKnowledge:
      type: object
      properties:
        kind:
          type: string
          enum:
            - source
            - migration
            - template
        id:
          type:
            - string
            - 'null'
        name:
          type:
            - string
            - 'null'
        length:
          type: integer
          description: Length in characters.
        limit:
          type: integer
          description: The limit for this kind of knowledge.
      required:
        - kind
        - length
        - limit
    RunConcurrencyError:
      type: object
      description: >-
        A `429` from the concurrent-run limit. Distinguished from a plain rate
        limit by the `code` field.
      properties:
        error:
          type: string
          description: A human-readable error message.
        code:
          type: string
          enum:
            - run_concurrency_limit
          description: Machine-readable discriminator.
        limit:
          type: integer
          description: The maximum number of runs allowed in progress at once.
        runs:
          type: array
          description: >-
            The runs currently holding capacity. Cancel or wait for one of
            these.
          items:
            type: object
            properties:
              id:
                type: string
              status:
                type: string
                description: One of `queued`, `running`, `blocked`.
              updatedAt:
                type:
                  - string
                  - 'null'
                format: date-time
              runKind:
                type:
                  - string
                  - 'null'
            required:
              - id
              - status
      required:
        - error
        - code
        - runs
  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'
    PlanRequired:
      description: >-
        Your account has no active plan. Only endpoints that create work
        (creating a migration, starting a run, starting an export) require one;
        reads are unaffected.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: >-
              Your plan does not include data imports. Upgrade your plan to
              import data.
    NotFound:
      description: The referenced resource isn't in your account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    KnowledgeBlocksRun:
      description: >-
        Knowledge this migration uses is over its size limit, so the run was not
        started (`code: knowledge_too_long`). Applies to `generate`, `update`
        and `execute`, not `clarify`. Shorten each listed document and retry.
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - type: object
                properties:
                  documents:
                    type: array
                    items:
                      $ref: '#/components/schemas/OverLimitKnowledge'
    RunStartLimited:
      description: >-
        Either the hourly rate limit on `kind: "generate"` (30/hour per account)
        or the concurrent-run limit (3 in progress). The concurrency refusal is
        identifiable by `code: "run_concurrency_limit"` and lists the blocking
        runs; a plain rate limit carries only `error` plus `Retry-After`.
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/Error'
              - $ref: '#/components/schemas/RunConcurrencyError'
    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.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.