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.
Jetons d'accès granulaires pour «List resources for an organization Copilot Space»
Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:
- jetons d’accès utilisateur de l’application GitHub
- jetons d’accès d’installation de l’application GitHub
- Tokens d’accès personnel à granularité fine
Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:
- "Copilot Spaces" organization permissions (read)
Paramètres pour «List resources for an organization Copilot Space »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
org string RequisThe organization name. The name is not case sensitive. |
space_number integer RequisThe unique identifier of the Copilot Space. |
Codes d’état de réponse HTTP pour «List resources for an organization Copilot Space »
| Code de statut | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
Exemples de code pour «List resources for an organization Copilot Space »
Exemple de requête
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.
Jetons d'accès granulaires pour «Create a resource for an organization Copilot Space»
Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:
- jetons d’accès utilisateur de l’application GitHub
- jetons d’accès d’installation de l’application GitHub
- Tokens d’accès personnel à granularité fine
Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:
- "Copilot Spaces" organization permissions (write)
Paramètres pour «Create a resource for an organization Copilot Space »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
org string RequisThe organization name. The name is not case sensitive. |
space_number integer RequisThe unique identifier of the Copilot Space. |
| Nom, Type, Description |
|---|
resource_type string RequisThe type of resource to create. Peut être l'un des: |
metadata object RequisResource-specific metadata. |
Codes d’état de réponse HTTP pour «Create a resource for an organization Copilot Space »
| Code de statut | 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.
Jetons d'accès granulaires pour «Get a resource for an organization Copilot Space»
Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:
- jetons d’accès utilisateur de l’application GitHub
- jetons d’accès d’installation de l’application GitHub
- Tokens d’accès personnel à granularité fine
Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:
- "Copilot Spaces" organization permissions (read)
Paramètres pour «Get a resource for an organization Copilot Space »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
org string RequisThe organization name. The name is not case sensitive. |
space_number integer RequisThe unique identifier of the Copilot Space. |
space_resource_id integer RequisThe unique identifier of the resource. |
Codes d’état de réponse HTTP pour «Get a resource for an organization Copilot Space »
| Code de statut | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
Exemples de code pour «Get a resource for an organization Copilot Space »
Exemple de requête
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.
Jetons d'accès granulaires pour «Set a resource for an organization Copilot Space»
Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:
- jetons d’accès utilisateur de l’application GitHub
- jetons d’accès d’installation de l’application GitHub
- Tokens d’accès personnel à granularité fine
Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:
- "Copilot Spaces" organization permissions (write)
Paramètres pour «Set a resource for an organization Copilot Space »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
org string RequisThe organization name. The name is not case sensitive. |
space_number integer RequisThe unique identifier of the Copilot Space. |
space_resource_id integer RequisThe unique identifier of the resource. |
| Nom, Type, Description |
|---|
metadata object Updated resource-specific metadata. |
Codes d’état de réponse HTTP pour «Set a resource for an organization Copilot Space »
| Code de statut | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Exemples de code pour «Set a resource for an organization Copilot Space »
Exemple de requête
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.
Jetons d'accès granulaires pour «Delete a resource from an organization Copilot Space»
Ce point de terminaison fonctionne avec les types de tokens à granularité fine suivants:
- jetons d’accès utilisateur de l’application GitHub
- jetons d’accès d’installation de l’application GitHub
- Tokens d’accès personnel à granularité fine
Le token à granularité fine doit disposer de l’ensemble d’autorisations suivant:
- "Copilot Spaces" organization permissions (write)
Paramètres pour «Delete a resource from an organization Copilot Space »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
org string RequisThe organization name. The name is not case sensitive. |
space_number integer RequisThe unique identifier of the Copilot Space. |
space_resource_id integer RequisThe unique identifier of the resource. |
Codes d’état de réponse HTTP pour «Delete a resource from an organization Copilot Space »
| Code de statut | Description |
|---|---|
204 | No Content |
403 | Forbidden |
404 | Resource not found |
Exemples de code pour «Delete a resource from an organization Copilot Space »
Exemple de requête
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.
Jetons d'accès granulaires pour «List resources for a Copilot Space for a user»
Ce point de terminaison ne fonctionne pas avec des jetons d’accès utilisateur de l'application GitHub, les jetons d’accès d’installation de l'application GitHub, ou des jetons d’accès personnels affinés.
Paramètres pour «List resources for a Copilot Space for a user »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
username string RequisThe handle for the GitHub user account. |
space_number integer RequisThe unique identifier of the Copilot Space. |
Codes d’état de réponse HTTP pour «List resources for a Copilot Space for a user »
| Code de statut | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
Exemples de code pour «List resources for a Copilot Space for a user »
Exemple de requête
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.
Jetons d'accès granulaires pour «Create a resource for a Copilot Space for a user»
Ce point de terminaison ne fonctionne pas avec des jetons d’accès utilisateur de l'application GitHub, les jetons d’accès d’installation de l'application GitHub, ou des jetons d’accès personnels affinés.
Paramètres pour «Create a resource for a Copilot Space for a user »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
username string RequisThe handle for the GitHub user account. |
space_number integer RequisThe unique identifier of the Copilot Space. |
| Nom, Type, Description |
|---|
resource_type string RequisThe type of resource to create. Peut être l'un des: |
metadata object RequisResource-specific metadata. |
Codes d’état de réponse HTTP pour «Create a resource for a Copilot Space for a user »
| Code de statut | 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.
Jetons d'accès granulaires pour «Get a resource for a Copilot Space for a user»
Ce point de terminaison ne fonctionne pas avec des jetons d’accès utilisateur de l'application GitHub, les jetons d’accès d’installation de l'application GitHub, ou des jetons d’accès personnels affinés.
Paramètres pour «Get a resource for a Copilot Space for a user »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
username string RequisThe handle for the GitHub user account. |
space_number integer RequisThe unique identifier of the Copilot Space. |
space_resource_id integer RequisThe unique identifier of the resource. |
Codes d’état de réponse HTTP pour «Get a resource for a Copilot Space for a user »
| Code de statut | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
Exemples de code pour «Get a resource for a Copilot Space for a user »
Exemple de requête
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.
Jetons d'accès granulaires pour «Set a resource for a Copilot Space for a user»
Ce point de terminaison ne fonctionne pas avec des jetons d’accès utilisateur de l'application GitHub, les jetons d’accès d’installation de l'application GitHub, ou des jetons d’accès personnels affinés.
Paramètres pour «Set a resource for a Copilot Space for a user »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
username string RequisThe handle for the GitHub user account. |
space_number integer RequisThe unique identifier of the Copilot Space. |
space_resource_id integer RequisThe unique identifier of the resource. |
| Nom, Type, Description |
|---|
metadata object Updated resource-specific metadata. |
Codes d’état de réponse HTTP pour «Set a resource for a Copilot Space for a user »
| Code de statut | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Exemples de code pour «Set a resource for a Copilot Space for a user »
Exemple de requête
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.
Jetons d'accès granulaires pour «Delete a resource from a Copilot Space for a user»
Ce point de terminaison ne fonctionne pas avec des jetons d’accès utilisateur de l'application GitHub, les jetons d’accès d’installation de l'application GitHub, ou des jetons d’accès personnels affinés.
Paramètres pour «Delete a resource from a Copilot Space for a user »
| Nom, Type, Description |
|---|
accept string Setting to |
| Nom, Type, Description |
|---|
username string RequisThe handle for the GitHub user account. |
space_number integer RequisThe unique identifier of the Copilot Space. |
space_resource_id integer RequisThe unique identifier of the resource. |
Codes d’état de réponse HTTP pour «Delete a resource from a Copilot Space for a user »
| Code de statut | Description |
|---|---|
204 | No Content |
403 | Forbidden |
404 | Resource not found |
Exemples de code pour «Delete a resource from a Copilot Space for a user »
Exemple de requête
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