Send Credentials
How-To Guide: Sending Credentials with LearnCard
This guide provides practical, step-by-step recipes for sending credentials. We'll start with the simplest possible use case and progressively add more powerful configurations.
Quick Start: The send Method (Recommended)
send Method (Recommended)The send method is the simplest and most ergonomic way to send credentials to recipients. It handles credential issuance, signing, and delivery in a single call.
Prerequisites
LearnCard SDK initialized with
network: trueA signing authority configured (for server-side signing) OR local key material available (for client-side signing)
Basic Usage
// Send a credential using an existing boost template
const result = await learnCard.invoke.send({
type: 'boost',
recipient: 'recipient-profile-id', // or DID
templateUri: 'urn:lc:boost:abc123',
});
console.log(result.credentialUri); // URI of the sent credential
console.log(result.uri); // URI of the boost template used// Send by creating a new boost from an unsigned credential
const result = await learnCard.invoke.send({
type: 'boost',
recipient: 'recipient-profile-id',
template: {
credential: {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.2.json"
],
"type": ["VerifiableCredential", "OpenBadgeCredential"],
"name": "Course Completion",
"credentialSubject": {
"type": ["AchievementSubject"],
"achievement": {
"type": ["Achievement"],
"name": "Web Development 101",
"description": "Completed the Web Development fundamentals course.",
"criteria": {
"narrative": "Successfully completed all modules and passed the final assessment."
}
}
}
},
name: 'Web Development 101 Certificate',
category: 'Achievement',
},
});How It Works
Resolves the recipient - Looks up the profile by ID or uses a DID directly
Prepares the credential - Uses your template or creates a new boost on-the-fly
Signs the credential - Uses client-side signing if available, otherwise falls back to your registered signing authority
Delivers the credential - Sends via the LearnCard Network with optional consent flow routing
Response
Alternative: Universal Inbox API
Use the Universal Inbox API when you need to send credentials to users who don't have a LearnCard profile yet. This allows you to reach recipients via email or phone number, and they'll be guided through creating an account when they claim their credential.
This is ideal for:
Onboarding new users - Send to an email or phone number, not a profile ID
Custom email templates and branding - White-label the claim experience
Webhook notifications - Get notified when credentials are claimed
Suppressing automatic delivery - Handle notification yourself and just get a claim URL
This approach assumes you are familiar with the core concepts of the Universal Inbox and have a valid API token & signing authority set up.
1. The Simplest Case: Fire and Forget
Your goal is to send a single, verifiable record to a user. You want our system to handle all the complexity of signing the credential and notifying the user.
This is the most common use case, perfect for one-off issuances like a course completion certificate.
The Recipe: Make a POST request to the /inbox/issue endpoint with only two required fields: recipient and a signed or unsigned credential. An unsigned credential requires a configured signing authority.
Example:
Have you configured your default Primary Signing Authority?
If you get an error about a missing signing authority, ensure you've set one up following this guide. When you send an unsigned credential with Universal Inbox, it will use your primary signing authority to sign the credential when a user claims it.
If you'd like to use a custom signing authority, or specify it per request:
What Happens:
Our system receives the unsigned credential data.
It sends a professionally designed email to
[email protected]with a secure link to claim their record.When the student claims their record, it automatically signs it using your default Primary Signing Authority attached to your profile.
You're done. The rest of the user onboarding and claim process is handled for you.
2. Customizing the User Experience
Your goal is to send a credential, but you want the notification email to be branded with your organization's identity to build trust and recognition.
The Recipe: Use the optional configuration.delivery.template.model object to provide your branding details.
Example:
What Happens: The email sent to the student will now feature the State University name and logo prominently, creating a more professional and trustworthy experience.
3. Taking Control of Delivery and Status
You have more advanced needs. You might want to deliver the claim link through your own system (e.g., inside your web portal) or need to know precisely when a user has successfully claimed their record.
Recipe 3a: Suppressing Delivery
Goal: You want to get a claimUrl from our API but prevent us from sending any emails or texts.
The Recipe: Set configuration.delivery.suppress to true.
Example:
Recipe 3b: Tracking Status with Webhooks
Goal: You need your system to be notified when a user successfully claims their credential so you can update your internal database.
The Recipe: Provide a configuration.webhookUrl.
Example:
What Happens: When the user claims their record, our system will send a POST request to your webhook URL with a payload containing the issuanceId, a status of CLAIMED, and the user's permanent recipientDid.
4. Advanced: Building an Ongoing Relationship
This feature is currently in beta. Please reach out the the LearnCard team if you'd like early access!
Goal: You plan to send credentials to the same user repeatedly over time (e.g., skill badges, course completions). You want to ask for their permission once, so future records can be sent directly to their passport without them needing to claim each one individually.
The Recipe: On the first issuance, include the consentRequest object.
Example:
What Happens:
The employee claims their first badge as normal.
Immediately after, a prompt appears asking for their permission based on your
description.If they allow it, your webhook receives a notification that includes a
contractId.For all future issuances to this user, credentials will appear directly in their passport, friction-free.
Last updated
Was this helpful?