Use the REST API to manage your organization members codespaces.
You can manage Codespaces that are billed to your
organization. For more information,
see Codespaces documentation.
Note
Most endpoints use Authorization: Bearer <YOUR-TOKEN> and Accept: application/vnd.github+json headers, plus X-GitHub-Api-Version: 2026-03-10. Curl examples below omit these standard headers for brevity.
GET /orgs/{org}/codespaces
Lists the codespaces associated to a specified organization.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.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
org (string) (required)
The organization name. The name is not case sensitive.
200 - OK
304 - Not modified
401 - Requires authentication
403 - Forbidden
404 - Resource not found
500 - Internal Error
Request:
curl -L \
-X GET \
https://api.github.com/orgs/ORG/codespaces
Response schema (Status: 200):
total_count: required, integercodespaces: required, array of Codespace:
id: required, integer, format: int64name: required, stringdisplay_name: string or nullenvironment_id: required, string or nullowner: required, Simple User:
name: string or nullemail: string or nulllogin: required, stringid: required, integer, format: int64node_id: required, stringavatar_url: required, string, format: urigravatar_id: required, string or nullurl: required, string, format: urihtml_url: required, string, format: urifollowers_url: required, string, format: urifollowing_url: required, stringgists_url: required, stringstarred_url: required, stringsubscriptions_url: required, string, format: uriorganizations_url: required, string, format: urirepos_url: required, string, format: urievents_url: required, stringreceived_events_url: required, string, format: uritype: required, stringsite_admin: required, booleanstarred_at: stringuser_view_type: stringbillable_owner: required, Simple User (see above)repository: required, Minimal Repository:
id: required, integer, format: int64node_id: required, stringname: required, stringfull_name: required, stringowner: required, Simple User (see above)private: required, booleanhtml_url: required, string, format: uridescription: required, string or nullfork: required, booleanurl: required, string, format: uriarchive_url: required, stringassignees_url: required, stringblobs_url: required, stringbranches_url: required, stringcollaborators_url: required, stringcomments_url: required, stringcommits_url: required, stringcompare_url: required, stringcontents_url: required, stringcontributors_url: required, string, format: urideployments_url: required, string, format: uridownloads_url: required, string, format: urievents_url: required, string, format: uriforks_url: required, string, format: urigit_commits_url: required, stringgit_refs_url: required, stringgit_tags_url: required, stringgit_url: stringissue_comment_url: required, stringissue_events_url: required, stringissues_url: required, stringkeys_url: required, stringlabels_url: required, stringlanguages_url: required, string, format: urimerges_url: required, string, format: urimilestones_url: required, stringnotifications_url: required, stringpulls_url: required, stringreleases_url: required, stringssh_url: stringstargazers_url: required, string, format: uristatuses_url: required, stringsubscribers_url: required, string, format: urisubscription_url: required, string, format: uritags_url: required, string, format: uriteams_url: required, string, format: uritrees_url: required, stringclone_url: stringmirror_url: string or nullhooks_url: required, string, format: urisvn_url: stringhomepage: string or nulllanguage: string or nullforks_count: integerstargazers_count: integerwatchers_count: integersize: integerdefault_branch: stringopen_issues_count: integeris_template: booleantopics: array of stringhas_issues: booleanhas_projects: booleanhas_wiki: booleanhas_pages: booleanhas_discussions: booleanhas_pull_requests: booleanpull_request_creation_policy: string, enum: all, collaborators_onlyarchived: booleandisabled: booleanvisibility: stringpushed_at: string or null, format: date-timecreated_at: string or null, format: date-timeupdated_at: string or null, format: date-timepermissions: object:
admin: booleanmaintain: booleanpush: booleantriage: booleanpull: booleanrole_name: stringtemp_clone_token: stringdelete_branch_on_merge: booleansubscribers_count: integernetwork_count: integercode_of_conduct: Code Of Conduct:
key: required, stringname: required, stringurl: required, string, format: uribody: stringhtml_url: required, string or null, format: urilicense: object or null:
key: stringname: stringspdx_id: stringurl: string or nullnode_id: stringforks: integeropen_issues: integerwatchers: integerallow_forking: booleanweb_commit_signoff_required: booleansecurity_and_analysis: object or null:
advanced_security: object:
status: string, enum: enabled, disabledcode_security: object:
status: string, enum: enabled, disableddependabot_security_updates: object:
status: string, enum: enabled, disabledsecret_scanning: object:
status: string, enum: enabled, disabledsecret_scanning_push_protection: object:
status: string, enum: enabled, disabledsecret_scanning_non_provider_patterns: object:
status: string, enum: enabled, disabledsecret_scanning_ai_detection: object:
status: string, enum: enabled, disabledsecret_scanning_delegated_alert_dismissal: object:
status: string, enum: enabled, disabledsecret_scanning_delegated_bypass: object:
status: string, enum: enabled, disabledsecret_scanning_delegated_bypass_options: object:
reviewers: array of objectcustom_properties: object, additional properties allowedmachine: required, any of:
name: required, stringdisplay_name: required, stringoperating_system: required, stringstorage_in_bytes: required, integermemory_in_bytes: required, integercpus: required, integerprebuild_availability: required, string or null, enum: none, ready, in_progress, nulldevcontainer_path: string or nullprebuild: required, boolean or nullcreated_at: required, string, format: date-timeupdated_at: required, string, format: date-timelast_used_at: required, string, format: date-timestate: required, string, enum: Unknown, Created, Queued, Provisioning, Available, Awaiting, Unavailable, Deleted, Moved, Shutdown, Archived, Starting, ShuttingDown, Failed, Exporting, Updating, Rebuildingurl: required, string, format: urigit_status: required, object:
ahead: integerbehind: integerhas_unpushed_changes: booleanhas_uncommitted_changes: booleanref: stringlocation: required, string, enum: EastUs, SouthEastAsia, WestEurope, WestUs2idle_timeout_minutes: required, integer or nullweb_url: required, string, format: urimachines_url: required, string, format: uristart_url: required, string, format: uristop_url: required, string, format: uripublish_url: string or null, format: uripulls_url: required, string or null, format: urirecent_folders: required, array of stringruntime_constraints: object:
allowed_port_privacy_settings: array of string or nullpending_operation: boolean or nullpending_operation_disabled_reason: string or nullidle_timeout_notice: string or nullretention_period_minutes: integer or nullretention_expires_at: string or null, format: date-timelast_known_stop_notice: string or nullPUT /orgs/{org}/codespaces/access
Sets which users can access codespaces in an organization. This is synonymous with granting or revoking codespaces access permissions for users according to the visibility.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.org (string) (required)visibility (string) (required)
Which users can access codespaces in the organization. disabled means that no users can access codespaces in the organization.
Can be one of: disabled, selected_members, all_members, all_members_and_outside_collaborators
selected_usernames (array of strings)
The usernames of the organization members who should have access to codespaces in the organization. Required when visibility is selected_members. The provided list of usernames will replace any existing value.
204 - Response when successfully modifying permissions.
304 - Not modified
400 - Users are neither members nor collaborators of this organization.
404 - Resource not found
422 - Validation failed, or the endpoint has been spammed.
500 - Internal Error
Request:
curl -L \
-X PUT \
https://api.github.com/orgs/ORG/codespaces/access \
-d '{
"visibility": "selected_members",
"selected_usernames": [
"johnDoe",
"atomIO"
]
}'
Response schema (Status: 204):
POST /orgs/{org}/codespaces/access/selected_users
Codespaces for the specified users will be billed to the organization.
To use this endpoint, the access settings for the organization must be set to selected_members.
For information on how to change this setting, see "Manage access control for organization codespaces."
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.org (string) (required)selected_usernames (array of strings) (required)204 - Response when successfully modifying permissions.
304 - Not modified
400 - Users are neither members nor collaborators of this organization.
404 - Resource not found
422 - Validation failed, or the endpoint has been spammed.
500 - Internal Error
Request:
curl -L \
-X POST \
https://api.github.com/orgs/ORG/codespaces/access/selected_users \
-d '{
"selected_usernames": [
"johnDoe",
"atomIO"
]
}'
Response schema (Status: 204):
DELETE /orgs/{org}/codespaces/access/selected_users
Codespaces for the specified users will no longer be billed to the organization.
To use this endpoint, the access settings for the organization must be set to selected_members.
For information on how to change this setting, see "Manage access control for organization codespaces."
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.org (string) (required)selected_usernames (array of strings) (required)204 - Response when successfully modifying permissions.
304 - Not modified
400 - Users are neither members nor collaborators of this organization.
404 - Resource not found
422 - Validation failed, or the endpoint has been spammed.
500 - Internal Error
Request:
curl -L \
-X DELETE \
https://api.github.com/orgs/ORG/codespaces/access/selected_users \
-d '{
"selected_usernames": [
"johnDoe",
"atomIO"
]
}'
Response schema (Status: 204):
GET /orgs/{org}/members/{username}/codespaces
Lists the codespaces that a member of an organization has for repositories in that organization.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.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
org (string) (required)
The organization name. The name is not case sensitive.
username (string) (required)
The handle for the GitHub user account.
200 - OK
304 - Not modified
401 - Requires authentication
403 - Forbidden
404 - Resource not found
500 - Internal Error
Request:
curl -L \
-X GET \
https://api.github.com/orgs/ORG/members/USERNAME/codespaces
Response schema (Status: 200):
Same response schema as List codespaces for the organization.
DELETE /orgs/{org}/members/{username}/codespaces/{codespace_name}
Deletes a user's codespace.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
username (string) (required)
The handle for the GitHub user account.
codespace_name (string) (required)
The name of the codespace.
202 - Accepted
304 - Not modified
401 - Requires authentication
403 - Forbidden
404 - Resource not found
500 - Internal Error
Request:
curl -L \
-X DELETE \
https://api.github.com/orgs/ORG/members/USERNAME/codespaces/CODESPACE_NAME
Response schema (Status: 202):
object
POST /orgs/{org}/members/{username}/codespaces/{codespace_name}/stop
Stops a user's codespace.
OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
username (string) (required)
The handle for the GitHub user account.
codespace_name (string) (required)
The name of the codespace.
200 - OK
304 - Not modified
401 - Requires authentication
403 - Forbidden
404 - Resource not found
500 - Internal Error
Request:
curl -L \
-X POST \
https://api.github.com/orgs/ORG/members/USERNAME/codespaces/CODESPACE_NAME/stop
Response schema (Status: 200):
id: required, integer, format: int64name: required, stringdisplay_name: string or nullenvironment_id: required, string or nullowner: required, Simple User:
name: string or nullemail: string or nulllogin: required, stringid: required, integer, format: int64node_id: required, stringavatar_url: required, string, format: urigravatar_id: required, string or nullurl: required, string, format: urihtml_url: required, string, format: urifollowers_url: required, string, format: urifollowing_url: required, stringgists_url: required, stringstarred_url: required, stringsubscriptions_url: required, string, format: uriorganizations_url: required, string, format: urirepos_url: required, string, format: urievents_url: required, stringreceived_events_url: required, string, format: uritype: required, stringsite_admin: required, booleanstarred_at: stringuser_view_type: stringbillable_owner: required, Simple User (see above)repository: required, Minimal Repository:
id: required, integer, format: int64node_id: required, stringname: required, stringfull_name: required, stringowner: required, Simple User (see above)private: required, booleanhtml_url: required, string, format: uridescription: required, string or nullfork: required, booleanurl: required, string, format: uriarchive_url: required, stringassignees_url: required, stringblobs_url: required, stringbranches_url: required, stringcollaborators_url: required, stringcomments_url: required, stringcommits_url: required, stringcompare_url: required, stringcontents_url: required, stringcontributors_url: required, string, format: urideployments_url: required, string, format: uridownloads_url: required, string, format: urievents_url: required, string, format: uriforks_url: required, string, format: urigit_commits_url: required, stringgit_refs_url: required, stringgit_tags_url: required, stringgit_url: stringissue_comment_url: required, stringissue_events_url: required, stringissues_url: required, stringkeys_url: required, stringlabels_url: required, stringlanguages_url: required, string, format: urimerges_url: required, string, format: urimilestones_url: required, stringnotifications_url: required, stringpulls_url: required, stringreleases_url: required, stringssh_url: stringstargazers_url: required, string, format: uristatuses_url: required, stringsubscribers_url: required, string, format: urisubscription_url: required, string, format: uritags_url: required, string, format: uriteams_url: required, string, format: uritrees_url: required, stringclone_url: stringmirror_url: string or nullhooks_url: required, string, format: urisvn_url: stringhomepage: string or nulllanguage: string or nullforks_count: integerstargazers_count: integerwatchers_count: integersize: integerdefault_branch: stringopen_issues_count: integeris_template: booleantopics: array of stringhas_issues: booleanhas_projects: booleanhas_wiki: booleanhas_pages: booleanhas_discussions: booleanhas_pull_requests: booleanpull_request_creation_policy: string, enum: all, collaborators_onlyarchived: booleandisabled: booleanvisibility: stringpushed_at: string or null, format: date-timecreated_at: string or null, format: date-timeupdated_at: string or null, format: date-timepermissions: object:
admin: booleanmaintain: booleanpush: booleantriage: booleanpull: booleanrole_name: stringtemp_clone_token: stringdelete_branch_on_merge: booleansubscribers_count: integernetwork_count: integercode_of_conduct: Code Of Conduct:
key: required, stringname: required, stringurl: required, string, format: uribody: stringhtml_url: required, string or null, format: urilicense: object or null:
key: stringname: stringspdx_id: stringurl: string or nullnode_id: stringforks: integeropen_issues: integerwatchers: integerallow_forking: booleanweb_commit_signoff_required: booleansecurity_and_analysis: object or null:
advanced_security: object:
status: string, enum: enabled, disabledcode_security: object:
status: string, enum: enabled, disableddependabot_security_updates: object:
status: string, enum: enabled, disabledsecret_scanning: object:
status: string, enum: enabled, disabledsecret_scanning_push_protection: object:
status: string, enum: enabled, disabledsecret_scanning_non_provider_patterns: object:
status: string, enum: enabled, disabledsecret_scanning_ai_detection: object:
status: string, enum: enabled, disabledsecret_scanning_delegated_alert_dismissal: object:
status: string, enum: enabled, disabledsecret_scanning_delegated_bypass: object:
status: string, enum: enabled, disabledsecret_scanning_delegated_bypass_options: object:
reviewers: array of objects:
reviewer_id: required, integerreviewer_type: required, string, enum: TEAM, ROLEmode: string, enum: ALWAYS, EXEMPT, default: "ALWAYS"custom_properties: object, additional properties allowedmachine: required, any of:
name: required, stringdisplay_name: required, stringoperating_system: required, stringstorage_in_bytes: required, integermemory_in_bytes: required, integercpus: required, integerprebuild_availability: required, string or null, enum: none, ready, in_progress, nulldevcontainer_path: string or nullprebuild: required, boolean or nullcreated_at: required, string, format: date-timeupdated_at: required, string, format: date-timelast_used_at: required, string, format: date-timestate: required, string, enum: Unknown, Created, Queued, Provisioning, Available, Awaiting, Unavailable, Deleted, Moved, Shutdown, Archived, Starting, ShuttingDown, Failed, Exporting, Updating, Rebuildingurl: required, string, format: urigit_status: required, object:
ahead: integerbehind: integerhas_unpushed_changes: booleanhas_uncommitted_changes: booleanref: stringlocation: required, string, enum: EastUs, SouthEastAsia, WestEurope, WestUs2idle_timeout_minutes: required, integer or nullweb_url: required, string, format: urimachines_url: required, string, format: uristart_url: required, string, format: uristop_url: required, string, format: uripublish_url: string or null, format: uripulls_url: required, string or null, format: urirecent_folders: required, array of stringruntime_constraints: object:
allowed_port_privacy_settings: array of string or nullpending_operation: boolean or nullpending_operation_disabled_reason: string or nullidle_timeout_notice: string or nullretention_period_minutes: integer or nullretention_expires_at: string or null, format: date-timelast_known_stop_notice: string or null