---
title: "Get an environment public key"
method: GET
path: "/repos/{owner}/{repo}/environments/{environment_name}/secrets/public-key"
tags: ["actions"]
---

# 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.

## Path parameters

- `owner` string, required
- `repo` string, required
- `environment_name` string, required

## Response `200`

Response

- ActionsPublicKey — The public key used for setting Actions Secrets.
  - `key_id` string, required — The identifier for the key.
  - `key` string, required — The Base64 encoded public key.
  - `id` integer
  - `url` string
  - `title` string
  - `created_at` string

---

[API](https://skmtc.net/github/apis/rest.md) · [All operations](https://skmtc.net/github/apis/rest/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/rest/revisions/4de17f376556/schema)
