# List GPG keys for the authenticated user

From **GitHub v3 REST API**.

`GET /user/gpg_keys`

Lists the current user's GPG keys. Requires that you are authenticated via Basic Auth or via OAuth with at least `read:gpg_key` [scope](https://docs.github.com/enterprise-server@3.0/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/).

## Parameters

### `per_page`

- Location: query
- Required: false
- Type: `integer`
- Default: `30`

Results per page (max 100)

### `page`

- Location: query
- Required: false
- Type: `integer`
- Default: `1`

Page number of the results to fetch.

## Responses

### `200`

Response

#### Headers

##### `Link`

- Type: `string`

- Example: `<https://api.github.com/resource?page=2>; rel="next", <https://api.github.com/resource?page=5>; rel="last"`

### `application/json`

- Type: `array`

```json
[
  {
    "can_certify": true,
    "can_encrypt_comms": false,
    "can_encrypt_storage": false,
    "can_sign": true,
    "created_at": "2016-03-24T11:31:04-06:00",
    "emails": [
      {
        "email": "mastahyeti@users.noreply.github.com",
        "verified": true
      }
    ],
    "expires_at": "2016-03-24T11:31:04-07:00",
    "id": 3,
    "key_id": "3262EFF25BA0D270",
    "primary_key_id": 2,
    "public_key": "xsBNBFayYZ...",
    "raw_key": "string",
    "subkeys": [
      {
        "can_certify": false,
        "can_encrypt_comms": true,
        "can_encrypt_storage": true,
        "can_sign": false,
        "created_at": "2016-03-24T11:31:04-06:00",
        "emails": [],
        "expires_at": "2016-03-24T11:31:04-07:00",
        "id": 4,
        "key_id": "4A595D4C72EE49C7",
        "primary_key_id": 3,
        "public_key": "zsBNBFayYZ...",
        "subkeys": []
      }
    ]
  }
]
```

```json
{"items":{"$ref":"#/components/schemas/gpg-key"},"type":"array"}
```

### `304`

Not modified

### `401`

Requires authentication

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `403`

Forbidden

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `404`

Resource not found

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

## Request examples

### cURL

```shell
curl --request GET \
  --url {protocol}://{hostname}/api/v3/user/gpg_keys
```
