Use the REST API to review, backup, or migrate your user data stored on GitHub.
These endpoints are only available to authenticated account owners. For more information, see Authenticating to the REST API.
You can use these endpoints to review, backup, or migrate your user data stored on GitHub.com. For a list of migration data that you can download, see Download a user migration archive.
To download an archive, you'll need to start a user migration first. Once the status of the migration is exported, you can download the migration.
Once you've created a migration archive, it will be available to download for seven days. But, you can delete the user migration archive sooner if you'd like. You can unlock your repository when the migration is exported to begin using your repository again or delete the repository if you no longer need the source data.
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 /user/migrations
Lists all migrations a user has started.
accept (string)application/vnd.github+json is recommended.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
304 - Not modified
401 - Requires authentication
403 - Forbidden
Request:
curl -L \
-X GET \
https://api.github.com/user/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 /user/migrations
Initiates the generation of a user migration archive.
accept (string)application/vnd.github+json is recommended.lock_repositories (boolean)
Lock the repositories being migrated at the start of the migration
exclude_metadata (boolean)
Indicates whether metadata should be excluded and only git source should be included for the migration.
exclude_git_data (boolean)
Indicates whether the repository git data should be excluded from the migration.
exclude_attachments (boolean)
Do not include attachments in the migration
exclude_releases (boolean)
Do not include releases in the migration
exclude_owner_projects (boolean)
Indicates whether projects owned by the organization or users should be excluded.
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 attributes from the API response to improve performance
Supported values are: repositories
repositories (array of strings) (required)
201 - Created
304 - Not modified
401 - Requires authentication
403 - Forbidden
422 - Validation failed, or the endpoint has been spammed.
Request:
curl -L \
-X POST \
https://api.github.com/user/migrations \
-d '{
"repositories": [
"octocat/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 /user/migrations/{migration_id}
Fetches a single user migration. The response includes the state of the migration, which can be one of the following values:
pending - the migration hasn't started yet.
exporting - the migration is in progress.
exported - the migration finished successfully.
failed - the migration failed.
Once the migration has been exported you can download the migration archive.
accept (string)application/vnd.github+json is recommended.migration_id (integer) (required)
The unique identifier of the migration.
exclude (array)
200 - OK
304 - Not modified
401 - Requires authentication
403 - Forbidden
404 - Resource not found
Request:
curl -L \
-X GET \
https://api.github.com/user/migrations/MIGRATION_ID
Response schema (Status: 200):
Same response schema as Start a user migration.
GET /user/migrations/{migration_id}/archive
Fetches the URL to download the migration archive as a tar.gz file. Depending on the resources your repository uses, the migration archive can contain JSON files with data for these objects:
attachments
bases
commit_comments
issue_comments
issue_events
issues
milestones
organizations
projects
protected_branches
pull_request_reviews
pull_requests
releases
repositories
review_comments
schema
users
The archive will also contain an attachments directory that includes all attachment files uploaded to GitHub.com and a repositories directory that contains the repository's Git data.
accept (string)application/vnd.github+json is recommended.migration_id (integer) (required)302 - Found
304 - Not modified
401 - Requires authentication
403 - Forbidden
DELETE /user/migrations/{migration_id}/archive
Deletes a previous migration archive. Downloadable migration archives are automatically deleted after seven days. Migration metadata, which is returned in the List user migrations and Get a user migration status endpoints, will continue to be available even after an archive is deleted.
accept (string)application/vnd.github+json is recommended.migration_id (integer) (required)204 - No Content
304 - Not modified
401 - Requires authentication
403 - Forbidden
404 - Resource not found
Request:
curl -L \
-X DELETE \
https://api.github.com/user/migrations/MIGRATION_ID/archive
Response schema (Status: 204):
DELETE /user/migrations/{migration_id}/repos/{repo_name}/lock
Unlocks a repository. You can lock repositories when you start a user migration. Once the migration is complete you can unlock each repository to begin using it again or delete the repository if you no longer need the source data. Returns a status of 404 Not Found if the repository is not locked.
accept (string)application/vnd.github+json is recommended.migration_id (integer) (required)
The unique identifier of the migration.
repo_name (string) (required)
repo_name parameter
204 - No Content
304 - Not modified
401 - Requires authentication
403 - Forbidden
404 - Resource not found
Request:
curl -L \
-X DELETE \
https://api.github.com/user/migrations/MIGRATION_ID/repos/REPO_NAME/lock
Response schema (Status: 204):
GET /user/migrations/{migration_id}/repositories
Lists all the repositories for this user migration.
accept (string)application/vnd.github+json is recommended.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/user/migrations/MIGRATION_ID/repositories
Response schema (Status: 200):