Конечные точки REST API для ресурсов Copilot Spaces
Используйте REST API для взаимодействия с ресурсами Copilot Spaces.
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.
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.
Детализированные токены доступа для «List resources for an organization Copilot Space»
Эта конечная точка работает со следующими точными типами маркеров:
- Жетоны доступа пользователей приложения GitHub
- Токены доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Copilot Spaces" organization permissions (read)
Параметры для «List resources for an organization Copilot Space»
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
org string Обязательное полеThe organization name. The name is not case sensitive. |
space_number integer Обязательное полеThe unique identifier of the Copilot Space. |
HTTP-коды статуса ответа для «List resources for an organization Copilot Space»
| Код состояния | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
Примеры кода для «List resources for an organization Copilot Space»
Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.
Пример запроса
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/resourcesResponse
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.
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.
Детализированные токены доступа для «Create a resource for an organization Copilot Space»
Эта конечная точка работает со следующими точными типами маркеров:
- Жетоны доступа пользователей приложения GitHub
- Токены доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Copilot Spaces" organization permissions (write)
Параметры для «Create a resource for an organization Copilot Space»
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
org string Обязательное полеThe organization name. The name is not case sensitive. |
space_number integer Обязательное полеThe unique identifier of the Copilot Space. |
| Имя., Тип, Description |
|---|
resource_type string Обязательное полеThe type of resource to create. Возможные значения: |
metadata object Обязательное полеResource-specific metadata. |
HTTP-коды статуса ответа для «Create a resource for an organization Copilot Space»
| Код состояния | Description |
|---|---|
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.
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.
Детализированные токены доступа для «Get a resource for an organization Copilot Space»
Эта конечная точка работает со следующими точными типами маркеров:
- Жетоны доступа пользователей приложения GitHub
- Токены доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Copilot Spaces" organization permissions (read)
Параметры для «Get a resource for an organization Copilot Space»
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
org string Обязательное полеThe organization name. The name is not case sensitive. |
space_number integer Обязательное полеThe unique identifier of the Copilot Space. |
space_resource_id integer Обязательное полеThe unique identifier of the resource. |
HTTP-коды статуса ответа для «Get a resource for an organization Copilot Space»
| Код состояния | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
Примеры кода для «Get a resource for an organization Copilot Space»
Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.
Пример запроса
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_IDResponse
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.
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.
Детализированные токены доступа для «Set a resource for an organization Copilot Space»
Эта конечная точка работает со следующими точными типами маркеров:
- Жетоны доступа пользователей приложения GitHub
- Токены доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Copilot Spaces" organization permissions (write)
Параметры для «Set a resource for an organization Copilot Space»
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
org string Обязательное полеThe organization name. The name is not case sensitive. |
space_number integer Обязательное полеThe unique identifier of the Copilot Space. |
space_resource_id integer Обязательное полеThe unique identifier of the resource. |
| Имя., Тип, Description |
|---|
metadata object Updated resource-specific metadata. |
HTTP-коды статуса ответа для «Set a resource for an organization Copilot Space»
| Код состояния | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Примеры кода для «Set a resource for an organization Copilot Space»
Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.
Пример запроса
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.
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.
Детализированные токены доступа для «Delete a resource from an organization Copilot Space»
Эта конечная точка работает со следующими точными типами маркеров:
- Жетоны доступа пользователей приложения GitHub
- Токены доступа к установке приложений GitHub
- Точные личные маркеры доступа
Маркер с точной детализацией должен иметь следующий набор разрешений.:
- "Copilot Spaces" organization permissions (write)
Параметры для «Delete a resource from an organization Copilot Space»
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
org string Обязательное полеThe organization name. The name is not case sensitive. |
space_number integer Обязательное полеThe unique identifier of the Copilot Space. |
space_resource_id integer Обязательное полеThe unique identifier of the resource. |
HTTP-коды статуса ответа для «Delete a resource from an organization Copilot Space»
| Код состояния | Description |
|---|---|
204 | No Content |
403 | Forbidden |
404 | Resource not found |
Примеры кода для «Delete a resource from an organization Copilot Space»
Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.
Пример запроса
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_IDResponse
Status: 204List 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.
Детализированные токены доступа для «List resources for a Copilot Space for a user»
Эта конечная точка не работает с пользовательскими токенами доступа GitHub App, токенами доступа для установки GitHub App или детализированными персональными токенами доступа.
Параметры для «List resources for a Copilot Space for a user»
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
username string Обязательное полеThe handle for the GitHub user account. |
space_number integer Обязательное полеThe unique identifier of the Copilot Space. |
HTTP-коды статуса ответа для «List resources for a Copilot Space for a user»
| Код состояния | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
Примеры кода для «List resources for a Copilot Space for a user»
Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.
Пример запроса
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/resourcesResponse
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.
Детализированные токены доступа для «Create a resource for a Copilot Space for a user»
Эта конечная точка не работает с пользовательскими токенами доступа GitHub App, токенами доступа для установки GitHub App или детализированными персональными токенами доступа.
Параметры для «Create a resource for a Copilot Space for a user»
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
username string Обязательное полеThe handle for the GitHub user account. |
space_number integer Обязательное полеThe unique identifier of the Copilot Space. |
| Имя., Тип, Description |
|---|
resource_type string Обязательное полеThe type of resource to create. Возможные значения: |
metadata object Обязательное полеResource-specific metadata. |
HTTP-коды статуса ответа для «Create a resource for a Copilot Space for a user»
| Код состояния | Description |
|---|---|
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.
Детализированные токены доступа для «Get a resource for a Copilot Space for a user»
Эта конечная точка не работает с пользовательскими токенами доступа GitHub App, токенами доступа для установки GitHub App или детализированными персональными токенами доступа.
Параметры для «Get a resource for a Copilot Space for a user»
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
username string Обязательное полеThe handle for the GitHub user account. |
space_number integer Обязательное полеThe unique identifier of the Copilot Space. |
space_resource_id integer Обязательное полеThe unique identifier of the resource. |
HTTP-коды статуса ответа для «Get a resource for a Copilot Space for a user»
| Код состояния | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
Примеры кода для «Get a resource for a Copilot Space for a user»
Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.
Пример запроса
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_IDResponse
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.
Детализированные токены доступа для «Set a resource for a Copilot Space for a user»
Эта конечная точка не работает с пользовательскими токенами доступа GitHub App, токенами доступа для установки GitHub App или детализированными персональными токенами доступа.
Параметры для «Set a resource for a Copilot Space for a user»
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
username string Обязательное полеThe handle for the GitHub user account. |
space_number integer Обязательное полеThe unique identifier of the Copilot Space. |
space_resource_id integer Обязательное полеThe unique identifier of the resource. |
| Имя., Тип, Description |
|---|
metadata object Updated resource-specific metadata. |
HTTP-коды статуса ответа для «Set a resource for a Copilot Space for a user»
| Код состояния | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Примеры кода для «Set a resource for a Copilot Space for a user»
Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.
Пример запроса
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.
Детализированные токены доступа для «Delete a resource from a Copilot Space for a user»
Эта конечная точка не работает с пользовательскими токенами доступа GitHub App, токенами доступа для установки GitHub App или детализированными персональными токенами доступа.
Параметры для «Delete a resource from a Copilot Space for a user»
| Имя., Тип, Description |
|---|
accept string Setting to |
| Имя., Тип, Description |
|---|
username string Обязательное полеThe handle for the GitHub user account. |
space_number integer Обязательное полеThe unique identifier of the Copilot Space. |
space_resource_id integer Обязательное полеThe unique identifier of the resource. |
HTTP-коды статуса ответа для «Delete a resource from a Copilot Space for a user»
| Код состояния | Description |
|---|---|
204 | No Content |
403 | Forbidden |
404 | Resource not found |
Примеры кода для «Delete a resource from a Copilot Space for a user»
Если вы получаете доступ к GitHub на GHE.com, замените api.github.com на выделенный поддомен вашего предприятия в api.SUBDOMAIN.ghe.com.
Пример запроса
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_IDResponse
Status: 204