Skip to main content
The REST API is now versioned. For more information, see "About API versioning".

Computadores codespaces

A API de computadores codespaces permite que um usuário determine quais tipos de computadores estão disponíveis para criar um codespace, seja em um determinado repositório ou como um usuário autenticado.

Sobre a API de computadores codespaces

A API de computadores codespaces permite que um usuário determine quais tipos de computadores estão disponíveis para criar um codespace, seja em um determinado repositório ou como um usuário autenticado. Para obter mais informações, confira "Sobre os tipos de computadores".

Use também essas informações ao alterar o computador de um codespace existente atualizando a propriedade machine. A atualização da máquina ocorrerá na próxima vez que o codespace for reiniciado. Para obter mais informações, confira "Como alterar o tipo de computador para seu codespace".

List available machine types for a repository

Works with GitHub Apps

List the machine types available for a given repository based on its configuration.

You must authenticate using an access token with the codespace scope to use this endpoint.

GitHub Apps must have write access to the codespaces_metadata repository permission to use this endpoint.

Parameters

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
ownerstringRequired

The account owner of the repository. The name is not case sensitive.

repostringRequired

The name of the repository. The name is not case sensitive.

Query parameters
Name, Type, Description
locationstring

The location to check for available machines. Assigned by IP if not provided.

client_ipstring

IP for location auto-detection when proxying a request

HTTP response status codes

Status codeDescription
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

500

Internal Error

Code samples

get/repos/{owner}/{repo}/codespaces/machines
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://api.github.com/repos/OWNER/REPO/codespaces/machines

Response

Status: 200
{ "total_count": 2, "machines": [ { "name": "standardLinux", "display_name": "4 cores, 8 GB RAM, 64 GB storage", "operating_system": "linux", "storage_in_bytes": 68719476736, "memory_in_bytes": 8589934592, "cpus": 4 }, { "name": "premiumLinux", "display_name": "8 cores, 16 GB RAM, 64 GB storage", "operating_system": "linux", "storage_in_bytes": 68719476736, "memory_in_bytes": 17179869184, "cpus": 8 } ] }

List machine types for a codespace

List the machine types a codespace can transition to use.

You must authenticate using an access token with the codespace scope to use this endpoint.

GitHub Apps must have read access to the codespaces_metadata repository permission to use this endpoint.

Parameters

Headers
Name, Type, Description
acceptstring

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
codespace_namestringRequired

The name of the codespace.

HTTP response status codes

Status codeDescription
200

OK

304

Not modified

401

Requires authentication

403

Forbidden

404

Resource not found

500

Internal Error

Code samples

get/user/codespaces/{codespace_name}/machines
curl \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ https://api.github.com/user/codespaces/CODESPACE_NAME/machines

Response

Status: 200
{ "total_count": 2, "machines": [ { "name": "standardLinux", "display_name": "4 cores, 8 GB RAM, 64 GB storage", "operating_system": "linux", "storage_in_bytes": 68719476736, "memory_in_bytes": 8589934592, "cpus": 4 }, { "name": "premiumLinux", "display_name": "8 cores, 16 GB RAM, 64 GB storage", "operating_system": "linux", "storage_in_bytes": 68719476736, "memory_in_bytes": 17179869184, "cpus": 8 } ] }