> ## 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 or update the source connection

> Attach a live API source to the migration, or update it in place. `credentials` (optional here) go to a secured vault and are never returned; you can also supply them later via Submit credentials.



## OpenAPI

````yaml /api-reference/openapi.json post /migrations/{migration_id}/source-connection
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}/source-connection:
    parameters:
      - $ref: '#/components/parameters/MigrationId'
    post:
      tags:
        - Migrations
      summary: Create or update the source connection
      description: >-
        Attach a live API source to the migration, or update it in place.
        `credentials` (optional here) go to a secured vault and are never
        returned; you can also supply them later via Submit credentials.
      operationId: saveSourceConnection
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - source_key
              properties:
                source_key:
                  type: string
                  description: >-
                    The connector to attach, lower-cased. Unknown or
                    not-yet-enabled keys return 400.
                profile_id:
                  type:
                    - string
                    - 'null'
                  description: >-
                    Scope to a profile; null binds to the workbook; omit for the
                    default profile.
                config:
                  type: object
                  description: Non-secret connector configuration.
                  additionalProperties: true
                selected_streams:
                  type:
                    - array
                    - 'null'
                  items:
                    type: string
                  description: Streams to extract, or null for connector default.
                stream_state:
                  type: object
                  description: Incremental-sync cursor state.
                  additionalProperties: true
                credentials:
                  type: object
                  description: Secret values, vaulted and never returned.
                  additionalProperties: true
            example:
              source_key: salesforce
              config:
                instance_url: https://acme.my.salesforce.com
              selected_streams:
                - contacts
                - accounts
              credentials:
                client_id: …
                client_secret: …
      responses:
        '201':
          description: The created or updated connection.
          content:
            application/json:
              schema:
                type: object
                properties:
                  source_connection:
                    $ref: '#/components/schemas/SourceConnection'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '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:
    SourceConnection:
      type: object
      description: >-
        A migration's live API source connection. Never includes secret values;
        `creds_configured` reports whether credentials are stored.
      properties:
        id:
          type: string
          format: uuid
        profile_id:
          type:
            - string
            - 'null'
        source_key:
          type: string
        name:
          type: string
          description: Connector display name; falls back to source_key.
        category:
          type:
            - string
            - 'null'
        config:
          type: object
          description: Non-secret connector configuration.
          additionalProperties: true
        selected_streams:
          type:
            - array
            - 'null'
          items:
            type: string
        stream_state:
          type: object
          additionalProperties: true
        creds_configured:
          type: boolean
        bound_source_extractor_id:
          type:
            - string
            - 'null'
        last_snapshot:
          type:
            - object
            - 'null'
          description: Metadata about the most recent extraction.
        last_sync_at:
          type:
            - string
            - 'null'
          format: date-time
    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.

````