POST/user/migrations

Start a migration for the authenticated user

Starts a migration for the authenticated user using the specified repositories. Set org_metadata_only to true to include only organization metadata; in this mode, repositories must be empty and other flags are ignored. A 201 response returns the created migration record.

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

9 body fields

Options for starting a migration. The repositories field is required.

lock_repositoriesbooleanoptional
Lock the repositories being migrated at the start of the migration
exclude_metadatabooleanoptional
Indicates whether metadata should be excluded and only git source should be included for the migration.
exclude_git_databooleanoptional
Indicates whether the repository git data should be excluded from the migration.
exclude_attachmentsbooleanoptional
Do not include attachments in the migration
exclude_releasesbooleanoptional
Do not include releases in the migration
exclude_owner_projectsbooleanoptional
Indicates whether projects owned by the organization or users should be excluded.
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 attributes from the API response to improve performance
repositoriesarray<string>required
Repository paths identifying the repositories to include in the migration.

5 status codes
201Returns the created migration object, including its identifier, state, repository details, and archive URL.
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"`.
304Returned when the response has not changed since the previous request.
401Returned when the request does not include valid authentication.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Returned when access to start a migration is forbidden.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when validation fails or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 401 is returned when authentication is missing or invalid; a 403 is returned when access is forbidden; a 422 is returned when validation fails or the endpoint has been spammed. The repositories body field is required, and exclude can contain only repositories; when org_metadata_only is true, repositories must be empty and other flags are ignored.