PATCH
/user/codespaces/{codespace_name}Update a codespace for the authenticated user
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.
- RetriesRetries up to 2×, 500ms backoff, 30s timeout.
codespace_namestringrequired
The name of the codespace.
machinestringoptional
A valid machine to transition this codespace to.
display_namestringoptional
Display name for this codespace
recent_foldersarray<string>optional
Recently opened folders inside the codespace. It is currently used by the clients to determine the folder path to load the codespace in.
200Response
idintegerrequired
namestringrequired
Automatically generated name of this codespace.
display_namestringoptional
Display name for this codespace.
environment_idstringrequired
UUID identifying this codespace's environment.
ownerobjectrequired
A GitHub user.
billable_ownerobjectrequired
A GitHub user.
repositoryobjectrequired
Minimal Repository
machineobjectrequired
A description of the machine powering a codespace.
devcontainer_pathstringoptional
Path to devcontainer.json from repo root used to create Codespace.
prebuildbooleanrequired
Whether the codespace was created from a prebuild.
created_atstringrequired
updated_atstringrequired
last_used_atstringrequired
Last known time this codespace was started.
statestringrequired
State of this codespace.
urlstringrequired
API URL for this codespace.
git_statusobjectrequired
Details about the codespace's git repository.
locationstringrequired
The initally assigned location of a new codespace.
idle_timeout_minutesintegerrequired
The number of minutes of inactivity after which this codespace will be automatically stopped.
web_urlstringrequired
URL to access this codespace on the web.
machines_urlstringrequired
API URL to access available alternate machine types for this codespace.
start_urlstringrequired
API URL to start this codespace.
stop_urlstringrequired
API URL to stop this codespace.
publish_urlstringoptional
API URL to publish this codespace to a new repository.
pulls_urlstringrequired
API URL for the Pull Request associated with this codespace, if any.
recent_foldersarray<string>required
runtime_constraintsobjectoptional
pending_operationbooleanoptional
Whether or not a codespace has a pending async operation. This would mean that the codespace is temporarily unavailable. The only thing that you can do with a codespace in this state is delete it.
pending_operation_disabled_reasonstringoptional
Text to show user when codespace is disabled by a pending operation
idle_timeout_noticestringoptional
Text to show user when codespace idle timeout minutes has been overriden by an organization policy
retention_period_minutesintegeroptional
Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days).
retention_expires_atstringoptional
When a codespace will be auto-deleted based on the "retention_period_minutes" and "last_used_at"
last_known_stop_noticestringoptional
The text to display to a user when a codespace has been stopped for a potentially actionable reason.
401Requires authentication
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Forbidden
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
Error handling
A 401 is returned: Requires authentication. A 403 is returned: Forbidden. A 404 is returned: Resource not found.
Was this helpful?