Retrieve Credentials
Get access to credentials you care about
Retrieving and effectively presenting credentials is essential for issuers, verifiers, and credential subjects. However, doing so requires interfacing with the blockchain, 3rd party services to fetch NFTs, all while at the same time struggling with unpredictable network issues, and data inconsistency.
Crossmint’s Verifiable Credentials API and SDK simplify credential management, allowing you to seamlessly retrieve and use verifiable credentials where they matter most.
Verifiable Credential API
Crossmint’s Verifiable Credentials API is primarily meant to be used by issuers. It’s designed for robust backend operations, enabling seamless, automated credential retrieval without requiring user interaction.
The API integrates with your existing server-side infrastructure, ensuring efficient and scalable credential management. With the API, you can implement complex business logic, providing unparalleled control and customization.
You can retrieve a Verifiable Credential via the Crossmint API using different identifiers associated with the credential itself, or the NFT associated with the credential.
- Get Verifiable Credential by ID uses the format:
urn:uuid:<UUID>
- Get Verifiable Credential by NFT Locator uses the format:
<chain>:<contractAddress>:<tokenId>
- Get Verifiable Credential by NFT ID uses crossmint’s internal NFT ID
There is no access control on credential retrieval. Credential data is public and can be retrieved by anyone. Choose to encrypt your credentials if you need to protect your data.
Credential retrieval via the crossmint API will not work for delegated storage.
To retrieve the credential, copy the retrieveCredential.js
file from below, use your API key, the credentialId
, and run the file from your terminal.
Verifiable Credentials SDK
Crossmint’s Verifiable Credentials SDK is primarily meant to be used by verifiers. Using the Verifiable Credentials client-side SDK is advantageous in scenarios where direct interaction with the user’s wallet is preferred, directly integrating their credentials with your browser-based application.
- Wallet Integration: The Verifiable Credentials SDK is designed to work smoothly with any wallet, providing a streamlined experience for both users and verifiers. This reduces friction and improves the user experience.
- Efficient Retrieval: Once the wallet is connected, the SDK can directly interact with it to retrieve credentials. Instead of dealing with multiple API calls, the SDK surfaces credential retrieval capabilities that matter most to verifiers, such as fetching credentials based on specific filter conditions, i.e. type and issuer.
- User Approvals: The SDK takes care of prompting the user, when applicable, to approve transactions, such as decryption requests, enhancing security and the user’s confidence in the application.
Using the SDK requires a Crossmint developer account and a client-side API key scoped to credentials.read
and credentials.decrypt
. Go to the Developers -> API Keys
tab, click on New API Key
in the Client-side keys
section, and select the API key scopes.
You can download the SDK here.
The SDKs offer functions to easily retrieve and filter NFTs associated with credentials. For example, the getCredentialNFTs
function fetches all VC NFTs in a wallet and lets you filter by credential type or issuer.
Below, we show how easy it is to retrieve academic credentials from a user’s wallet.
Now that the credential is retrieved, it’s important to decrypt it and verify it.