Skip to main content

spaces

Creates, updates, deletes, gets or lists a spaces resource.

Overview

Namespaces
TypeResource
Idgithub.copilot_spaces.spaces

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idinteger (int64)The unique identifier of the space.
namestringThe display name of the space. (example: My Development Space)
api_urlstring (uri)The API URL of the space. (example: https://api.github.com/organizations/1/copilot-spaces/5)
base_rolestringThe base role that determines default permissions. - no_access: No default access - reader: Default read permissions - writer: Default write permissions (organization spaces only) - admin: Default admin permissions (organization spaces only) (reader, writer, admin, no_access) (example: no_access)
created_atstring (date-time)The date and time the space was created. (example: 2023-01-01T00:00:00Z)
creatorobjectA GitHub user. (title: Simple User)
descriptionstringA description of the space. (example: A space for discussing React development patterns)
general_instructionsstringGeneral instructions for the Copilot Space. (example: Help with React development patterns and best practices)
html_urlstring (uri)The HTML URL of the space. (example: https://github.com/copilot/spaces/octo-org/5)
numberintegerThe number that identifies the space within its owner.
ownerobjectThe user or organization that owns this space. (title: Simple User)
resources_attributesarrayResources attached to the space.
updated_atstring (date-time)The date and time the space was last updated. (example: 2023-01-01T12:00:00Z)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_for_orgselectorg, space_numberGets details about a specific Copilot Space owned by an organization. The authenticated user must have read access to the Space.

Internal Spaces require the authenticated user to be a member of the organization or have been granted read permissions.

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

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space.
get_for_userselectusername, space_numberGets details about a specific Copilot Space owned by a user. The authenticated user must have read access to the Space.

Private user spaces require the authenticated user to be the owner of the space.
Public user spaces are accessible to any authenticated user.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
list_for_orgselectorgper_page, before, afterLists Copilot Spaces owned by an organization. The authenticated user must have read access to the organization's Copilot Spaces.

Only Spaces that are readable by the authenticated user are returned. This includes public Spaces and internal Spaces if the user is a member of the organization.

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

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in a space; spaces with inaccessible resources are omitted from the response.
list_for_userselectusernameper_page, before, afterLists Copilot Spaces owned by a user. The authenticated user must have read access to the user's Copilot Spaces.

Only Spaces that are readable by the authenticated user are returned. This includes the user's own spaces, and public user spaces when accessing another user's spaces.

OAuth app tokens and personal access tokens (classic) need the read:user scope to use this endpoint.
create_for_orginsertorg, nameCreates a new Copilot Space owned by an organization. The authenticated user must have permissions to create spaces in the organization.

Organization members with appropriate permissions can create Copilot Spaces to be shared within their organization.

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

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by the submitted resources.
create_for_userinsertusername, nameCreates a new Copilot Space owned by a user. Only the authenticated user can create spaces for their own account.

Users can create personal Copilot Spaces for their individual use.

OAuth app tokens and personal access tokens (classic) need the read:user scope to use this endpoint.
update_for_orgreplaceorg, space_numberUpdates a Copilot Space owned by an organization. The authenticated user must have permissions to update spaces in the organization.

Organization members with appropriate permissions can update Copilot Spaces owned by their organization.

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

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space, including any being added or updated.
update_for_userreplaceusername, space_numberUpdates a Copilot Space owned by a user. Only the authenticated user can update spaces for their own account.

Users can update their personal Copilot Spaces.

OAuth app tokens and personal access tokens (classic) need the read:user scope to use this endpoint.
delete_for_orgdeleteorg, space_numberDeletes a Copilot Space owned by an organization. The authenticated user must have permissions to delete spaces in the organization.

Warning: This action is permanent and cannot be undone. Deleting a Copilot Space will remove all associated resources and configurations.

Organization members with appropriate permissions can delete Copilot Spaces owned by their organization.

OAuth app tokens and personal access tokens (classic) need both the read:org and repo scopes to use this endpoint.

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space.
delete_for_userdeleteusername, space_numberDeletes a Copilot Space owned by a user. The authenticated user must be the owner of the space.

Warning: This action is permanent and cannot be undone. Deleting a space will remove all associated resources and configurations.

OAuth app tokens and personal access tokens (classic) need the user 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
orgstringThe organization name. The name is not case sensitive.
space_numberintegerThe unique identifier of the Copilot Space.
usernamestringThe handle for the GitHub user account.
afterstringA cursor, as given in the Link header. If specified, the query only searches for results after this cursor.
beforestringA cursor, as given in the Link header. If specified, the query only searches for results before this cursor.
per_pageintegerThe number of results per page (max 100).

SELECT examples

Gets details about a specific Copilot Space owned by an organization. The authenticated user must have read access to the Space.

Internal Spaces require the authenticated user to be a member of the organization or have been granted read permissions.

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

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space.

SELECT
id,
name,
api_url,
base_role,
created_at,
creator,
description,
general_instructions,
html_url,
number,
owner,
resources_attributes,
updated_at
FROM github.copilot_spaces.spaces
WHERE org = '{{ org }}' -- required
AND space_number = '{{ space_number }}' -- required
;

INSERT examples

Creates a new Copilot Space owned by an organization. The authenticated user must have permissions to create spaces in the organization.

Organization members with appropriate permissions can create Copilot Spaces to be shared within their organization.

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

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by the submitted resources.

INSERT INTO github.copilot_spaces.spaces (
name,
description,
general_instructions,
base_role,
resources_attributes,
org
)
SELECT
'{{ name }}' /* required */,
'{{ description }}',
'{{ general_instructions }}',
'{{ base_role }}',
'{{ resources_attributes }}',
'{{ org }}'
RETURNING
id,
name,
api_url,
base_role,
created_at,
creator,
description,
general_instructions,
html_url,
number,
owner,
resources_attributes,
updated_at
;

REPLACE examples

Updates a Copilot Space owned by an organization. The authenticated user must have permissions to update spaces in the organization.

Organization members with appropriate permissions can update Copilot Spaces owned by their organization.

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

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space, including any being added or updated.

REPLACE github.copilot_spaces.spaces
SET
name = '{{ name }}',
description = '{{ description }}',
general_instructions = '{{ general_instructions }}',
base_role = '{{ base_role }}',
resources_attributes = '{{ resources_attributes }}'
WHERE
org = '{{ org }}' --required
AND space_number = '{{ space_number }}' --required
RETURNING
id,
name,
api_url,
base_role,
created_at,
creator,
description,
general_instructions,
html_url,
number,
owner,
resources_attributes,
updated_at;

DELETE examples

Deletes a Copilot Space owned by an organization. The authenticated user must have permissions to delete spaces in the organization.

Warning: This action is permanent and cannot be undone. Deleting a Copilot Space will remove all associated resources and configurations.

Organization members with appropriate permissions can delete Copilot Spaces owned by their organization.

OAuth app tokens and personal access tokens (classic) need both the read:org and repo scopes to use this endpoint.

Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space.

DELETE FROM github.copilot_spaces.spaces
WHERE org = '{{ org }}' --required
AND space_number = '{{ space_number }}' --required
;