Sample - GitHub REST API
POST/orgs/{org}/members/{username}/codespaces/{codespace_name}/stop

Stop a codespace for an organization user

Stops a user's codespace.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

3 parameters
orgstringrequired
The organization name. The name is not case sensitive.
usernamestringrequired
The handle for the GitHub user account.
codespace_namestringrequired
The name of the codespace.

6 status codes
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.
Allowed:UnknownCreatedQueuedProvisioningAvailableAwaitingUnavailableDeletedMovedShutdownArchivedStarting
urlstringrequired
API URL for this codespace.
git_statusobjectrequired
Details about the codespace's git repository.
locationstringrequired
The initally assigned location of a new codespace.
Allowed:EastUsSouthEastAsiaWestEuropeWestUs2
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.
304Not modified
401Requires authentication
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Forbidden
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
500Internal Error
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. A 500 is returned: Internal Error.