Use the REST API to export one or more repositories so you can move them to GitHub Enterprise Server.
These endpoints are only available to authenticated organization owners. For more information, see Roles in an organization and Authenticating to the REST API.
You can use these endpoints to export one or more repositories so you can move them to a GitHub Enterprise Server instance. For more information, see Exporting migration data from GitHub.com.
Note
Most endpoints use Authorization: Bearer <YOUR-TOKEN> and Accept: application/vnd.github+json headers, plus X-GitHub-Api-Version: 2026-03-10. Curl examples below omit these standard headers for brevity.
GET /orgs/{org}/migrations
Lists the most recent migrations, including both exports (which can be started through the REST API) and imports (which cannot be started using the REST API).
A list of repositories is only returned for export migrations.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
per_page (integer)
The number of results per page (max 100). For more information, see "Using pagination in the REST API."
Default: 30
page (integer)
The page number of the results to fetch. For more information, see "Using pagination in the REST API."
Default: 1
exclude (array)
Exclude attributes from the API response to improve performance
Request:
curl -L \
-X GET \
https://api.github.com/orgs/ORG/migrations
Response schema (Status: 200):
Array of Migration:
id: required, integer, format: int64owner: required, any of:
name: string or nullemail: string or nulllogin: required, stringid: required, integer, format: int64node_id: required, stringavatar_url: required, string, format: urigravatar_id: required, string or nullurl: required, string, format: urihtml_url: required, string, format: urifollowers_url: required, string, format: urifollowing_url: required, stringgists_url: required, stringstarred_url: required, stringsubscriptions_url: required, string, format: uriorganizations_url: required, string, format: urirepos_url: required, string, format: urievents_url: required, stringreceived_events_url: required, string, format: uritype: required, stringsite_admin: required, booleanstarred_at: stringuser_view_type: stringguid: required, stringstate: required, stringlock_repositories: required, booleanexclude_metadata: required, booleanexclude_git_data: required, booleanexclude_attachments: required, booleanexclude_releases: required, booleanexclude_owner_projects: required, booleanorg_metadata_only: required, booleanrepositories: required, array of Simple Repository:
id: required, integer, format: int64node_id: required, stringname: required, stringfull_name: required, stringowner: required, Simple User (see above)private: required, booleanhtml_url: required, string, format: uridescription: required, string or nullfork: required, booleanurl: required, string, format: uriarchive_url: required, stringassignees_url: required, stringblobs_url: required, stringbranches_url: required, stringcollaborators_url: required, stringcomments_url: required, stringcommits_url: required, stringcompare_url: required, stringcontents_url: required, stringcontributors_url: required, string, format: urideployments_url: required, string, format: uridownloads_url: required, string, format: urievents_url: required, string, format: uriforks_url: required, string, format: urigit_commits_url: required, stringgit_refs_url: required, stringgit_tags_url: required, stringissue_comment_url: required, stringissue_events_url: required, stringissues_url: required, stringkeys_url: required, stringlabels_url: required, stringlanguages_url: required, string, format: urimerges_url: required, string, format: urimilestones_url: required, stringnotifications_url: required, stringpulls_url: required, stringreleases_url: required, stringstargazers_url: required, string, format: uristatuses_url: required, stringsubscribers_url: required, string, format: urisubscription_url: required, string, format: uritags_url: required, string, format: uriteams_url: required, string, format: uritrees_url: required, stringhooks_url: required, string, format: uriurl: required, string, format: uricreated_at: required, string, format: date-timeupdated_at: required, string, format: date-timenode_id: required, stringarchive_url: string, format: uriexclude: array of stringPOST /orgs/{org}/migrations
Initiates the generation of a migration archive.
accept (string)application/vnd.github+json is recommended.org (string) (required)repositories (array of strings) (required)
A list of arrays indicating which repositories should be migrated.
lock_repositories (boolean)
Indicates whether repositories should be locked (to prevent manipulation) while migrating data.
Default: false
exclude_metadata (boolean)
Indicates whether metadata should be excluded and only git source should be included for the migration.
Default: false
exclude_git_data (boolean)
Indicates whether the repository git data should be excluded from the migration.
Default: false
exclude_attachments (boolean)
Indicates whether attachments should be excluded from the migration (to reduce migration archive file size).
Default: false
exclude_releases (boolean)
Indicates whether releases should be excluded from the migration (to reduce migration archive file size).
Default: false
exclude_owner_projects (boolean)
Indicates whether projects owned by the organization or users should be excluded. from the migration.
Default: false
org_metadata_only (boolean)
Indicates whether this should only include organization metadata (repositories array should be empty and will ignore other flags).
Default: false
exclude (array of strings)
Exclude related items from being returned in the response in order to improve performance of the request.
Supported values are: repositories
201 - Created
404 - Resource not found
422 - Validation failed, or the endpoint has been spammed.
Request:
curl -L \
-X POST \
https://api.github.com/orgs/ORG/migrations \
-d '{
"repositories": [
"github/Hello-World"
],
"lock_repositories": true
}'
Response schema (Status: 201):
id: required, integer, format: int64owner: required, any of:
name: string or nullemail: string or nulllogin: required, stringid: required, integer, format: int64node_id: required, stringavatar_url: required, string, format: urigravatar_id: required, string or nullurl: required, string, format: urihtml_url: required, string, format: urifollowers_url: required, string, format: urifollowing_url: required, stringgists_url: required, stringstarred_url: required, stringsubscriptions_url: required, string, format: uriorganizations_url: required, string, format: urirepos_url: required, string, format: urievents_url: required, stringreceived_events_url: required, string, format: uritype: required, stringsite_admin: required, booleanstarred_at: stringuser_view_type: stringguid: required, stringstate: required, stringlock_repositories: required, booleanexclude_metadata: required, booleanexclude_git_data: required, booleanexclude_attachments: required, booleanexclude_releases: required, booleanexclude_owner_projects: required, booleanorg_metadata_only: required, booleanrepositories: required, array of Simple Repository:
id: required, integer, format: int64node_id: required, stringname: required, stringfull_name: required, stringowner: required, Simple User (see above)private: required, booleanhtml_url: required, string, format: uridescription: required, string or nullfork: required, booleanurl: required, string, format: uriarchive_url: required, stringassignees_url: required, stringblobs_url: required, stringbranches_url: required, stringcollaborators_url: required, stringcomments_url: required, stringcommits_url: required, stringcompare_url: required, stringcontents_url: required, stringcontributors_url: required, string, format: urideployments_url: required, string, format: uridownloads_url: required, string, format: urievents_url: required, string, format: uriforks_url: required, string, format: urigit_commits_url: required, stringgit_refs_url: required, stringgit_tags_url: required, stringissue_comment_url: required, stringissue_events_url: required, stringissues_url: required, stringkeys_url: required, stringlabels_url: required, stringlanguages_url: required, string, format: urimerges_url: required, string, format: urimilestones_url: required, stringnotifications_url: required, stringpulls_url: required, stringreleases_url: required, stringstargazers_url: required, string, format: uristatuses_url: required, stringsubscribers_url: required, string, format: urisubscription_url: required, string, format: uritags_url: required, string, format: uriteams_url: required, string, format: uritrees_url: required, stringhooks_url: required, string, format: uriurl: required, string, format: uricreated_at: required, string, format: date-timeupdated_at: required, string, format: date-timenode_id: required, stringarchive_url: string, format: uriexclude: array of stringGET /orgs/{org}/migrations/{migration_id}
Fetches the status of a migration.
The state of a migration can be one of the following values:
pending, which means the migration hasn't started yet.
exporting, which means the migration is in progress.
exported, which means the migration finished successfully.
failed, which means the migration failed.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
migration_id (integer) (required)
The unique identifier of the migration.
exclude (array)
Exclude attributes from the API response to improve performance
200 - pending, which means the migration hasn't started yet.
exporting, which means the migration is in progress.
exported, which means the migration finished successfully.
failed, which means the migration failed.
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/orgs/ORG/migrations/MIGRATION_ID
Response schema (Status: 200):
Same response schema as Start an organization migration.
GET /orgs/{org}/migrations/{migration_id}/archive
Fetches the URL to a migration archive.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
migration_id (integer) (required)
The unique identifier of the migration.
302 - Found
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/orgs/ORG/migrations/MIGRATION_ID/archive
Response schema (Status: 302):
DELETE /orgs/{org}/migrations/{migration_id}/archive
Deletes a previous migration archive. Migration archives are automatically deleted after seven days.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
migration_id (integer) (required)
The unique identifier of the migration.
204 - No Content
404 - Resource not found
Request:
curl -L \
-X DELETE \
https://api.github.com/orgs/ORG/migrations/MIGRATION_ID/archive
Response schema (Status: 204):
DELETE /orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock
Unlocks a repository that was locked for migration. You should unlock each migrated repository and delete them when the migration is complete and you no longer need the source data.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
migration_id (integer) (required)
The unique identifier of the migration.
repo_name (string) (required)
repo_name parameter
204 - No Content
404 - Resource not found
Request:
curl -L \
-X DELETE \
https://api.github.com/orgs/ORG/migrations/MIGRATION_ID/repos/REPO_NAME/lock
Response schema (Status: 204):
GET /orgs/{org}/migrations/{migration_id}/repositories
List all the repositories for this organization migration.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
migration_id (integer) (required)
The unique identifier of the migration.
per_page (integer)
The number of results per page (max 100). For more information, see "Using pagination in the REST API."
Default: 30
page (integer)
The page number of the results to fetch. For more information, see "Using pagination in the REST API."
Default: 1
200 - OK
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/orgs/ORG/migrations/MIGRATION_ID/repositories
Response schema (Status: 200):