---
title: "Get entity public encryption keys"
method: GET
path: "/entities/{entityDID}/public-keys"
tags: ["Entities"]
---

# Get entity public encryption keys

`GET /entities/{entityDID}/public-keys`

Returns the encryption key that would be sent in webhooks for the given entity.
This allows counterparties to proactively fetch encryption keys without waiting
for a RequirePresentation webhook.

**V1 VASP Handling:**
For entities using the TRNow protocol (V1 VASPs with did:ethr DIDs), this endpoint
automatically returns the Gateway VASP's encryption keys instead of the entity's own keys,
since V1 VASPs don't have their own encryption keys. The response includes a `gatewayDID`
field to indicate this.

**Performance Optimization:**
For did:web entities in the local database, encryption keys are resolved directly
without Network API calls, enabling fast response times for local V2 entities.

**Key Selection Priority:**
Uses the same priority algorithm as webhook sending:
1. Keys ending with "#pii" (highest priority)
2. Keys ending with "#notabene-pii"
3. Keys with type "X25519KeyAgreementKey2019"
4. First available key (fallback)

Response is cached via Veramo's DID resolution cache (5 minute TTL).

## Path parameters

- `entityDID` string, did, required — Decentralized Identifier (DID)

## Response `200`

Successfully retrieved encryption key

- object
  - `entityDID` string — The entity's DID
  - `encryptionKey` object — The selected encryption key
    - `id` string — Key identifier
    - `type` string — Key type
    - `controller` string — DID that controls this key
    - `publicKeyHex` string — Public key in hexadecimal format
    - `publicKeyBase58` string — Public key in Base58 format
  - `gatewayDID` string — Present only for V1 VASPs - indicates Gateway VASP DID used for encryption

## Other responses

- `404` — Entity or encryption keys not found
- `500` — Server error
- `503` — DID resolution failed

---

[API](https://skmtc.net/notabene/apis/notabene-api.md) · [All operations](https://skmtc.net/notabene/apis/notabene-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/notabene/notabene-api/versions/70056745a433/schema)
