> For the complete documentation index, see [llms.txt](https://docs.vida.id/identity-stack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vida.id/identity-stack/authentication/authentication-factors/cryptographic-token-pki/integration-methods/api/fetch-public-keys.md).

# Fetch Public Keys

This API endpoint allows you to retrieve the public keys associated with a registered credential ID. The fetched keys include a silent key for silent signing and a presence key for presence signing, enabling cryptographic operations specific to each signing option

## API  Description

## API to fetch public keys

<mark style="color:green;">`POST`</mark> `https://{{environment_url}}/api/v1/device/fetch-public-key`

#### Headers

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| Content-Type<mark style="color:red;">\*</mark>  |        | application/json |
| accept<mark style="color:red;">\*</mark>        | String | \*/\*            |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer \<Token>  |

#### Request Body

| Name                                             | Type   | Description              |
| ------------------------------------------------ | ------ | ------------------------ |
| credential\_id<mark style="color:red;">\*</mark> | String | registered credential id |

#### API Response

### Public Key Request Successful

The fetch public key request is successful and returns the public key

* **`silent_key`** - base64 string of public key used for silent signing&#x20;
* **`presence_key`** - base64 string of public key used for presence signing

HTTP Status Code: `200`

**JSON Response**

```json
{
    "silent_key": "Ng7mjCcU+qag52d… yc+teE1Uxw==",
    "presence_key": "vLQeHY7sFTwU8gVSL… nMyL78rdDjA=="
}
```

### Integration Code Snippets

{% tabs %}
{% tab title="Curl" %}

```groovy
curl -X 'POST' \
'http://{{environment_url}}/api/v1/device/fetch-public-key’\
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <bearer token>' \
-d '{
"credential_id": "21e14436-893e-4254-b00f-fbbdd5fa6066"
}'
```

{% endtab %}
{% endtabs %}
