Create a Copilot Space for a user
Creates 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.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”The handle for the GitHub user account.
Request Body required
Section titled “ Request Body required ”object
The name of the Copilot Space.
A description of the Copilot Space.
General instructions for the Copilot Space.
The base role that determines default permissions for the space.
no_access: No default access (default)reader: Makes the space publicly readable Note: User spaces do not support writer or admin base roles.
Resources to attach to the space.
object
The type of resource.
Metadata specific to the resource type.
object
Repository ID for repository or file resources.
File path for file resources.
Text content for free text resources.
Name for the resource.
Issue or PR number.
Examples
{ "name": "My Development Space", "description": "Personal space for development assistance", "general_instructions": "Help me with React development patterns and best practices", "resources_attributes": [ { "resource_type": "github_file", "metadata": { "repository_id": 789012, "file_path": "src/components/App.js" } }, { "resource_type": "free_text", "metadata": { "name": "Development Notes", "text": "Focus on clean code principles and modern React patterns" } } ]}Responses
Section titled “ Responses ”Response
A GitHub Copilot Space represents an interactive AI workspace where users can ask questions and get assistance.
object
The unique identifier of the space.
The number that identifies the space within its owner.
The display name of the space.
A description of the space.
General instructions for the Copilot Space.
The base role that determines default permissions.
no_access: No default accessreader: Default read permissionswriter: Default write permissions (organization spaces only)admin: Default admin permissions (organization spaces only)
A GitHub user.
object
A GitHub organization.
object
A GitHub user.
object
The date and time the space was created.
The date and time the space was last updated.
The HTML URL of the space.
The API URL of the space.
Resources attached to the space.
object
The unique identifier of the resource.
The type of resource.
The unique identifier of the chat attachment for uploaded files or media content.
The date and time the resource was created.
The date and time the resource was last updated.
Metadata specific to the resource type.
object
Repository ID for repository or file resources.
File path for file resources.
Text content for free text resources.
Name for the resource.
Issue or PR number.
Chat attachment ID for uploaded files or media.
Media type for media content resources.
URL for media content resources.
Height for media content resources.
Width for media content resources.
Examples
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
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Resource not found
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Validation failed, or the endpoint has been spammed.
Validation Error
object
object
Example generated
{ "message": "example", "documentation_url": "example", "errors": [ { "resource": "example", "field": "example", "message": "example", "code": "example", "index": 1, "value": [ "example" ] } ]}