Skip to content

Set a Copilot Space for a user

PUT
/users/{username}/copilot-spaces/{space_number}

Updates 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.

API method documentation

username
required
string

The handle for the GitHub user account.

space_number
required
integer

The unique identifier of the Copilot Space.

Media type application/json
object
name

The name of the Copilot Space.

string
description

A description of the Copilot Space.

string
general_instructions

General instructions for the Copilot Space.

string
<= 4000 characters
base_role

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.
string
Allowed values: reader no_access
resources_attributes

Resources to attach to the space.

Array<object>
object
resource_type

The type of resource.

string
Allowed values: repository github_file free_text github_issue github_pull_request media_content uploaded_text_file
metadata

Metadata specific to the resource type.

object
repository_id

Repository ID for repository or file resources.

integer
file_path

File path for file resources.

string
text

Text content for free text resources.

string
name

Name for the resource.

string
number

Issue or PR number.

integer
Examples
Example default
{
"name": "Updated Development Space",
"description": "Updated personal space for development assistance",
"general_instructions": "Updated instructions to help me with React development patterns and best practices",
"resources_attributes": [
{
"resource_type": "github_file",
"metadata": {
"repository_id": 789012,
"file_path": "src/components/UpdatedApp.js"
}
},
{
"id": 123,
"_destroy": true
},
{
"id": 456,
"resource_type": "free_text",
"metadata": {
"name": "Updated Development Notes",
"text": "Updated focus on clean code principles and modern React patterns"
}
}
]
}

Response

Media type application/json
Space

A GitHub Copilot Space represents an interactive AI workspace where users can ask questions and get assistance.

object
id
required

The unique identifier of the space.

integer format: int64
number
required

The number that identifies the space within its owner.

integer
name
required

The display name of the space.

string
description

A description of the space.

string
nullable
general_instructions

General instructions for the Copilot Space.

string
nullable <= 4000 characters
base_role
required

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)
string
Allowed values: reader writer admin no_access
owner
required
Any of:
Simple User

A GitHub user.

object
name
string
nullable
email
string
nullable
login
required
string
id
required
integer format: int64
node_id
required
string
avatar_url
required
string format: uri
gravatar_id
required
string
nullable
url
required
string format: uri
html_url
required
string format: uri
followers_url
required
string format: uri
following_url
required
string
gists_url
required
string
starred_url
required
string
subscriptions_url
required
string format: uri
organizations_url
required
string format: uri
repos_url
required
string format: uri
events_url
required
string
received_events_url
required
string format: uri
type
required
string
site_admin
required
boolean
starred_at
string
user_view_type
string
creator
required
Simple User

A GitHub user.

object
name
string
nullable
email
string
nullable
login
required
string
id
required
integer format: int64
node_id
required
string
avatar_url
required
string format: uri
gravatar_id
required
string
nullable
url
required
string format: uri
html_url
required
string format: uri
followers_url
required
string format: uri
following_url
required
string
gists_url
required
string
starred_url
required
string
subscriptions_url
required
string format: uri
organizations_url
required
string format: uri
repos_url
required
string format: uri
events_url
required
string
received_events_url
required
string format: uri
type
required
string
site_admin
required
boolean
starred_at
string
user_view_type
string
created_at
required

The date and time the space was created.

string format: date-time
updated_at
required

The date and time the space was last updated.

string format: date-time
html_url
required

The HTML URL of the space.

string format: uri
api_url
required

The API URL of the space.

string format: uri
resources_attributes

Resources attached to the space.

Array<object>
object
id

The unique identifier of the resource.

integer format: int64
resource_type

The type of resource.

string
Allowed values: repository github_file free_text github_issue github_pull_request media_content uploaded_text_file
copilot_chat_attachment_id

The unique identifier of the chat attachment for uploaded files or media content.

integer format: int64
nullable
created_at

The date and time the resource was created.

string format: date-time
updated_at

The date and time the resource was last updated.

string format: date-time
metadata

Metadata specific to the resource type.

object
repository_id

Repository ID for repository or file resources.

integer
file_path

File path for file resources.

string
text

Text content for free text resources.

string
name

Name for the resource.

string
number

Issue or PR number.

integer
copilot_chat_attachment_id

Chat attachment ID for uploaded files or media.

integer
media_type

Media type for media content resources.

string
url

URL for media content resources.

string
height

Height for media content resources.

integer
width

Width for media content resources.

integer
Examples
Example default

Example response for a user copilot space

{
"id": 42,
"number": 5,
"name": "My Development Space",
"description": "Personal space for React development patterns",
"general_instructions": "Focus on React functional components, hooks, and modern development patterns",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"creator": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"created_at": "2023-02-15T08:30:00Z",
"updated_at": "2023-02-15T14:45:00Z",
"html_url": "https://github.com/copilot/spaces/octocat/5",
"api_url": "https://api.github.com/user/1/copilot-spaces/5",
"base_role": "no_access",
"resources_attributes": [
{
"id": 789,
"resource_type": "github_file",
"metadata": {
"repository_id": 1234,
"file_path": "src/components/App.tsx"
}
},
{
"id": 790,
"resource_type": "free_text",
"metadata": {
"name": "React Best Practices",
"text": "Use functional components with hooks"
}
}
]
}

Forbidden

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Resource not found

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Validation failed, or the endpoint has been spammed.

Media type application/json
Validation Error

Validation Error

object
message
required
string
documentation_url
required
string
errors
Array<object>
object
resource
string
field
string
message
string
code
required
string
index
integer
value
One of:
string
nullable
Example generated
{
"message": "example",
"documentation_url": "example",
"errors": [
{
"resource": "example",
"field": "example",
"message": "example",
"code": "example",
"index": 1,
"value": [
"example"
]
}
]
}