{"meta":{"title":"Points de terminaison d’API REST pour les ordinateurs Codespaces","intro":"Utilisez l’API REST pour gérer la disponibilité des types d’ordinateurs pour un codespace.","product":"API REST","breadcrumbs":[{"href":"/fr/rest","title":"API REST"},{"href":"/fr/rest/codespaces","title":"Codespaces"},{"href":"/fr/rest/codespaces/machines","title":"Virtuelles"}],"documentType":"article"},"body":"# Points de terminaison d’API REST pour les ordinateurs Codespaces\n\nUtilisez l’API REST pour gérer la disponibilité des types d’ordinateurs pour un codespace.\n\n## À propos des ordinateurs Codespaces\n\nVous pouvez déterminer quels types d’ordinateur sont disponibles pour créer un codespace, soit sur un dépôt donné, soit en tant qu’utilisateur authentifié. Pour plus d’informations, consultez « [Modification du type de machine pour votre espace de code](/fr/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace#about-machine-types) ».\n\nVous pouvez également utiliser ces informations lors de la modification de la machine d’un espace de code existant en mettant à jour sa propriété `machine`. La mise à jour de la machine aura lieu la prochaine fois que l’espace de code est redémarré. Pour plus d’informations, consultez « [Modification du type de machine pour votre espace de code](/fr/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace) ».\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 available machine types for a repository\n\n```\nGET /repos/{owner}/{repo}/codespaces/machines\n```\n\nList the machine types available for a given repository based on its configuration.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\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* **`owner`** (string) (required)\n  The account owner of the repository. The name is not case sensitive.\n\n* **`repo`** (string) (required)\n  The name of the repository without the .git extension. The name is not case sensitive.\n\n* **`location`** (string)\n  The location to check for available machines. Assigned by IP if not provided.\n\n* **`client_ip`** (string)\n  IP for location auto-detection when proxying a request\n\n* **`ref`** (string)\n  The branch or commit to check for prebuild availability and devcontainer restrictions.\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* **500** - Internal Error\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/repos/OWNER/REPO/codespaces/machines\n```\n\n**Response schema (Status: 200):**\n\n* `total_count`: required, integer\n* `machines`: required, array of `Codespace machine`:\n  * `name`: required, string\n  * `display_name`: required, string\n  * `operating_system`: required, string\n  * `storage_in_bytes`: required, integer\n  * `memory_in_bytes`: required, integer\n  * `cpus`: required, integer\n  * `prebuild_availability`: required, string or null, enum: `none`, `ready`, `in_progress`, `null`\n\n## List machine types for a codespace\n\n```\nGET /user/codespaces/{codespace_name}/machines\n```\n\nList the machine types a codespace can transition to use.\nOAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.\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* **`codespace_name`** (string) (required)\n  The name of the codespace.\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* **500** - Internal Error\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/user/codespaces/CODESPACE_NAME/machines\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [List available machine types for a repository](#list-available-machine-types-for-a-repository)."}