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.


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: true

  • A 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

How It Works

  1. Resolves the recipient - Looks up the profile by ID or uses a DID directly

  2. Prepares the credential - Uses your template or creates a new boost on-the-fly

  3. Signs the credential - Uses client-side signing if available, otherwise falls back to your registered signing authority

  4. Delivers the credential - Sends via the LearnCard Network with optional consent flow routing

Response

Contract Integration: When you provide a contractUri, the method automatically:

  • Checks if the recipient has consented to the contract

  • Routes the credential through the consent flow if terms exist

  • Creates a RELATED_TO relationship between new boosts and the contract


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

When to use which:

  • send method β†’ Recipient already has a LearnCard profile (you have their profile ID or DID)

  • Universal Inbox API β†’ Recipient may not have LearnCard yet (you have their email or phone)

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?

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

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:

  1. The employee claims their first badge as normal.

  2. Immediately after, a prompt appears asking for their permission based on your description.

  3. If they allow it, your webhook receives a notification that includes a contractId.

  4. For all future issuances to this user, credentials will appear directly in their passport, friction-free.

Last updated

Was this helpful?