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.
Call through Alter
Section titled “Call through Alter”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 osfrom alter_sdk import Appfrom 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()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.username | string | Required within parent | |
path.space_number | integer | Required within parent | |
body | object | Required within parent | |
body.base_role | string | Optional | The 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.description | string | Optional | A description of the Copilot Space. |
body.general_instructions | string | Optional | General instructions for the Copilot Space. Maximum length: 4000 |
body.name | string | Optional | The name of the Copilot Space. |
body.resources_attributes | array | Optional | Resources to attach to the space. |
body.resources_attributes[] | Model | Each item | Expand 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
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Get a Copilot Space for a user — response body |
Referenced models: Get a Copilot Space for a user — response body
Schemas
Section titled “Schemas”1 more schema is linked from the tables above, on the schema pages.
Get a Copilot Space for a user — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A GitHub Copilot Space represents an interactive AI workspace where users can ask questions and get assistance. Additional keys: not allowed |
api_url | string | Required within parent | The API URL of the space. Format: uri |
base_role | string | Required within parent | The 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_at | string | Required within parent | The date and time the space was created. Format: date-time |
creator | Model | Required within parent | Expand List users — response body — item |
description | JSON | Optional | |
description (anyOf 1) | string | Alternative | A description of the space. |
description (anyOf 2) | null | Alternative | |
general_instructions | JSON | Optional | |
general_instructions (anyOf 1) | string | Alternative | General instructions for the Copilot Space. Maximum length: 4000 |
general_instructions (anyOf 2) | null | Alternative | |
html_url | string | Required within parent | The HTML URL of the space. Format: uri |
id | JSON | Required within parent | |
id (anyOf 1) | integer | Alternative | The unique identifier of the space. Format: int64 |
id (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
name | string | Required within parent | The display name of the space. |
number | JSON | Required within parent | |
number (anyOf 1) | integer | Alternative | The number that identifies the space within its owner. |
number (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
owner | JSON | Required within parent | The user or organization that owns this space. |
owner (anyOf 1) | Model | Alternative | Expand List users — response body — item |
owner (anyOf 2) | Model | Alternative | Expand List organizations — response body — item |
resources_attributes | array | Optional | Resources attached to the space. |
resources_attributes[] | object | Each item | |
resources_attributes[].copilot_chat_attachment_id | JSON | Optional | |
resources_attributes[].copilot_chat_attachment_id (anyOf 1) | JSON | Alternative | |
resources_attributes[].copilot_chat_attachment_id (anyOf 1) (anyOf 1) | integer | Alternative | The unique identifier of the chat attachment for uploaded files or media content. Format: int64 |
resources_attributes[].copilot_chat_attachment_id (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
resources_attributes[].copilot_chat_attachment_id (anyOf 2) | null | Alternative | |
resources_attributes[].created_at | string | Optional | The date and time the resource was created. Format: date-time |
resources_attributes[].id | JSON | Optional | |
resources_attributes[].id (anyOf 1) | integer | Alternative | The unique identifier of the resource. Format: int64 |
resources_attributes[].id (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
resources_attributes[].metadata | object | Optional | Metadata specific to the resource type. |
resources_attributes[].metadata.copilot_chat_attachment_id | JSON | Optional | |
resources_attributes[].metadata.copilot_chat_attachment_id (anyOf 1) | integer | Alternative | Chat attachment ID for uploaded files or media. |
resources_attributes[].metadata.copilot_chat_attachment_id (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
resources_attributes[].metadata.file_path | string | Optional | File path for file resources. |
resources_attributes[].metadata.height | JSON | Optional | |
resources_attributes[].metadata.height (anyOf 1) | integer | Alternative | Height for media content resources. |
resources_attributes[].metadata.height (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
resources_attributes[].metadata.media_type | string | Optional | Media type for media content resources. |
resources_attributes[].metadata.name | string | Optional | Name for the resource. |
resources_attributes[].metadata.number | JSON | Optional | |
resources_attributes[].metadata.number (anyOf 1) | integer | Alternative | Issue or PR number. |
resources_attributes[].metadata.number (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
resources_attributes[].metadata.repository_id | JSON | Optional | |
resources_attributes[].metadata.repository_id (anyOf 1) | integer | Alternative | Repository ID for repository or file resources. |
resources_attributes[].metadata.repository_id (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
resources_attributes[].metadata.text | string | Optional | Text content for free text resources. |
resources_attributes[].metadata.url | string | Optional | URL for media content resources. |
resources_attributes[].metadata.width | JSON | Optional | |
resources_attributes[].metadata.width (anyOf 1) | integer | Alternative | Width for media content resources. |
resources_attributes[].metadata.width (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
resources_attributes[].resource_type | string | Optional | The type of resource. Known values: repository, github_file, free_text, github_issue, github_pull_request, media_content, uploaded_text_file |
resources_attributes[].updated_at | string | Optional | The date and time the resource was last updated. Format: date-time |
updated_at | string | Required within parent | The 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
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
metadata | object | Optional | Metadata specific to the resource type. |
metadata.file_path | string | Optional | File path for file resources. |
metadata.name | string | Optional | Name for the resource. |
metadata.number | integer | Optional | Issue or PR number. |
metadata.repository_id | integer | Optional | Repository ID for repository or file resources. |
metadata.text | string | Optional | Text content for free text resources. |
resource_type | string | Optional | The 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
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A GitHub organization. |
avatar_url | string | Required within parent | |
description | JSON | Required within parent | |
description (anyOf 1) | string | Alternative | |
description (anyOf 2) | null | Alternative | |
events_url | string | Required within parent | Format: uri |
hooks_url | string | Required within parent | |
id | JSON | Required within parent | |
id (anyOf 1) | integer | Alternative | |
id (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
issues_url | string | Required within parent | |
login | string | Required within parent | |
members_url | string | Required within parent | |
node_id | string | Required within parent | |
public_members_url | string | Required within parent | |
repos_url | string | Required within parent | Format: uri |
url | string | Required within parent | Format: uri |
Policy, approvals and errors
Section titled “Policy, approvals and errors”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"}