Update a codespace for the authenticated user
PATCH
/user/codespaces/{codespace_name} https://api.github.com
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.
Parameters
path Path Parameters
| Name | Type |
|---|---|
codespace_name
required
The name of the codespace. | string |
Request Body
application/json
{ machine?: string;display_name?: string;recent_folders?: string[]; }
Responses
200 application/json
Response
interface Codespace {
id: number;
name: string;
display_name?: string | null;
environment_id: string | null;
owner:SimpleUser ;
billable_owner:SimpleUser ;
repository:MinimalRepository ;
machine:CodespaceMachine | null;
devcontainer_path?: string | null;
prebuild: boolean | null;
created_at: string;
updated_at: string;
last_used_at: string;
state: "Unknown" | "Created" | "Queued" | "Provisioning" | "Available" | "Awaiting" | "Unavailable" | "Deleted" | "Moved" | "Shutdown" | "Archived" | "Starting" | "ShuttingDown" | "Failed" | "Exporting" | "Updating" | "Rebuilding";
url: string;
git_status: {
ahead?: number;
behind?: number;
has_unpushed_changes?: boolean;
has_uncommitted_changes?: boolean;
ref?: string;
};
location: "EastUs" | "SouthEastAsia" | "WestEurope" | "WestUs2";
idle_timeout_minutes: number | null;
web_url: string;
machines_url: string;
start_url: string;
stop_url: string;
publish_url?: string | null;
pulls_url: string | null;
recent_folders: string[];
runtime_constraints?: { allowed_port_privacy_settings?: string[] | null; };
pending_operation?: boolean | null;
pending_operation_disabled_reason?: string | null;
idle_timeout_notice?: string | null;
retention_period_minutes?: number | null;
retention_expires_at?: string | null;
last_known_stop_notice?: string | null;
}
id: number;
name: string;
display_name?: string | null;
environment_id: string | null;
owner:
billable_owner:
repository:
machine:
devcontainer_path?: string | null;
prebuild: boolean | null;
created_at: string;
updated_at: string;
last_used_at: string;
state: "Unknown" | "Created" | "Queued" | "Provisioning" | "Available" | "Awaiting" | "Unavailable" | "Deleted" | "Moved" | "Shutdown" | "Archived" | "Starting" | "ShuttingDown" | "Failed" | "Exporting" | "Updating" | "Rebuilding";
url: string;
git_status: {
ahead?: number;
behind?: number;
has_unpushed_changes?: boolean;
has_uncommitted_changes?: boolean;
ref?: string;
};
location: "EastUs" | "SouthEastAsia" | "WestEurope" | "WestUs2";
idle_timeout_minutes: number | null;
web_url: string;
machines_url: string;
start_url: string;
stop_url: string;
publish_url?: string | null;
pulls_url: string | null;
recent_folders: string[];
runtime_constraints?: { allowed_port_privacy_settings?: string[] | null; };
pending_operation?: boolean | null;
pending_operation_disabled_reason?: string | null;
idle_timeout_notice?: string | null;
retention_period_minutes?: number | null;
retention_expires_at?: string | null;
last_known_stop_notice?: string | null;
}
Client Errors
401 application/json
Requires authentication
interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
403 application/json
Forbidden
interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
404 application/json
Resource not found
interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}