Back to Tutorials
beginner
Quickstart

Getting Started: Your First Verification

Create your first credential verification in under 5 minutes.

5 min read
6 sections

Overview

This guide walks you through creating your first credential verification with CredLyr. By the end, you'll understand the basic verification flow and have a working integration.

Step 1: Get Your API Key

First, sign up for a CredLyr account and navigate to the API Keys section in your dashboard. Create a new sandbox API key for testing.

// Your API key will look like this:
const apiKey = 'sk_sandbox_xxxxxxxxxxxx';

Step 2: Create a Verification

Use the API to create a new verification session. This returns a URL where users can present their credentials.

const response = await fetch('https://api.credlyr.com/v1/verifications', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    policy_id: 'pol_default',
    return_url: 'https://yourapp.com/callback',
  }),
});

const verification = await response.json();
console.log(verification.hosted_url);

Step 3: Redirect the User

Redirect your user to the hosted_url. They'll scan a QR code with their wallet app to present credentials.

// Redirect to hosted verification page
window.location.href = verification.hosted_url;

Step 4: Handle the Result

After the user presents their credentials, they'll be redirected to your return_url with the verification result.

// In your callback handler
const verificationId = new URLSearchParams(window.location.search).get('verification_id');

const result = await fetch(`https://api.credlyr.com/v1/verifications/${verificationId}`, {
  headers: {
    'Authorization': `Bearer ${apiKey}`,
  },
});

const verification = await result.json();
if (verification.status === 'approved') {
  console.log('Verified claims:', verification.output_claims);
}

Next Steps

Congratulations! You've completed your first verification. Next, learn how to set up webhooks for real-time notifications, or dive into the SDK guides for your preferred language.