| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Use the REST API to manage GitHub Codespaces.
You can manage Codespaces using the REST API. These endpoints are available for authenticated users, OAuth apps, and GitHub Apps. For more information, see Codespaces documentation.
Lists the codespaces associated to a specified repository and the authenticated user.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
owner string Required The account owner of the repository. The name is not case sensitive. |
repo string Required The name of the repository without the .git extension. The name is not case sensitive. |
| Name, Type, Description |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: 30 |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: 1 |
| Status code | Description |
|---|---|
| 200 | OK |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
| 500 | Internal Error |
Response
Creates a codespace owned by the authenticated user in the specified repository.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
owner string Required The account owner of the repository. The name is not case sensitive. |
repo string Required The name of the repository without the .git extension. The name is not case sensitive. |
| Name, Type, Description |
|---|
ref string Git ref (typically a branch name) for this codespace |
location string The requested location for a new codespace. Best efforts are made to respect this upon creation. Assigned by IP if not provided. |
geo string The geographic area for this codespace. If not specified, the value is assigned by IP. This property replaces location, which is closing down. Can be one of: EuropeWest, SoutheastAsia, UsEast, UsWest |
client_ip string IP for location auto-detection when proxying a request |
machine string Machine type to use for this codespace |
devcontainer_path string Path to devcontainer.json config to use for this codespace |
multi_repo_permissions_opt_out boolean Whether to authorize requested permissions from devcontainer.json |
working_directory string Working directory for this codespace |
idle_timeout_minutes integer Time in minutes before codespace stops from inactivity |
display_name string Display name for this codespace |
retention_period_minutes integer Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days). |
| Status code | Description |
|---|---|
| 201 | Response when the codespace was successfully created |
| 202 | Response when the codespace creation partially failed but is being retried in the background |
| 400 | Bad Request |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
| 503 | Service unavailable |
Response when the codespace was successfully created
Lists the devcontainer.json files associated with a specified repository and the authenticated user. These files specify launchpoint configurations for codespaces created within the repository.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
owner string Required The account owner of the repository. The name is not case sensitive. |
repo string Required The name of the repository without the .git extension. The name is not case sensitive. |
| Name, Type, Description |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: 30 |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: 1 |
| Status code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
| 500 | Internal Error |
Response
Gets the default attributes for codespaces created by the user with the repository.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
owner string Required The account owner of the repository. The name is not case sensitive. |
repo string Required The name of the repository without the .git extension. The name is not case sensitive. |
| Name, Type, Description |
|---|
ref string The branch or commit to check for a default devcontainer path. If not specified, the default branch will be checked. |
client_ip string An alternative IP for default location auto-detection, such as when proxying a request. |
| Status code | Description |
|---|---|
| 200 | Response when a user is able to create codespaces from the repository. |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
Response when a user is able to create codespaces from the repository.
Checks whether the permissions defined by a given devcontainer configuration have been accepted by the authenticated user.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
owner string Required The account owner of the repository. The name is not case sensitive. |
repo string Required The name of the repository without the .git extension. The name is not case sensitive. |
| Name, Type, Description |
|---|
ref string Required The git reference that points to the location of the devcontainer configuration to use for the permission check. The value of ref will typically be a branch name (heads/BRANCH_NAME). For more information, see "Git References" in the Git documentation. |
devcontainer_path string Required Path to the devcontainer.json configuration to use for the permission check. |
| Status code | Description |
|---|---|
| 200 | Response when the permission check is successful |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
| 422 | Validation failed, or the endpoint has been spammed. |
| 503 | Service unavailable |
Response when the permission check is successful
Creates a codespace owned by the authenticated user for the specified pull request.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
owner string Required The account owner of the repository. The name is not case sensitive. |
repo string Required The name of the repository without the .git extension. The name is not case sensitive. |
pull_number integer Required The number that identifies the pull request. |
| Name, Type, Description |
|---|
location string The requested location for a new codespace. Best efforts are made to respect this upon creation. Assigned by IP if not provided. |
geo string The geographic area for this codespace. If not specified, the value is assigned by IP. This property replaces location, which is closing down. Can be one of: EuropeWest, SoutheastAsia, UsEast, UsWest |
client_ip string IP for location auto-detection when proxying a request |
machine string Machine type to use for this codespace |
devcontainer_path string Path to devcontainer.json config to use for this codespace |
multi_repo_permissions_opt_out boolean Whether to authorize requested permissions from devcontainer.json |
working_directory string Working directory for this codespace |
idle_timeout_minutes integer Time in minutes before codespace stops from inactivity |
display_name string Display name for this codespace |
retention_period_minutes integer Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days). |
| Status code | Description |
|---|---|
| 201 | Response when the codespace was successfully created |
| 202 | Response when the codespace creation partially failed but is being retried in the background |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
| 503 | Service unavailable |
Response when the codespace was successfully created
Lists the authenticated user's codespaces.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
This endpoint can be used without authentication or the aforementioned permissions if only public resources are requested.
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: 30 |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: 1 |
repository_id integer ID of the Repository to filter on |
| Status code | Description |
|---|---|
| 200 | OK |
| 304 | Not modified |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
| 500 | Internal Error |
Response
Creates a new codespace, owned by the authenticated user.
This endpoint requires either a repository_id OR a pull_request but not both.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description | |||
|---|---|---|---|
repository_id integer Required Repository id for this codespace | |||
ref string Git ref (typically a branch name) for this codespace | |||
location string The requested location for a new codespace. Best efforts are made to respect this upon creation. Assigned by IP if not provided. | |||
geo string The geographic area for this codespace. If not specified, the value is assigned by IP. This property replaces location, which is closing down. Can be one of: EuropeWest, SoutheastAsia, UsEast, UsWest | |||
client_ip string IP for location auto-detection when proxying a request | |||
machine string Machine type to use for this codespace | |||
devcontainer_path string Path to devcontainer.json config to use for this codespace | |||
multi_repo_permissions_opt_out boolean Whether to authorize requested permissions from devcontainer.json | |||
working_directory string Working directory for this codespace | |||
idle_timeout_minutes integer Time in minutes before codespace stops from inactivity | |||
display_name string Display name for this codespace | |||
retention_period_minutes integer Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days). | |||
pull_request object Required Pull request number for this codespace | |||
Properties of pull_request
|
| Status code | Description |
|---|---|
| 201 | Response when the codespace was successfully created |
| 202 | Response when the codespace creation partially failed but is being retried in the background |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
| 503 | Service unavailable |
Response when the codespace was successfully created
Gets information about a user's codespace.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
codespace_name string Required The name of the codespace. |
| Status code | Description |
|---|---|
| 200 | OK |
| 304 | Not modified |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
| 500 | Internal Error |
Response
Updates a codespace owned by the authenticated user. Currently only the codespace's machine type and recent folders can be modified using this endpoint.
If you specify a new machine type it will be applied the next time your codespace is started.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
codespace_name string Required The name of the codespace. |
| Name, Type, Description |
|---|
machine string A valid machine to transition this codespace to. |
display_name string Display name for this codespace |
recent_folders array of strings Recently opened folders inside the codespace. It is currently used by the clients to determine the folder path to load the codespace in. |
| Status code | Description |
|---|---|
| 200 | OK |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
Response
Deletes a user's codespace.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
codespace_name string Required The name of the codespace. |
| Status code | Description |
|---|---|
| 202 | Accepted |
| 304 | Not modified |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
| 500 | Internal Error |
Accepted
Triggers an export of the specified codespace and returns a URL and ID where the status of the export can be monitored.
If changes cannot be pushed to the codespace's repository, they will be pushed to a new or previously-existing fork instead.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
codespace_name string Required The name of the codespace. |
| Status code | Description |
|---|---|
| 202 | Accepted |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
| 422 | Validation failed, or the endpoint has been spammed. |
| 500 | Internal Error |
Response
Gets information about an export of a codespace.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
codespace_name string Required The name of the codespace. |
export_id string Required The ID of the export operation, or latest. Currently only latest is currently supported. |
| Status code | Description |
|---|---|
| 200 | OK |
| 404 | Resource not found |
Response
Publishes an unpublished codespace, creating a new repository and assigning it to the codespace.
The codespace's token is granted write permissions to the repository, allowing the user to push their changes.
This will fail for a codespace that is already published, meaning it has an associated repository.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
codespace_name string Required The name of the codespace. |
| Name, Type, Description |
|---|
name string A name for the new repository. |
private boolean Whether the new repository should be private. Default: false |
| Status code | Description |
|---|---|
| 201 | Created |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
| 422 | Validation failed, or the endpoint has been spammed. |
Response
Starts a user's codespace.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
codespace_name string Required The name of the codespace. |
| Status code | Description |
|---|---|
| 200 | OK |
| 304 | Not modified |
| 400 | Bad Request |
| 401 | Requires authentication |
| 402 | Payment required |
| 403 | Forbidden |
| 404 | Resource not found |
| 409 | Conflict |
| 500 | Internal Error |
Response
Stops a user's codespace.
OAuth app tokens and personal access tokens (classic) need the codespace scope to use this endpoint.
This endpoint works with the following fine-grained token types:
The fine-grained token must have the following permission set:
| Name, Type, Description |
|---|
accept string Setting to application/vnd.github+json is recommended. |
| Name, Type, Description |
|---|
codespace_name string Required The name of the codespace. |
| Status code | Description |
|---|---|
| 200 | OK |
| 401 | Requires authentication |
| 403 | Forbidden |
| 404 | Resource not found |
| 500 | Internal Error |
Response
| Back | FazBrowse Home | New Git URL |