Skip to content

Get public key for the authenticated user

GET
/user/codespaces/secrets/public-key

Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets.

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.

API method documentation

Response

Media type application/json
CodespacesUserPublicKey

The public key used for setting user Codespaces’ Secrets.

object
key_id
required

The identifier for the key.

string
key
required

The Base64 encoded public key.

string
Examples
Example default
{
"key_id": "012345678912345678",
"key": "2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"
}