---
title: "Create a Copilot Space for a user"
method: POST
path: "/users/{username}/copilot-spaces"
tags: ["copilot-spaces"]
---

# Create a Copilot Space for a user

`POST /users/{username}/copilot-spaces`

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.

## Path parameters

- `username` string, required

## Request body

- object
  - `name` string, required — The name of the Copilot Space.
  - `description` string — A description of the Copilot Space.
  - `general_instructions` string — General instructions for the Copilot Space.
  - `base_role` 'reader' | 'no_access' — 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_attributes` object[] — Resources to attach to the space.
    - `resource_type` 'repository' | 'github_file' | 'free_text' | 'github_issue' | 'github_pull_request' | 'media_content' | 'uploaded_text_file' — The type of resource.
    - `metadata` object — Metadata specific to the resource type.
      - `repository_id` integer — Repository ID for repository or file resources.
      - `file_path` string — File path for file resources.
      - `text` string — Text content for free text resources.
      - `name` string — Name for the resource.
      - `number` integer — Issue or PR number.

## Response `201`

Response

- CopilotSpace — A GitHub Copilot Space represents an interactive AI workspace where users can ask questions and get assistance.
  - `id` integer, required — The unique identifier of the space.
  - `number` integer, required — The number that identifies the space within its owner.
  - `name` string, required — The display name of the space.
  - `description` string, nullable — A description of the space.
  - `general_instructions` string, nullable — General instructions for the Copilot Space.
  - `base_role` 'reader' | 'writer' | 'admin' | 'no_access', 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)
  - `owner` union, required — The user or organization that owns this space.
    - SimpleUser — A GitHub user.
      - `name` string, nullable
      - `email` string, nullable
      - `login` string, required
      - `id` integer, required
      - `node_id` string, required
      - `avatar_url` string, uri, required
      - `gravatar_id` string, nullable, required
      - `url` string, uri, required
      - `html_url` string, uri, required
      - `followers_url` string, uri, required
      - `following_url` string, required
      - `gists_url` string, required
      - `starred_url` string, required
      - `subscriptions_url` string, uri, required
      - `organizations_url` string, uri, required
      - `repos_url` string, uri, required
      - `events_url` string, required
      - `received_events_url` string, uri, required
      - `type` string, required
      - `site_admin` boolean, required
      - `starred_at` string
      - `user_view_type` string
    - OrganizationSimple — A GitHub organization.
      - `login` string, required
      - `id` integer, required
      - `node_id` string, required
      - `url` string, uri, required
      - `repos_url` string, uri, required
      - `events_url` string, uri, required
      - `hooks_url` string, required
      - `issues_url` string, required
      - `members_url` string, required
      - `public_members_url` string, required
      - `avatar_url` string, required
      - `description` string, nullable, required
  - `creator` SimpleUser, required — A GitHub user.
    - `name` string, nullable
    - `email` string, nullable
    - `login` string, required
    - `id` integer, required
    - `node_id` string, required
    - `avatar_url` string, uri, required
    - `gravatar_id` string, nullable, required
    - `url` string, uri, required
    - `html_url` string, uri, required
    - `followers_url` string, uri, required
    - `following_url` string, required
    - `gists_url` string, required
    - `starred_url` string, required
    - `subscriptions_url` string, uri, required
    - `organizations_url` string, uri, required
    - `repos_url` string, uri, required
    - `events_url` string, required
    - `received_events_url` string, uri, required
    - `type` string, required
    - `site_admin` boolean, required
    - `starred_at` string
    - `user_view_type` string
  - `created_at` string, date-time, required — The date and time the space was created.
  - `updated_at` string, date-time, required — The date and time the space was last updated.
  - `html_url` string, uri, required — The HTML URL of the space.
  - `api_url` string, uri, required — The API URL of the space.
  - `resources_attributes` object[] — Resources attached to the space.
    - `id` integer — The unique identifier of the resource.
    - `resource_type` 'repository' | 'github_file' | 'free_text' | 'github_issue' | 'github_pull_request' | 'media_content' | 'uploaded_text_file' — The type of resource.
    - `copilot_chat_attachment_id` integer, nullable — The unique identifier of the chat attachment for uploaded files or media content.
    - `created_at` string, date-time — The date and time the resource was created.
    - `updated_at` string, date-time — The date and time the resource was last updated.
    - `metadata` object — Metadata specific to the resource type.
      - `repository_id` integer — Repository ID for repository or file resources.
      - `file_path` string — File path for file resources.
      - `text` string — Text content for free text resources.
      - `name` string — Name for the resource.
      - `number` integer — Issue or PR number.
      - `copilot_chat_attachment_id` integer — Chat attachment ID for uploaded files or media.
      - `media_type` string — Media type for media content resources.
      - `url` string — URL for media content resources.
      - `height` integer — Height for media content resources.
      - `width` integer — Width for media content resources.

## Other responses

- `403` — Forbidden
- `404` — Resource not found
- `422` — Validation failed, or the endpoint has been spammed.

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-2.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-2/versions/8ae6d0c8716e/schema)
