{"meta":{"title":"REST API endpoints for Codespaces machines","intro":"Use the REST API to manage availability of machine types for a codespace.","product":"REST API","breadcrumbs":[{"href":"/en/rest","title":"REST API"},{"href":"/en/rest/codespaces","title":"Codespaces"},{"href":"/en/rest/codespaces/machines","title":"Machines"}],"documentType":"article"},"body":"# REST API endpoints for Codespaces machines\n\nUse the REST API to manage availability of machine types for a codespace.\n\n## About Codespaces machines\n\nYou can determine which machine types are available to create a codespace, either on a given repository or as an authenticated user. For more information, see [Changing the machine type for your codespace](/en/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace#about-machine-types).\n\nYou can also use this information when changing the machine of an existing codespace by updating its `machine` property. The machine update will take place the next time the codespace is restarted. For more information, see [Changing the machine type for your codespace](/en/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)."}