Skip to content

GitHub: Set a Copilot Space for a user

GitHub copilotSpaces.copilotSpacesUpdateForUser: arguments, response, policy and SDK examples.

← Copilot spaces operations · Get started

Operation github.copilot_spaces_update_for_user

Provider route: PUT /users/{username}/copilot-spaces/{space_number}. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/github with npm, or alter-sdk-github with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { GitHubIntegration } from "@alter-ai/github";
async function execute(input: Parameters<GitHubIntegration["copilotSpaces"]["copilotSpacesUpdateForUser"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new GitHubIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.copilotSpaces.copilotSpacesUpdateForUser(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_github import GitHubIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = GitHubIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.copilot_spaces.copilot_spaces_update_for_user(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.usernamestringRequired within parent
path.space_numberintegerRequired within parent
bodyobjectRequired within parent
body.base_rolestringOptionalThe base role that determines default permissions for the space. Changing this field requires admin permissions.
- `no_access`: No default access (default)
- `reader`: Makes the space publicly readable
Note: User spaces do not support writer or admin base roles.
One of: reader, no_access
body.descriptionstringOptionalA description of the Copilot Space.
body.general_instructionsstringOptionalGeneral instructions for the Copilot Space.
Maximum length: 4000
body.namestringOptionalThe name of the Copilot Space.
body.resources_attributesarrayOptionalResources to attach to the space.
body.resources_attributes[]ModelEach itemExpand Set a Copilot Space for a user — request body — body resources attributes item

Referenced models: Set a Copilot Space for a user — request body — body resources attributes item

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Get a Copilot Space for a user — response body

Referenced models: Get a Copilot Space for a user — response body

1 more schema is linked from the tables above, on the schema pages.

Get a Copilot Space for a user — response body
FieldTypePresenceDescription and constraints
$objectRootA GitHub Copilot Space represents an interactive AI workspace where users can ask questions and get assistance.
Additional keys: not allowed
api_urlstringRequired within parentThe API URL of the space.
Format: uri
base_rolestringRequired within parentThe 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)
Known values: reader, writer, admin, no_access
created_atstringRequired within parentThe date and time the space was created.
Format: date-time
creatorModelRequired within parentExpand List users — response body — item
descriptionJSONOptional
description (anyOf 1)stringAlternativeA description of the space.
description (anyOf 2)nullAlternative
general_instructionsJSONOptional
general_instructions (anyOf 1)stringAlternativeGeneral instructions for the Copilot Space.
Maximum length: 4000
general_instructions (anyOf 2)nullAlternative
html_urlstringRequired within parentThe HTML URL of the space.
Format: uri
idJSONRequired within parent
id (anyOf 1)integerAlternativeThe unique identifier of the space.
Format: int64
id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
namestringRequired within parentThe display name of the space.
numberJSONRequired within parent
number (anyOf 1)integerAlternativeThe number that identifies the space within its owner.
number (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
ownerJSONRequired within parentThe user or organization that owns this space.
owner (anyOf 1)ModelAlternativeExpand List users — response body — item
owner (anyOf 2)ModelAlternativeExpand List organizations — response body — item
resources_attributesarrayOptionalResources attached to the space.
resources_attributes[]objectEach item
resources_attributes[].copilot_chat_attachment_idJSONOptional
resources_attributes[].copilot_chat_attachment_id (anyOf 1)JSONAlternative
resources_attributes[].copilot_chat_attachment_id (anyOf 1) (anyOf 1)integerAlternativeThe unique identifier of the chat attachment for uploaded files or media content.
Format: int64
resources_attributes[].copilot_chat_attachment_id (anyOf 1) (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
resources_attributes[].copilot_chat_attachment_id (anyOf 2)nullAlternative
resources_attributes[].created_atstringOptionalThe date and time the resource was created.
Format: date-time
resources_attributes[].idJSONOptional
resources_attributes[].id (anyOf 1)integerAlternativeThe unique identifier of the resource.
Format: int64
resources_attributes[].id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
resources_attributes[].metadataobjectOptionalMetadata specific to the resource type.
resources_attributes[].metadata.copilot_chat_attachment_idJSONOptional
resources_attributes[].metadata.copilot_chat_attachment_id (anyOf 1)integerAlternativeChat attachment ID for uploaded files or media.
resources_attributes[].metadata.copilot_chat_attachment_id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
resources_attributes[].metadata.file_pathstringOptionalFile path for file resources.
resources_attributes[].metadata.heightJSONOptional
resources_attributes[].metadata.height (anyOf 1)integerAlternativeHeight for media content resources.
resources_attributes[].metadata.height (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
resources_attributes[].metadata.media_typestringOptionalMedia type for media content resources.
resources_attributes[].metadata.namestringOptionalName for the resource.
resources_attributes[].metadata.numberJSONOptional
resources_attributes[].metadata.number (anyOf 1)integerAlternativeIssue or PR number.
resources_attributes[].metadata.number (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
resources_attributes[].metadata.repository_idJSONOptional
resources_attributes[].metadata.repository_id (anyOf 1)integerAlternativeRepository ID for repository or file resources.
resources_attributes[].metadata.repository_id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
resources_attributes[].metadata.textstringOptionalText content for free text resources.
resources_attributes[].metadata.urlstringOptionalURL for media content resources.
resources_attributes[].metadata.widthJSONOptional
resources_attributes[].metadata.width (anyOf 1)integerAlternativeWidth for media content resources.
resources_attributes[].metadata.width (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
resources_attributes[].resource_typestringOptionalThe type of resource.
Known values: repository, github_file, free_text, github_issue, github_pull_request, media_content, uploaded_text_file
resources_attributes[].updated_atstringOptionalThe date and time the resource was last updated.
Format: date-time
updated_atstringRequired within parentThe date and time the space was last updated.
Format: date-time

Referenced models: List organizations — response body — item, List users — response body — item

Set a Copilot Space for a user — request body — body resources attributes item
FieldTypePresenceDescription and constraints
$objectRoot
metadataobjectOptionalMetadata specific to the resource type.
metadata.file_pathstringOptionalFile path for file resources.
metadata.namestringOptionalName for the resource.
metadata.numberintegerOptionalIssue or PR number.
metadata.repository_idintegerOptionalRepository ID for repository or file resources.
metadata.textstringOptionalText content for free text resources.
resource_typestringOptionalThe type of resource.
One of: repository, github_file, free_text, github_issue, github_pull_request, media_content, uploaded_text_file
List organizations — response body — item
FieldTypePresenceDescription and constraints
$objectRootA GitHub organization.
avatar_urlstringRequired within parent
descriptionJSONRequired within parent
description (anyOf 1)stringAlternative
description (anyOf 2)nullAlternative
events_urlstringRequired within parentFormat: uri
hooks_urlstringRequired within parent
idJSONRequired within parent
id (anyOf 1)integerAlternative
id (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
issues_urlstringRequired within parent
loginstringRequired within parent
members_urlstringRequired within parent
node_idstringRequired within parent
public_members_urlstringRequired within parent
repos_urlstringRequired within parentFormat: uri
urlstringRequired within parentFormat: uri

SDK function policy ID: github.copilot_spaces_update_for_user. Catalog operation: copilot-spaces/update-for-user. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Pinned headers: {"X-GitHub-Api-Version": "2026-03-10", "User-Agent": "Alter", "Accept": "application/vnd.github+json"}

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.