Sample - GitHub REST API
POST/orgs/{org}/migrations

Start an organization migration

Starts an organization migration and initiates generation of a migration archive. Supply repositories with the repositories to migrate, or set org_metadata_only to migrate only organization metadata; optional flags control repository locking and archive contents. A 201 response returns the migration record and its current state.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

1 parameter · 9 body fields
orgstringrequired
The organization name for the migration; the name is not case sensitive.

Organization migration options, including the repositories to migrate and flags controlling repository locking, metadata, git data, attachments, releases, and projects.

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, organization owner, migration state, selected options, repository information, archive URL, and timestamps.
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 specified organization cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when the request fails validation or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 404 is returned when the specified org cannot be found. A 422 is returned when the migration request fails validation or the endpoint has been spammed. repositories is required, and exclude only accepts repositories.