PUT
/user/codespaces/secrets/{secret_name}/repositories/{repository_id}Add a repository to a user secret
Adds a repository to the selected repositories for an authenticated user's Codespaces secret. Use this operation to grant the secret access to a specific repository. The authenticated user must have Codespaces access, and OAuth app tokens and personal access tokens (classic) must include the codespace or codespace:secrets scope.
secret_namestringrequired
The name of the Codespaces secret to update.
repository_idintegerrequired
The unique identifier of the repository to add to the secret's selected repositories.
204Returns no content after adding the repository to the secret's selected repositories.
401Returned when authentication is required but missing or invalid.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Returned when the authenticated user is forbidden from using this endpoint.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the requested resource is not found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
500Returned when an internal error occurs.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
Error handling
A 401 is returned when authentication is missing or invalid. A 403 is returned if the authenticated user lacks Codespaces access or the token lacks the codespace or codespace:secrets scope. A 404 indicates the secret or repository could not be found; a 500 indicates an internal error.