Sample - GitHub REST API
PUT/orgs/{org}/codespaces/secrets/{secret_name}/repositories

Set selected repositories for an organization secret

Replaces all repositories for an organization development environment secret when the visibility for repository access is set to selected. The visibility is set when you Create or update an organization secret.

OAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

2 parameters · 1 body field
orgstringrequired
The organization name. The name is not case sensitive.
secret_namestringrequired
The name of the secret.
selected_repository_idsarray<integer>required
An array of repository ids that can access the organization secret. You can only provide a list of repository ids when the `visibility` is set to `selected`. You can add and remove individual repositories using the [Set selected repositories for an organization secret](https://docs.github.com/rest/codespaces/organization-secrets#set-selected-repositories-for-an-organization-secret) and [Remove selected repository from an organization secret](https://docs.github.com/rest/codespaces/organization-secrets#remove-selected-repository-from-an-organization-secret) endpoints.

3 status codes
204Response
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
409Conflict when visibility type not set to selected

Error handling

A 404 is returned: Resource not found. A 409 is returned: Conflict when visibility type not set to selected.