Skip to content

Get a secret for the authenticated user

GET
/user/codespaces/secrets/{secret_name}

Gets a development environment secret available to a user’s codespaces without revealing its encrypted value.

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

secret_name
required
string

The name of the secret.

Response

Media type application/json
Codespaces Secret

Secrets for a GitHub Codespace.

object
name
required

The name of the secret

string
created_at
required

The date and time at which the secret was created, in ISO 8601 format’:’ YYYY-MM-DDTHH:MM:SSZ.

string format: date-time
updated_at
required

The date and time at which the secret was last updated, in ISO 8601 format’:’ YYYY-MM-DDTHH:MM:SSZ.

string format: date-time
visibility
required

The type of repositories in the organization that the secret is visible to

string
Allowed values: all private selected
selected_repositories_url
required

The API URL at which the list of repositories this secret is visible to can be retrieved

string format: uri
Examples
Example default
{
"name": "CODESPACE_GH_SECRET",
"created_at": "2019-08-10T14:59:22Z",
"updated_at": "2020-01-10T14:59:22Z",
"visibility": "selected",
"selected_repositories_url": "https://api.github.com/user/codespaces/secrets/CODESPACE_GH_SECRET/repositories"
}