# Get a repository public key

From **GitHub v3 REST API**.

`GET /repos/{owner}/{repo}/actions/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. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `secrets` repository permission to use this endpoint.

## Parameters

### `owner`

- Location: path
- Required: true
- Type: `string`

### `repo`

- Location: path
- Required: true
- Type: `string`

## Responses

### `200`

Response

### `application/json`

- Type: `object`

The public key used for setting Actions Secrets.

```json
{
  "key": "2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234",
  "key_id": "012345678912345678"
}
```

```json
{"description":"The public key used for setting Actions Secrets.","properties":{"created_at":{"example":"2011-01-26T19:01:12Z","type":"string"},"id":{"example":2,"type":"integer"},"key":{"description":"The Base64 encoded public key.","example":"hBT5WZEj8ZoOv6TYJsfWq7MxTEQopZO5/IT3ZCVQPzs=","type":"string"},"key_id":{"description":"The identifier for the key.","example":"1234567","type":"string"},"title":{"example":"ssh-rsa AAAAB3NzaC1yc2EAAA","type":"string"},"url":{"example":"https://api.github.com/user/keys/2","type":"string"}},"required":["key_id","key"],"title":"ActionsPublicKey","type":"object"}
```

## Request examples

### cURL

```shell
curl --request GET \
  --url {protocol}://{hostname}/api/v3/repos/{owner}/{repo}/actions/secrets/public-key
```
