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

# Create a Migration Source

> Create a source from which data can be migrated from.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/storage-data.yml post /storage/migration_sources
openapi: 3.1.0
info:
  title: Telnyx Storage & Data API
  version: 2.0.0
  description: API for Storage & Data.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /storage/migration_sources:
    post:
      tags:
        - Data Migration
      summary: Create a Migration Source
      description: Create a source from which data can be migrated from.
      operationId: CreateMigrationSource
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MigrationSourceParams'
      responses:
        '200':
          description: Create Migration Source Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/MigrationSourceParams'
          headers: {}
        '401':
          description: Unauthorized
        '422':
          description: Unprocessable Entity
      deprecated: false
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            const migrationSource = await
            client.storage.migrationSources.create({
              bucket_name: 'bucket_name',
              provider: 'aws',
              provider_auth: {},
            });


            console.log(migrationSource.data);
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            migration_source = client.storage.migration_sources.create(
                bucket_name="bucket_name",
                provider="aws",
                provider_auth={},
            )
            print(migration_source.data)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tmigrationSource, err := client.Storage.MigrationSources.New(context.TODO(), telnyx.StorageMigrationSourceNewParams{\n\t\tMigrationSourceParams: telnyx.MigrationSourceParams{\n\t\t\tBucketName:   \"bucket_name\",\n\t\t\tProvider:     telnyx.MigrationSourceParamsProviderAws,\n\t\t\tProviderAuth: telnyx.MigrationSourceParamsProviderAuth{},\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", migrationSource.Data)\n}\n"
        - lang: Java
          source: >-
            package com.telnyx.sdk.example;


            import com.telnyx.sdk.client.TelnyxClient;

            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            import
            com.telnyx.sdk.models.storage.migrationsources.MigrationSourceCreateResponse;

            import
            com.telnyx.sdk.models.storage.migrationsources.MigrationSourceParams;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    MigrationSourceParams params = MigrationSourceParams.builder()
                        .bucketName("bucket_name")
                        .provider(MigrationSourceParams.Provider.AWS)
                        .providerAuth(MigrationSourceParams.ProviderAuth.builder().build())
                        .build();
                    MigrationSourceCreateResponse migrationSource = client.storage().migrationSources().create(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


            telnyx = Telnyx::Client.new(api_key: "My API Key")


            migration_source =
            telnyx.storage.migration_sources.create(bucket_name: "bucket_name",
            provider: :aws, provider_auth: {})


            puts(migration_source)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $migrationSource = $client->storage->migrationSources->create(
                bucketName: 'bucket_name',
                provider: 'aws',
                providerAuth: [
                  'accessKey' => 'access_key', 'secretAccessKey' => 'secret_access_key'
                ],
                sourceRegion: 'source_region',
              );

              var_dump($migrationSource);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx storage:migration-sources create \
              --api-key 'My API Key' \
              --bucket-name bucket_name \
              --provider aws \
              --provider-auth '{}'
components:
  schemas:
    MigrationSourceParams:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the data migration source.
          readOnly: true
        provider:
          type: string
          enum:
            - aws
            - telnyx
          description: >-
            Cloud provider from which to migrate data. Use 'telnyx' if you want
            to migrate data from one Telnyx bucket to another.
        source_region:
          type: string
          description: >-
            For intra-Telnyx buckets migration, specify the source bucket region
            in this field.
        provider_auth:
          type: object
          properties:
            access_key:
              type: string
              description: >-
                AWS Access Key. For Telnyx-to-Telnyx migrations, use your Telnyx
                API key here.
            secret_access_key:
              type: string
              description: >-
                AWS Secret Access Key. For Telnyx-to-Telnyx migrations, use your
                Telnyx API key here as well.
        bucket_name:
          type: string
          description: Bucket name to migrate the data from.
      required:
        - provider
        - provider_auth
        - bucket_name
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````