Skip to content

Get an environment public key

GET
/repos/{owner}/{repo}/environments/{environment_name}/secrets/public-key

Get the public key for an environment, which you need to encrypt environment secrets. You need to encrypt a secret before you can create or update secrets.

Anyone with read access to the repository can use this endpoint.

If the repository is private, OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

API method documentation

owner
required
string

The account owner of the repository. The name is not case sensitive.

repo
required
string

The name of the repository without the .git extension. The name is not case sensitive.

environment_name
required
string

The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.

Response

Media type application/json
ActionsPublicKey

The public key used for setting Actions Secrets.

object
key_id
required

The identifier for the key.

string
key
required

The Base64 encoded public key.

string
id
integer
url
string
title
string
created_at
string
Examples
Example default
{
"key_id": "012345678912345678",
"key": "2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"
}