Puntos de conexión de la API de REST para máquinas de Codespaces
Usa la API de REST para administrar la disponibilidad de los tipos de máquina de un codespace.
Acerca de las máquinas de Codespaces
Puedes determinar qué tipos de máquina están disponibles para crear un codespace, ya sea en un repositorio definido o como un usuario autenticado. Para más información, consulta Cambiar el tipo de máquina de tu codespace.
También puede usar esta información cuando cambie la máquina de un codespace existente mediante la actualización de su propiedad machine. La actualización de la máquina tomará lugar la siguiente vez que el codespace se reinicie. Para más información, consulta Cambiar el tipo de máquina de tu codespace.
List available machine types for a repository
List the machine types available for a given repository based on its configuration.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Codespaces metadata" repository permissions (read)
Parámetros para "List available machine types for a repository"
| Nombre, Tipo, Descripción |
|---|
accept string Setting to |
| Nombre, Tipo, Descripción |
|---|
owner string ObligatorioThe account owner of the repository. The name is not case sensitive. |
repo string ObligatorioThe name of the repository without the |
| Nombre, Tipo, Descripción |
|---|
location string The location to check for available machines. Assigned by IP if not provided. |
client_ip string IP for location auto-detection when proxying a request |
ref string The branch or commit to check for prebuild availability and devcontainer restrictions. |
http_status_code
| status_code | Descripción |
|---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
500 | Internal Error |
code_samples
request_example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/repos/OWNER/REPO/codespaces/machinesResponse
Status: 200{
"total_count": 2,
"machines": [
{
"name": "standardLinux",
"display_name": "4 cores, 16 GB RAM, 64 GB storage",
"operating_system": "linux",
"storage_in_bytes": 68719476736,
"memory_in_bytes": 17179869184,
"cpus": 4
},
{
"name": "premiumLinux",
"display_name": "8 cores, 32 GB RAM, 64 GB storage",
"operating_system": "linux",
"storage_in_bytes": 68719476736,
"memory_in_bytes": 34359738368,
"cpus": 8
}
]
}List machine types for a codespace
List the machine types a codespace can transition to use.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
fine_grained_access
works_with_fine_grained_tokens:
permission_set:
- "Codespaces metadata" repository permissions (read)
Parámetros para "List machine types for a codespace"
| Nombre, Tipo, Descripción |
|---|
accept string Setting to |
| Nombre, Tipo, Descripción |
|---|
codespace_name string ObligatorioThe name of the codespace. |
http_status_code
| status_code | Descripción |
|---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
500 | Internal Error |
code_samples
request_example
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/user/codespaces/CODESPACE_NAME/machinesResponse
Status: 200{
"total_count": 2,
"machines": [
{
"name": "standardLinux",
"display_name": "4 cores, 16 GB RAM, 64 GB storage",
"operating_system": "linux",
"storage_in_bytes": 68719476736,
"memory_in_bytes": 17179869184,
"cpus": 4
},
{
"name": "premiumLinux",
"display_name": "8 cores, 32 GB RAM, 64 GB storage",
"operating_system": "linux",
"storage_in_bytes": 68719476736,
"memory_in_bytes": 34359738368,
"cpus": 8
}
]
}