---
title: "Set selected repositories for a user secret"
method: PUT
path: "/user/codespaces/secrets/{secret_name}/repositories"
tags: ["codespaces"]
---

# Set selected repositories for a user secret

`PUT /user/codespaces/secrets/{secret_name}/repositories`

Select the repositories that will use a user's development environment secret.

The authenticated user must have Codespaces access to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the `codespace` or `codespace:secrets` scope to use this endpoint.

## Path parameters

- `secret_name` string, required

## Request body

- object
  - `selected_repository_ids` integer[], required — An array of repository ids for which a codespace can access the secret. You can manage the list of selected repositories using the [List selected repositories for a user secret](https://docs.github.com/rest/codespaces/secrets#list-selected-repositories-for-a-user-secret), [Add a selected repository to a user secret](https://docs.github.com/rest/codespaces/secrets#add-a-selected-repository-to-a-user-secret), and [Remove a selected repository from a user secret](https://docs.github.com/rest/codespaces/secrets#remove-a-selected-repository-from-a-user-secret) endpoints.

## Response `204`

No Content when repositories were added to the selected list

## Other responses

- `401` — Requires authentication
- `403` — Forbidden
- `404` — Resource not found
- `500` — Internal Error

---

[API](https://skmtc.net/github/apis/rest-api.md) · [All operations](https://skmtc.net/github/apis/rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/rest-api/versions/80850db290cd/schema)
