Skip to main content
A API REST agora é versionada. Para obter mais informações, confira "Sobre o controle de versão da API".

REST API endpoints for Copilot Spaces

Use the REST API to interact with Copilot Spaces resources.

List resources for an organization Copilot Space

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.

Tokens de acesso granulares para "List resources for an organization Copilot Space"

Este endpoint funciona com os seguintes tipos de token granulares:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Copilot Spaces" organization permissions (read)

Parâmetros para "List resources for an organization Copilot Space"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

space_number integer Obrigatório

The unique identifier of the Copilot Space.

Códigos de status de resposta HTTP para "List resources for an organization Copilot Space"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

Exemplos de código para "List resources for an organization Copilot Space"

Exemplo de solicitação

get/orgs/{org}/copilot-spaces/{space_number}/resources
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/orgs/ORG/copilot-spaces/SPACE_NUMBER/resources

Response

Status: 200
{ "resources": [ { "id": 1, "resource_type": "repository", "copilot_chat_attachment_id": null, "metadata": { "repository_id": 42 }, "created_at": "2025-01-01T00:00:00Z", "updated_at": "2025-01-01T00:00:00Z" }, { "id": 2, "resource_type": "free_text", "copilot_chat_attachment_id": null, "metadata": { "name": "notes.txt", "text": "Some helpful notes" }, "created_at": "2025-01-01T00:00:00Z", "updated_at": "2025-01-01T00:00:00Z" } ] }

Create a resource for an organization Copilot Space

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.

Tokens de acesso granulares para "Create a resource for an organization Copilot Space"

Este endpoint funciona com os seguintes tipos de token granulares:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Copilot Spaces" organization permissions (write)

Parâmetros para "Create a resource for an organization Copilot Space"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

space_number integer Obrigatório

The unique identifier of the Copilot Space.

Parâmetros do corpo
Nome, Tipo, Descrição
resource_type string Obrigatório

The type of resource to create.

Pode ser um dos: repository, github_file, free_text, github_issue, github_pull_request

metadata object Obrigatório

Resource-specific metadata.

Códigos de status de resposta HTTP para "Create a resource for an organization Copilot Space"

Código de statusDescrição
200

Duplicate github_file resource already exists

201

Resource created

403

Forbidden

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Get a resource for an organization Copilot Space

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.

Tokens de acesso granulares para "Get a resource for an organization Copilot Space"

Este endpoint funciona com os seguintes tipos de token granulares:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Copilot Spaces" organization permissions (read)

Parâmetros para "Get a resource for an organization Copilot Space"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

space_number integer Obrigatório

The unique identifier of the Copilot Space.

space_resource_id integer Obrigatório

The unique identifier of the resource.

Códigos de status de resposta HTTP para "Get a resource for an organization Copilot Space"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

Exemplos de código para "Get a resource for an organization Copilot Space"

Exemplo de solicitação

get/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/orgs/ORG/copilot-spaces/SPACE_NUMBER/resources/SPACE_RESOURCE_ID

Response

Status: 200
{ "id": 1, "resource_type": "free_text", "copilot_chat_attachment_id": null, "metadata": { "name": "notes.txt", "text": "Some helpful notes" }, "created_at": "2025-01-01T00:00:00Z", "updated_at": "2025-01-01T00:00:00Z" }

Set a resource for an organization Copilot Space

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.

Tokens de acesso granulares para "Set a resource for an organization Copilot Space"

Este endpoint funciona com os seguintes tipos de token granulares:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Copilot Spaces" organization permissions (write)

Parâmetros para "Set a resource for an organization Copilot Space"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

space_number integer Obrigatório

The unique identifier of the Copilot Space.

space_resource_id integer Obrigatório

The unique identifier of the resource.

Parâmetros do corpo
Nome, Tipo, Descrição
metadata object

Updated resource-specific metadata.

Códigos de status de resposta HTTP para "Set a resource for an organization Copilot Space"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Set a resource for an organization Copilot Space"

Exemplo de solicitação

put/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/orgs/ORG/copilot-spaces/SPACE_NUMBER/resources/SPACE_RESOURCE_ID \ -d '{"metadata":{"name":"updated-notes.txt","text":"Updated content"}}'

Response

Status: 200
{ "id": 1, "resource_type": "free_text", "copilot_chat_attachment_id": null, "metadata": { "name": "updated-notes.txt", "text": "Updated content" }, "created_at": "2025-01-01T00:00:00Z", "updated_at": "2025-01-01T12:00:00Z" }

Delete a resource from an organization Copilot Space

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.

Tokens de acesso granulares para "Delete a resource from an organization Copilot Space"

Este endpoint funciona com os seguintes tipos de token granulares:

O token refinado deve ter os seguintes conjuntos de permissões:

  • "Copilot Spaces" organization permissions (write)

Parâmetros para "Delete a resource from an organization Copilot Space"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
org string Obrigatório

The organization name. The name is not case sensitive.

space_number integer Obrigatório

The unique identifier of the Copilot Space.

space_resource_id integer Obrigatório

The unique identifier of the resource.

Códigos de status de resposta HTTP para "Delete a resource from an organization Copilot Space"

Código de statusDescrição
204

No Content

403

Forbidden

404

Resource not found

Exemplos de código para "Delete a resource from an organization Copilot Space"

Exemplo de solicitação

delete/orgs/{org}/copilot-spaces/{space_number}/resources/{space_resource_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/orgs/ORG/copilot-spaces/SPACE_NUMBER/resources/SPACE_RESOURCE_ID

Response

Status: 204

List resources for a Copilot Space for a user

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.

Tokens de acesso granulares para "List resources for a Copilot Space for a user"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do GitHub App, tokens de acesso de instalação do GitHub App ou tokens de acesso pessoal com controle refinado.

Parâmetros para "List resources for a Copilot Space for a user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

space_number integer Obrigatório

The unique identifier of the Copilot Space.

Códigos de status de resposta HTTP para "List resources for a Copilot Space for a user"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

Exemplos de código para "List resources for a Copilot Space for a user"

Exemplo de solicitação

get/users/{username}/copilot-spaces/{space_number}/resources
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/users/USERNAME/copilot-spaces/SPACE_NUMBER/resources

Response

Status: 200
{ "resources": [ { "id": 1, "resource_type": "free_text", "copilot_chat_attachment_id": null, "metadata": { "name": "notes.txt", "text": "Some helpful notes" }, "created_at": "2025-01-01T00:00:00Z", "updated_at": "2025-01-01T00:00:00Z" } ] }

Create a resource for a Copilot Space for a user

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.

Tokens de acesso granulares para "Create a resource for a Copilot Space for a user"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do GitHub App, tokens de acesso de instalação do GitHub App ou tokens de acesso pessoal com controle refinado.

Parâmetros para "Create a resource for a Copilot Space for a user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

space_number integer Obrigatório

The unique identifier of the Copilot Space.

Parâmetros do corpo
Nome, Tipo, Descrição
resource_type string Obrigatório

The type of resource to create.

Pode ser um dos: repository, github_file, free_text, github_issue, github_pull_request

metadata object Obrigatório

Resource-specific metadata.

Códigos de status de resposta HTTP para "Create a resource for a Copilot Space for a user"

Código de statusDescrição
200

Duplicate github_file resource already exists

201

Resource created

403

Forbidden

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Get a resource for a Copilot Space for a user

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.

Tokens de acesso granulares para "Get a resource for a Copilot Space for a user"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do GitHub App, tokens de acesso de instalação do GitHub App ou tokens de acesso pessoal com controle refinado.

Parâmetros para "Get a resource for a Copilot Space for a user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

space_number integer Obrigatório

The unique identifier of the Copilot Space.

space_resource_id integer Obrigatório

The unique identifier of the resource.

Códigos de status de resposta HTTP para "Get a resource for a Copilot Space for a user"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

Exemplos de código para "Get a resource for a Copilot Space for a user"

Exemplo de solicitação

get/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/users/USERNAME/copilot-spaces/SPACE_NUMBER/resources/SPACE_RESOURCE_ID

Response

Status: 200
{ "id": 1, "resource_type": "free_text", "copilot_chat_attachment_id": null, "metadata": { "name": "notes.txt", "text": "Some helpful notes" }, "created_at": "2025-01-01T00:00:00Z", "updated_at": "2025-01-01T00:00:00Z" }

Set a resource for a Copilot Space for a user

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.

Tokens de acesso granulares para "Set a resource for a Copilot Space for a user"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do GitHub App, tokens de acesso de instalação do GitHub App ou tokens de acesso pessoal com controle refinado.

Parâmetros para "Set a resource for a Copilot Space for a user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

space_number integer Obrigatório

The unique identifier of the Copilot Space.

space_resource_id integer Obrigatório

The unique identifier of the resource.

Parâmetros do corpo
Nome, Tipo, Descrição
metadata object

Updated resource-specific metadata.

Códigos de status de resposta HTTP para "Set a resource for a Copilot Space for a user"

Código de statusDescrição
200

OK

403

Forbidden

404

Resource not found

422

Validation failed, or the endpoint has been spammed.

Exemplos de código para "Set a resource for a Copilot Space for a user"

Exemplo de solicitação

put/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}
curl -L \ -X PUT \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/users/USERNAME/copilot-spaces/SPACE_NUMBER/resources/SPACE_RESOURCE_ID \ -d '{"metadata":{"name":"updated-notes.txt","text":"Updated content"}}'

Response

Status: 200
{ "id": 1, "resource_type": "free_text", "copilot_chat_attachment_id": null, "metadata": { "name": "updated-notes.txt", "text": "Updated content" }, "created_at": "2025-01-01T00:00:00Z", "updated_at": "2025-01-01T12:00:00Z" }

Delete a resource from a Copilot Space for a user

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.

Tokens de acesso granulares para "Delete a resource from a Copilot Space for a user"

Esse ponto de extremidade não funciona com tokens de acesso de usuário do GitHub App, tokens de acesso de instalação do GitHub App ou tokens de acesso pessoal com controle refinado.

Parâmetros para "Delete a resource from a Copilot Space for a user"

Cabeçalhos
Nome, Tipo, Descrição
accept string

Setting to application/vnd.github+json is recommended.

Parâmetros de caminho
Nome, Tipo, Descrição
username string Obrigatório

The handle for the GitHub user account.

space_number integer Obrigatório

The unique identifier of the Copilot Space.

space_resource_id integer Obrigatório

The unique identifier of the resource.

Códigos de status de resposta HTTP para "Delete a resource from a Copilot Space for a user"

Código de statusDescrição
204

No Content

403

Forbidden

404

Resource not found

Exemplos de código para "Delete a resource from a Copilot Space for a user"

Exemplo de solicitação

delete/users/{username}/copilot-spaces/{space_number}/resources/{space_resource_id}
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ https://api.github.com/users/USERNAME/copilot-spaces/SPACE_NUMBER/resources/SPACE_RESOURCE_ID

Response

Status: 204