Search + K

Command Palette

Search for a command to run...

Sign In

Create or update a secret for the authenticated user

PUT /user/codespaces/secrets/{secret_name}
Copy endpoint
https://api.github.com

Creates or updates a development environment secret for a user's codespace with an encrypted value. Encrypt your secret using LibSodium. For more information, see "Encrypting secrets for the REST API."

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.

Parameters

path Path Parameters

Name Type
secret_name required

The name of the secret.

string

Request Body

application/json required
{ encrypted_value?: string;key_id: string;selected_repository_ids?: (string | number)[]; }

Responses

201 application/json

Response after successfully creating a secret

interface EmptyObject {}
204

Response after successfully updating a secret

unknown

Client Errors

404 application/json

Resource not found

interface BasicError {
message?: string;
documentation_url?: string;
url?: string;
status?: string;
}
422 application/json

Validation failed, or the endpoint has been spammed.

interface ValidationError {
message: string;
documentation_url: string;
errors?: {
resource?: string;
field?: string;
message?: string;
code: string;
index?: number;
value?: string[] | string | number | null;
}
[]
;
}