{"meta":{"title":"Points de terminaison d’API REST pour les migrations d’utilisateur","intro":"Utilisez l’API REST pour passer en revue, sauvegarder ou migrer vos données utilisateur stockées sur GitHub.","product":"API REST","breadcrumbs":[{"href":"/fr/rest","title":"API REST"},{"href":"/fr/rest/migrations","title":"Migrations"},{"href":"/fr/rest/migrations/users","title":"Utilisateurs"}],"documentType":"article"},"body":"# Points de terminaison d’API REST pour les migrations d’utilisateur\n\nUtilisez l’API REST pour passer en revue, sauvegarder ou migrer vos données utilisateur stockées sur GitHub.\n\n## À propos des migrations d’utilisateurs\n\nCes points de terminaison sont disponibles uniquement pour les propriétaires de comptes authentifiés. Pour plus d’informations, consultez « [Authentification auprès de l’API REST](/fr/rest/authentication/authenticating-to-the-rest-api) ».\n\nVous pouvez utiliser ces points de terminaison pour passer en revue, sauvegarder ou migrer vos données utilisateur stockées sur GitHub.com. Pour obtenir la liste des données de migration que vous pouvez télécharger, consultez [Télécharger une archive de migration utilisateur](#download-a-user-migration-archive).\n\nPour télécharger une archive, vous devez commencer par démarrer une migration d’utilisateur. Une fois que le statut de la migration est `exported`, vous pouvez télécharger la migration.\n\nUne fois que vous aurez créé une archive de migration, celle-ci sera disponible pour le téléchargement pendant sept jours. Toutefois, vous pouvez supprimer l’archive de migration d’utilisateur plus tôt si vous le souhaitez. Vous pouvez déverrouiller votre dépôt quand la migration est `exported` afin de recommencer à utiliser votre dépôt ou de le supprimer si vous n’avez plus besoin des données sources.\n\n> \\[!NOTE]\n> 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.\n\n## List user migrations\n\n```\nGET /user/migrations\n```\n\nLists all migrations a user has started.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n* **`page`** (integer)\n  The page number of the results to fetch. For more information, see \"Using pagination in the REST API.\"\n  Default: `1`\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/user/migrations\n```\n\n**Response schema (Status: 200):**\n\nArray of `Migration`:\n\n* `id`: required, integer, format: int64\n* `owner`: required, any of:\n  * **null**\n  * **Simple User**\n    * `name`: string or null\n    * `email`: string or null\n    * `login`: required, string\n    * `id`: required, integer, format: int64\n    * `node_id`: required, string\n    * `avatar_url`: required, string, format: uri\n    * `gravatar_id`: required, string or null\n    * `url`: required, string, format: uri\n    * `html_url`: required, string, format: uri\n    * `followers_url`: required, string, format: uri\n    * `following_url`: required, string\n    * `gists_url`: required, string\n    * `starred_url`: required, string\n    * `subscriptions_url`: required, string, format: uri\n    * `organizations_url`: required, string, format: uri\n    * `repos_url`: required, string, format: uri\n    * `events_url`: required, string\n    * `received_events_url`: required, string, format: uri\n    * `type`: required, string\n    * `site_admin`: required, boolean\n    * `starred_at`: string\n    * `user_view_type`: string\n* `guid`: required, string\n* `state`: required, string\n* `lock_repositories`: required, boolean\n* `exclude_metadata`: required, boolean\n* `exclude_git_data`: required, boolean\n* `exclude_attachments`: required, boolean\n* `exclude_releases`: required, boolean\n* `exclude_owner_projects`: required, boolean\n* `org_metadata_only`: required, boolean\n* `repositories`: required, array of `Simple Repository`:\n  * `id`: required, integer, format: int64\n  * `node_id`: required, string\n  * `name`: required, string\n  * `full_name`: required, string\n  * `owner`: required, `Simple User` (see above)\n  * `private`: required, boolean\n  * `html_url`: required, string, format: uri\n  * `description`: required, string or null\n  * `fork`: required, boolean\n  * `url`: required, string, format: uri\n  * `archive_url`: required, string\n  * `assignees_url`: required, string\n  * `blobs_url`: required, string\n  * `branches_url`: required, string\n  * `collaborators_url`: required, string\n  * `comments_url`: required, string\n  * `commits_url`: required, string\n  * `compare_url`: required, string\n  * `contents_url`: required, string\n  * `contributors_url`: required, string, format: uri\n  * `deployments_url`: required, string, format: uri\n  * `downloads_url`: required, string, format: uri\n  * `events_url`: required, string, format: uri\n  * `forks_url`: required, string, format: uri\n  * `git_commits_url`: required, string\n  * `git_refs_url`: required, string\n  * `git_tags_url`: required, string\n  * `issue_comment_url`: required, string\n  * `issue_events_url`: required, string\n  * `issues_url`: required, string\n  * `keys_url`: required, string\n  * `labels_url`: required, string\n  * `languages_url`: required, string, format: uri\n  * `merges_url`: required, string, format: uri\n  * `milestones_url`: required, string\n  * `notifications_url`: required, string\n  * `pulls_url`: required, string\n  * `releases_url`: required, string\n  * `stargazers_url`: required, string, format: uri\n  * `statuses_url`: required, string\n  * `subscribers_url`: required, string, format: uri\n  * `subscription_url`: required, string, format: uri\n  * `tags_url`: required, string, format: uri\n  * `teams_url`: required, string, format: uri\n  * `trees_url`: required, string\n  * `hooks_url`: required, string, format: uri\n* `url`: required, string, format: uri\n* `created_at`: required, string, format: date-time\n* `updated_at`: required, string, format: date-time\n* `node_id`: required, string\n* `archive_url`: string, format: uri\n* `exclude`: array of string\n\n## Start a user migration\n\n```\nPOST /user/migrations\n```\n\nInitiates the generation of a user migration archive.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Body parameters\n\n* **`lock_repositories`** (boolean)\n  Lock the repositories being migrated at the start of the migration\n\n* **`exclude_metadata`** (boolean)\n  Indicates whether metadata should be excluded and only git source should be included for the migration.\n\n* **`exclude_git_data`** (boolean)\n  Indicates whether the repository git data should be excluded from the migration.\n\n* **`exclude_attachments`** (boolean)\n  Do not include attachments in the migration\n\n* **`exclude_releases`** (boolean)\n  Do not include releases in the migration\n\n* **`exclude_owner_projects`** (boolean)\n  Indicates whether projects owned by the organization or users should be excluded.\n\n* **`org_metadata_only`** (boolean)\n  Indicates whether this should only include organization metadata (repositories array should be empty and will ignore other flags).\n  Default: `false`\n\n* **`exclude`** (array of strings)\n  Exclude attributes from the API response to improve performance\n  Supported values are: repositories\n\n* **`repositories`** (array of strings) (required)\n\n### HTTP response status codes\n\n* **201** - Created\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **422** - Validation failed, or the endpoint has been spammed.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X POST \\\n  https://api.github.com/user/migrations \\\n  -d '{\n  \"repositories\": [\n    \"octocat/Hello-World\"\n  ],\n  \"lock_repositories\": true\n}'\n```\n\n**Response schema (Status: 201):**\n\n* `id`: required, integer, format: int64\n* `owner`: required, any of:\n  * **null**\n  * **Simple User**\n    * `name`: string or null\n    * `email`: string or null\n    * `login`: required, string\n    * `id`: required, integer, format: int64\n    * `node_id`: required, string\n    * `avatar_url`: required, string, format: uri\n    * `gravatar_id`: required, string or null\n    * `url`: required, string, format: uri\n    * `html_url`: required, string, format: uri\n    * `followers_url`: required, string, format: uri\n    * `following_url`: required, string\n    * `gists_url`: required, string\n    * `starred_url`: required, string\n    * `subscriptions_url`: required, string, format: uri\n    * `organizations_url`: required, string, format: uri\n    * `repos_url`: required, string, format: uri\n    * `events_url`: required, string\n    * `received_events_url`: required, string, format: uri\n    * `type`: required, string\n    * `site_admin`: required, boolean\n    * `starred_at`: string\n    * `user_view_type`: string\n* `guid`: required, string\n* `state`: required, string\n* `lock_repositories`: required, boolean\n* `exclude_metadata`: required, boolean\n* `exclude_git_data`: required, boolean\n* `exclude_attachments`: required, boolean\n* `exclude_releases`: required, boolean\n* `exclude_owner_projects`: required, boolean\n* `org_metadata_only`: required, boolean\n* `repositories`: required, array of `Simple Repository`:\n  * `id`: required, integer, format: int64\n  * `node_id`: required, string\n  * `name`: required, string\n  * `full_name`: required, string\n  * `owner`: required, `Simple User` (see above)\n  * `private`: required, boolean\n  * `html_url`: required, string, format: uri\n  * `description`: required, string or null\n  * `fork`: required, boolean\n  * `url`: required, string, format: uri\n  * `archive_url`: required, string\n  * `assignees_url`: required, string\n  * `blobs_url`: required, string\n  * `branches_url`: required, string\n  * `collaborators_url`: required, string\n  * `comments_url`: required, string\n  * `commits_url`: required, string\n  * `compare_url`: required, string\n  * `contents_url`: required, string\n  * `contributors_url`: required, string, format: uri\n  * `deployments_url`: required, string, format: uri\n  * `downloads_url`: required, string, format: uri\n  * `events_url`: required, string, format: uri\n  * `forks_url`: required, string, format: uri\n  * `git_commits_url`: required, string\n  * `git_refs_url`: required, string\n  * `git_tags_url`: required, string\n  * `issue_comment_url`: required, string\n  * `issue_events_url`: required, string\n  * `issues_url`: required, string\n  * `keys_url`: required, string\n  * `labels_url`: required, string\n  * `languages_url`: required, string, format: uri\n  * `merges_url`: required, string, format: uri\n  * `milestones_url`: required, string\n  * `notifications_url`: required, string\n  * `pulls_url`: required, string\n  * `releases_url`: required, string\n  * `stargazers_url`: required, string, format: uri\n  * `statuses_url`: required, string\n  * `subscribers_url`: required, string, format: uri\n  * `subscription_url`: required, string, format: uri\n  * `tags_url`: required, string, format: uri\n  * `teams_url`: required, string, format: uri\n  * `trees_url`: required, string\n  * `hooks_url`: required, string, format: uri\n* `url`: required, string, format: uri\n* `created_at`: required, string, format: date-time\n* `updated_at`: required, string, format: date-time\n* `node_id`: required, string\n* `archive_url`: string, format: uri\n* `exclude`: array of string\n\n## Get a user migration status\n\n```\nGET /user/migrations/{migration_id}\n```\n\nFetches a single user migration. The response includes the state of the migration, which can be one of the following values:\n\npending - the migration hasn't started yet.\nexporting - the migration is in progress.\nexported - the migration finished successfully.\nfailed - the migration failed.\n\nOnce the migration has been exported you can download the migration archive.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`migration_id`** (integer) (required)\n  The unique identifier of the migration.\n\n* **`exclude`** (array)\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/user/migrations/MIGRATION_ID\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Start a user migration](#start-a-user-migration).\n\n## Download a user migration archive\n\n```\nGET /user/migrations/{migration_id}/archive\n```\n\nFetches 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:\n\nattachments\nbases\ncommit\\_comments\nissue\\_comments\nissue\\_events\nissues\nmilestones\norganizations\nprojects\nprotected\\_branches\npull\\_request\\_reviews\npull\\_requests\nreleases\nrepositories\nreview\\_comments\nschema\nusers\n\nThe 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.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`migration_id`** (integer) (required)\n  The unique identifier of the migration.\n\n### HTTP response status codes\n\n* **302** - Found\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n## Delete a user migration archive\n\n```\nDELETE /user/migrations/{migration_id}/archive\n```\n\nDeletes 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.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`migration_id`** (integer) (required)\n  The unique identifier of the migration.\n\n### HTTP response status codes\n\n* **204** - No Content\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/user/migrations/MIGRATION_ID/archive\n```\n\n**Response schema (Status: 204):**\n\n## Unlock a user repository\n\n```\nDELETE /user/migrations/{migration_id}/repos/{repo_name}/lock\n```\n\nUnlocks 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.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`migration_id`** (integer) (required)\n  The unique identifier of the migration.\n\n* **`repo_name`** (string) (required)\n  repo\\_name parameter\n\n### HTTP response status codes\n\n* **204** - No Content\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/user/migrations/MIGRATION_ID/repos/REPO_NAME/lock\n```\n\n**Response schema (Status: 204):**\n\n## List repositories for a user migration\n\n```\nGET /user/migrations/{migration_id}/repositories\n```\n\nLists all the repositories for this user migration.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`migration_id`** (integer) (required)\n  The unique identifier of the migration.\n\n* **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n* **`page`** (integer)\n  The page number of the results to fetch. For more information, see \"Using pagination in the REST API.\"\n  Default: `1`\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/user/migrations/MIGRATION_ID/repositories\n```\n\n**Response schema (Status: 200):**"}