POST/orgs/{org}/migrations

Start an organization migration

Starts an organization migration to generate a migration archive. Supply repositories to select the repositories to include; the other boolean options default to false when omitted. Set org_metadata_only to true and provide an empty repositories list to include only organization metadata; a 201 response returns the migration record.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 parameter · 9 body fields
orgstringrequired
The organization name. The name is not case sensitive.

Organization migration options. Provide repositories; all boolean options default to false when omitted.

repositoriesarray<string>required
A list of arrays indicating which repositories should be migrated.
lock_repositoriesbooleanoptional
Indicates whether repositories should be locked (to prevent manipulation) while migrating data.
Default:false
exclude_metadatabooleanoptional
Indicates whether metadata should be excluded and only git source should be included for the migration.
Default:false
exclude_git_databooleanoptional
Indicates whether the repository git data should be excluded from the migration.
Default:false
exclude_attachmentsbooleanoptional
Indicates whether attachments should be excluded from the migration (to reduce migration archive file size).
Default:false
exclude_releasesbooleanoptional
Indicates whether releases should be excluded from the migration (to reduce migration archive file size).
Default:false
exclude_owner_projectsbooleanoptional
Indicates whether projects owned by the organization or users should be excluded. from the migration.
Default:false
org_metadata_onlybooleanoptional
Indicates whether this should only include organization metadata (repositories array should be empty and will ignore other flags).
Default:false
excludearray<string>optional
Exclude related items from being returned in the response in order to improve performance of the request.

3 status codes
201Returns the created migration record, including its identifier, state, archive URL, timestamps, and included repositories.
idintegerrequired
ownerobjectrequired
A GitHub user.
guidstringrequired
statestringrequired
lock_repositoriesbooleanrequired
exclude_metadatabooleanrequired
exclude_git_databooleanrequired
exclude_attachmentsbooleanrequired
exclude_releasesbooleanrequired
exclude_owner_projectsbooleanrequired
org_metadata_onlybooleanrequired
repositoriesarray<Repository>required
The repositories included in the migration. Only returned for export migrations.
urlstringrequired
created_atstringrequired
updated_atstringrequired
node_idstringrequired
archive_urlstringoptional
excludearray<string>optional
Exclude related items from being returned in the response in order to improve performance of the request. The array can include any of: `"repositories"`.
404Returned when the organization or another requested resource cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when validation fails or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 404 is returned when the org path parameter does not identify a resource. A 422 is returned when validation fails or the endpoint has been spammed. repositories is required; when org_metadata_only is true, repositories must be empty.