# Get Session JWT Public Key

{% hint style="info" %}
Retrieve the public key used to verify session JWTs locally.
{% endhint %}

**Endpoint:** `/jwt/publicKey`\
**Method:** GET

{% tabs %}
{% tab title="Success Response (200)" %}

```typescript
{
    publicKey: string; // Base64 encoded public key
}
```

{% endtab %}

{% tab title="Error Response (400)" %}

```typescript
{
    error: string;
}
```

{% endtab %}
{% endtabs %}

## Example Usage

```typescript
// Fetch the public key
const response = await axios.get(apiEndpoint + '/jwt/publicKey');
const publicKey = response.data.publicKey;

// Verify a JWT locally
const decodedToken = jwt.verify(token, Buffer.from(publicKey, 'base64').toString('utf-8'), { algorithms: ['ES256'] });
```

{% hint style="info" %}
The public key can be used to verify session JWTs locally without making API calls.
{% endhint %}

{% hint style="warning" %}
Cache the public key and reuse it for multiple verifications. Only fetch a new key if verification fails.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.plyr.network/api-reference/misc/get-session-jwt-public-key.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
