Skip to main content

organizations

Creates, updates, deletes, gets or lists an organizations resource.

Overview

Nameorganizations
TypeResource
Idgithub.codespaces.organizations

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
codespacesarray
total_countinteger

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_codespaces_for_user_in_orgselectorg, usernameper_page, pageLists 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.
list_in_organizationselectorgper_page, pageLists the codespaces associated to a specified organization.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
set_codespaces_accessreplaceorg, visibilitySets 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.
delete_from_organizationdeleteorg, username, codespace_nameDeletes a user's codespace.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.
delete_codespaces_access_usersdeleteorgCodespaces 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.
set_codespaces_access_usersexecorg, selected_usernamesCodespaces 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.
stop_in_organizationexecorg, username, codespace_nameStops a user's codespace.

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

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
codespace_namestringThe name of the codespace.
orgstringThe organization name. The name is not case sensitive.
usernamestringThe handle for the GitHub user account.
pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."

SELECT examples

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.

SELECT
codespaces,
total_count
FROM github.codespaces.organizations
WHERE org = '{{ org }}' -- required
AND username = '{{ username }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;

REPLACE examples

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.

REPLACE github.codespaces.organizations
SET
visibility = '{{ visibility }}',
selected_usernames = '{{ selected_usernames }}'
WHERE
org = '{{ org }}' --required
AND visibility = '{{ visibility }}' --required;

DELETE examples

Deletes a user's codespace.

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

DELETE FROM github.codespaces.organizations
WHERE org = '{{ org }}' --required
AND username = '{{ username }}' --required
AND codespace_name = '{{ codespace_name }}' --required
;

Lifecycle Methods

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.

EXEC github.codespaces.organizations.set_codespaces_access_users 
@org='{{ org }}' --required
@@json=
'{
"selected_usernames": "{{ selected_usernames }}"
}'
;