REST API endpoints for user migrations

Use the REST API to review, backup, or migrate your user data stored on GitHub.

About user migrations

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.

List user migrations

GET /user/migrations

Lists all migrations a user has started.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X GET \
  https://api.github.com/user/migrations

Response schema (Status: 200):

Array of Migration:

Start a user migration

POST /user/migrations

Initiates the generation of a user migration archive.

Parameters

Headers

Body parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X POST \
  https://api.github.com/user/migrations \
  -d '{
  "repositories": [
    "octocat/Hello-World"
  ],
  "lock_repositories": true
}'

Response schema (Status: 201):

Get a user migration status

GET /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.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

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.

Download a user migration archive

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.

Parameters

Headers

Path and query parameters

HTTP response status codes

Delete a user migration archive

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.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X DELETE \
  https://api.github.com/user/migrations/MIGRATION_ID/archive

Response schema (Status: 204):

Unlock a user repository

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.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X DELETE \
  https://api.github.com/user/migrations/MIGRATION_ID/repos/REPO_NAME/lock

Response schema (Status: 204):

List repositories for a user migration

GET /user/migrations/{migration_id}/repositories

Lists all the repositories for this user migration.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X GET \
  https://api.github.com/user/migrations/MIGRATION_ID/repositories

Response schema (Status: 200):