v56

latestOpenAPI 3.0.3MITraw.githubusercontent.com2026-08-011,21696712.2 MB
codespaces

Create or update a secret for the authenticated user

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.

put/user/codespaces/secrets/{secret_name}

Path parameters

secret_namestring required

The name of the secret.

Request body

encrypted_valuestring

Value for your secret, encrypted with LibSodium using the public key retrieved from the Get the public key for the authenticated user endpoint.

key_idstring required

ID of the key you used to encrypt the secret.

Response

Response after successfully creating a secret

EmptyObject required

An object without any properties.