# List GPG keys for a user

From **GitHub v3 REST API**.

`GET /users/{username}/gpg_keys`

Lists the GPG keys for a user. This information is accessible by anyone.

## Parameters

### `username`

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

### `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"}
```

## Request examples

### cURL

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