> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nx1cloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create and trigger a data migration run



## OpenAPI

````yaml post /api/migration/data-migration/runs
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/migration/data-migration/runs:
    post:
      tags:
        - Data Migration
      summary: Create and trigger a data migration run
      operationId: create_run_api_migration_data_migration_runs_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DataMigrationRunRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataMigrationRunResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    DataMigrationRunRequest:
      properties:
        source_format:
          $ref: '#/components/schemas/SourceFormatEnum'
        migration_type:
          $ref: '#/components/schemas/MigrationTypeEnum'
        default_s3_bucket:
          type: string
          title: Default S3 Bucket
        tracking_database:
          type: string
          title: Tracking Database
        tracking_location:
          type: string
          title: Tracking Location
        report_output_location:
          type: string
          title: Report Output Location
        s3_access_key:
          anyOf:
            - type: string
            - type: 'null'
          title: S3 Access Key
        s3_secret_key:
          anyOf:
            - type: string
            - type: 'null'
          title: S3 Secret Key
        s3_endpoint:
          anyOf:
            - type: string
            - type: 'null'
          title: S3 Endpoint
        distcp_mappers:
          type: integer
          title: Distcp Mappers
          default: 50
        distcp_bandwidth:
          type: integer
          title: Distcp Bandwidth
          default: 100
        email_recipients:
          anyOf:
            - type: string
            - type: 'null'
          title: Email Recipients
        mapr_user:
          anyOf:
            - type: string
            - type: 'null'
          title: Mapr User
        mapr_ticketfile_location:
          anyOf:
            - type: string
            - type: 'null'
          title: Mapr Ticketfile Location
        kinit_principal:
          anyOf:
            - type: string
            - type: 'null'
          title: Kinit Principal
        kinit_keytab:
          anyOf:
            - type: string
            - type: 'null'
          title: Kinit Keytab
        kinit_password:
          anyOf:
            - type: string
            - type: 'null'
          title: Kinit Password
        inplace_iceberg_migration:
          type: boolean
          title: Inplace Iceberg Migration
          default: false
        migration_tables:
          anyOf:
            - items:
                $ref: '#/components/schemas/DataMigrationTableRow'
              type: array
            - type: 'null'
          title: Migration Tables
        metadata_tables:
          anyOf:
            - items:
                $ref: '#/components/schemas/MetadataMigrationTableRow'
              type: array
            - type: 'null'
          title: Metadata Tables
        folder_tables:
          anyOf:
            - items:
                $ref: '#/components/schemas/FolderCopyTableRow'
              type: array
            - type: 'null'
          title: Folder Tables
      type: object
      required:
        - source_format
        - migration_type
        - default_s3_bucket
        - tracking_database
        - tracking_location
        - report_output_location
      title: DataMigrationRunRequest
      description: Request to create a data migration run.
    DataMigrationRunResponse:
      properties:
        run_id:
          type: string
          format: uuid
          title: Run Id
        status:
          type: string
          title: Status
        migration_type:
          type: string
          title: Migration Type
        dag_run_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Dag Run Id
        dag_run_ids:
          items:
            type: string
          type: array
          title: Dag Run Ids
        created_at:
          type: string
          format: date-time
          title: Created At
      type: object
      required:
        - run_id
        - status
        - migration_type
        - created_at
      title: DataMigrationRunResponse
      description: Lightweight creation response.
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: A brief description of the error that occurred.
        code:
          type: integer
          title: Code
          description: The HTTP status code associated with the error.
          default: 500
      type: object
      required:
        - error
      title: ErrorResponse
    SourceFormatEnum:
      type: string
      enum:
        - mapr
        - hdfs
        - s3
      title: SourceFormatEnum
    MigrationTypeEnum:
      type: string
      enum:
        - file_only
        - data_hive_to_hive
        - data_hive_to_iceberg
        - metadata_hive_to_iceberg
      title: MigrationTypeEnum
    DataMigrationTableRow:
      properties:
        database:
          type: string
          title: Database
        table:
          type: string
          title: Table
          default: '*'
        dest_database:
          anyOf:
            - type: string
            - type: 'null'
          title: Dest Database
        bucket:
          anyOf:
            - type: string
            - type: 'null'
          title: Bucket
        endpoint:
          anyOf:
            - type: string
            - type: 'null'
          title: Endpoint
        partition_filter:
          anyOf:
            - type: string
            - type: 'null'
          title: Partition Filter
      type: object
      required:
        - database
      title: DataMigrationTableRow
      description: Row for migrating a Hive table to S3.
    MetadataMigrationTableRow:
      properties:
        database:
          type: string
          title: Database
        table:
          type: string
          title: Table
          default: '*'
        inplace_migration:
          type: boolean
          title: Inplace Migration
          default: true
        destination_iceberg_database:
          anyOf:
            - type: string
            - type: 'null'
          title: Destination Iceberg Database
      type: object
      required:
        - database
      title: MetadataMigrationTableRow
      description: Row for Hive→Iceberg metadata-only migrations.
    FolderCopyTableRow:
      properties:
        source_path:
          type: string
          title: Source Path
        target_bucket:
          type: string
          title: Target Bucket
        dest_folder:
          anyOf:
            - type: string
            - type: 'null'
          title: Dest Folder
        endpoint:
          anyOf:
            - type: string
            - type: 'null'
          title: Endpoint
      type: object
      required:
        - source_path
        - target_bucket
      title: FolderCopyTableRow
      description: Row for folder-only copy migrations.
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````