REST API endpoints for Copilot Spaces resources

Use the REST API to interact with Copilot Spaces resources.

Note

Most endpoints use Authorization: Bearer <YOUR-TOKEN> and Accept: application/vnd.github+json headers, plus X-GitHub-Api-Version: 2026-03-10. Curl examples below omit these standard headers for brevity.

List resources for an organization Copilot Space

GET /orgs/{org}/copilot-spaces/{space_number}/resources

Lists all resources attached to a specific Copilot Space owned by an organization.
The authenticated user must have appropriate permissions to view the space.
OAuth app tokens and personal access tokens (classic) need the read:org scope to use this endpoint.
Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X GET \
  https://api.github.com/orgs/ORG/copilot-spaces/SPACE_NUMBER/resources

Response schema (Status: 200):

Create a resource for an organization Copilot Space

POST /orgs/{org}/copilot-spaces/{space_number}/resources

Creates a new resource in a specific Copilot Space owned by an organization.
The authenticated user must have write permissions on the space.
The following resource types are supported: repository, github_file, free_text, github_issue, github_pull_request.
The uploaded_text_file and media_content types are not supported via this endpoint.
For github_file resources, if a resource with the same repository, file path, and SHA already exists, the existing resource is returned with a 200 status.
OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.
Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space, including the resource being created.

Parameters

Headers

Path and query parameters

Body parameters

HTTP response status codes

Code examples

Example 1: Status Code 201

Request:

curl -L \
  -X POST \
  https://api.github.com/orgs/ORG/copilot-spaces/SPACE_NUMBER/resources \
  -d '{
  "resource_type": "free_text",
  "metadata": {
    "name": "notes.txt",
    "text": "Some helpful notes"
  }
}'

Response schema (Status: 201):

Example 2: Status Code 201

Request:

curl -L \
  -X POST \
  https://api.github.com/orgs/ORG/copilot-spaces/SPACE_NUMBER/resources \
  -d '{
  "resource_type": "repository",
  "metadata": {
    "repository_id": 42
  }
}'

Response schema (Status: 201):

Example 3: Status Code 201

Request:

curl -L \
  -X POST \
  https://api.github.com/orgs/ORG/copilot-spaces/SPACE_NUMBER/resources \
  -d '{
  "resource_type": "github_file",
  "metadata": {
    "repository_id": 42,
    "file_path": "README.md",
    "sha": "abc123"
  }
}'

Response schema (Status: 201):

Get a resource for an organization Copilot Space

GET /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}

Gets a specific resource attached to a Copilot Space owned by an organization.
The authenticated user must have appropriate permissions to view the space.
OAuth app tokens and personal access tokens (classic) need the read:org scope to use this endpoint.
Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X GET \
  https://api.github.com/orgs/ORG/copilot-spaces/SPACE_NUMBER/resources/SPACE_RESOURCE_ID

Response schema (Status: 200):

Same response schema as Create a resource for an organization Copilot Space.

Set a resource for an organization Copilot Space

PUT /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}

Updates the metadata of a resource in a specific Copilot Space owned by an organization.
The authenticated user must have write permissions on the space.
OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.
Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space, including the resource being updated.

Parameters

Headers

Path and query parameters

Body parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X PUT \
  https://api.github.com/orgs/ORG/copilot-spaces/SPACE_NUMBER/resources/SPACE_RESOURCE_ID \
  -d '{
  "metadata": {
    "name": "updated-notes.txt",
    "text": "Updated content"
  }
}'

Response schema (Status: 200):

Same response schema as Create a resource for an organization Copilot Space.

Delete a resource from an organization Copilot Space

DELETE /orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}

Deletes a resource from a specific Copilot Space owned by an organization.
The authenticated user must have write permissions on the space.
OAuth app tokens and personal access tokens (classic) need the write:org scope to use this endpoint.
Fine-grained tokens and GitHub App user access tokens must have been granted access to the organization that owns the space. They must also have been granted access to every repository referenced by resources in the space.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X DELETE \
  https://api.github.com/orgs/ORG/copilot-spaces/SPACE_NUMBER/resources/SPACE_RESOURCE_ID

Response schema (Status: 204):

List resources for a Copilot Space for a user

GET /users/{username}/copilot-spaces/{space_number}/resources

Lists all resources attached to a specific Copilot Space owned by a user.
The authenticated user must have appropriate permissions to view the space.
OAuth app tokens and personal access tokens (classic) need the read:user scope to use this endpoint.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X GET \
  https://api.github.com/users/USERNAME/copilot-spaces/SPACE_NUMBER/resources

Response schema (Status: 200):

Same response schema as List resources for an organization Copilot Space.

Create a resource for a Copilot Space for a user

POST /users/{username}/copilot-spaces/{space_number}/resources

Creates a new resource in a specific Copilot Space owned by a user.
The authenticated user must have write permissions on the space.
The following resource types are supported: repository, github_file, free_text, github_issue, github_pull_request.
The uploaded_text_file and media_content types are not supported via this endpoint.
For github_file resources, if a resource with the same repository, file path, and SHA already exists, the existing resource is returned with a 200 status.
OAuth app tokens and personal access tokens (classic) need the write:user scope to use this endpoint.

Parameters

Headers

Path and query parameters

Body parameters

HTTP response status codes

Code examples

Example 1: Status Code 201

Request:

curl -L \
  -X POST \
  https://api.github.com/users/USERNAME/copilot-spaces/SPACE_NUMBER/resources \
  -d '{
  "resource_type": "free_text",
  "metadata": {
    "name": "notes.txt",
    "text": "Some helpful notes"
  }
}'

Response schema (Status: 201):

Same response schema as Create a resource for an organization Copilot Space.

Example 2: Status Code 201

Request:

curl -L \
  -X POST \
  https://api.github.com/users/USERNAME/copilot-spaces/SPACE_NUMBER/resources \
  -d '{
  "resource_type": "repository",
  "metadata": {
    "repository_id": 42
  }
}'

Response schema (Status: 201):

Same response schema as Create a resource for an organization Copilot Space.

Example 3: Status Code 201

Request:

curl -L \
  -X POST \
  https://api.github.com/users/USERNAME/copilot-spaces/SPACE_NUMBER/resources \
  -d '{
  "resource_type": "github_file",
  "metadata": {
    "repository_id": 42,
    "file_path": "README.md",
    "sha": "abc123"
  }
}'

Response schema (Status: 201):

Same response schema as Create a resource for an organization Copilot Space.

Get a resource for a Copilot Space for a user

GET /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}

Gets a specific resource attached to a Copilot Space owned by a user.
The authenticated user must have appropriate permissions to view the space.
OAuth app tokens and personal access tokens (classic) need the read:user scope to use this endpoint.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X GET \
  https://api.github.com/users/USERNAME/copilot-spaces/SPACE_NUMBER/resources/SPACE_RESOURCE_ID

Response schema (Status: 200):

Same response schema as Create a resource for an organization Copilot Space.

Set a resource for a Copilot Space for a user

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

Updates the metadata of a resource in a specific Copilot Space owned by a user.
The authenticated user must have write permissions on the space.
OAuth app tokens and personal access tokens (classic) need the write:user scope to use this endpoint.

Parameters

Headers

Path and query parameters

Body parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X PUT \
  https://api.github.com/users/USERNAME/copilot-spaces/SPACE_NUMBER/resources/SPACE_RESOURCE_ID \
  -d '{
  "metadata": {
    "name": "updated-notes.txt",
    "text": "Updated content"
  }
}'

Response schema (Status: 200):

Same response schema as Create a resource for an organization Copilot Space.

Delete a resource from a Copilot Space for a user

DELETE /users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}

Deletes a resource from a specific Copilot Space owned by a user.
The authenticated user must have write permissions on the space.
OAuth app tokens and personal access tokens (classic) need the write:user scope to use this endpoint.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X DELETE \
  https://api.github.com/users/USERNAME/copilot-spaces/SPACE_NUMBER/resources/SPACE_RESOURCE_ID

Response schema (Status: 204):