Search + K

Command Palette

Search for a command to run...

Sign In

Create or update an organization secret

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

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

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

Parameters

path Path Parameters

Name Type
org required

The organization name. The name is not case sensitive.

string
secret_name required

The name of the secret.

string

Request Body

application/json required
{
encrypted_value?: string;
key_id?: string;
visibility: "all" | "private" | "selected";
selected_repository_ids?: number[];
}

Responses

201 application/json

Response when creating a secret

interface EmptyObject {}
204

Response when 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;
}
[]
;
}