Professional Design
Verification Ready
Automate certificate generation for course completions, training programs, event attendance, and achievements. Create beautiful, verifiable certificates that recipients will be proud to share.
Automated certificate generation eliminates manual work, ensures consistent professional quality, and provides instant delivery with built-in verification systems.
// Generate certificate upon course completion
const generateCourseCertificate = async (enrollmentId) => {
// Get enrollment and course data
const enrollment = await db.enrollments.findOne({
id: enrollmentId,
include: ['student', 'course', 'progress']
});
// Verify completion
if (enrollment.progress.completion_percentage < 100) {
throw new Error('Course not completed');
}
// Generate unique certificate ID
const certificateId = generateUniqueId();
// Create certificate record
const certificate = await db.certificates.create({
id: certificateId,
student_id: enrollment.student_id,
course_id: enrollment.course_id,
issued_date: new Date(),
score: enrollment.progress.final_score,
verification_url: `https://verify.eduplatform.com/${certificateId}`
});
// Generate PDF certificate
const response = await fetch('https://dash.liquidtemplater.com/items/template_request', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: {
certificate: {
id: certificateId,
type: 'Completion',
issued_date: certificate.issued_date,
year: new Date().getFullYear(),
verification_url: certificate.verification_url
},
recipient: {
name: enrollment.student.full_name
},
course: {
name: enrollment.course.title,
duration: enrollment.course.duration_hours,
score: enrollment.progress.final_score
},
achievement: {
description: `Has successfully completed all requirements of the
${enrollment.course.title} program with distinction.`
},
organization: {
name: 'EduTech Academy',
logo_url: 'https://eduplatform.com/logo.png'
},
signatories: [
{
name: 'Dr. Jane Smith',
title: 'Director of Education',
signature_image: 'https://eduplatform.com/signatures/jane.png'
},
{
name: 'Prof. John Davis',
title: 'Course Instructor'
}
]
},
template: `<!DOCTYPE html>
<html>
<head>
<style>
@page { size: landscape; margin: 0; }
body {
margin: 0;
font-family: 'Georgia', serif;
background: white;
}
.certificate {
width: 1024px;
height: 768px;
margin: 0 auto;
border: 20px solid #4A6CF7;
padding: 60px;
box-sizing: border-box;
}
.title {
font-size: 48px;
color: #4A6CF7;
text-align: center;
margin: 20px 0;
text-transform: uppercase;
}
.recipient-name {
font-size: 36px;
color: #333;
text-align: center;
border-bottom: 3px solid #4A6CF7;
display: inline-block;
padding: 10px 40px;
margin: 20px 0;
}
.achievement {
text-align: center;
font-size: 20px;
margin: 40px 0;
}
.verification {
position: absolute;
bottom: 30px;
right: 30px;
font-size: 12px;
color: #999;
}
</style>
</head>
<body>
<div class="certificate">
<h1 class="title">Certificate of {{certificate.type}}</h1>
<p style="text-align: center; font-size: 24px; color: #666;">This is to certify that</p>
<div style="text-align: center;">
<h2 class="recipient-name">{{recipient.name}}</h2>
</div>
<div class="achievement">
<p>{{achievement.description}}</p>
{% if course %}
<p>Has successfully completed the <strong>{{course.name}}</strong>
{% if course.duration %}({{course.duration}} hours){% endif %}
{% if course.score %}with a score of {{course.score}}%{% endif %}
</p>
{% endif %}
</div>
<div class="verification">
Certificate ID: {{certificate.id}}<br>
Issued: {{certificate.issued_date}}<br>
{% if certificate.verification_url %}
Verify at: {{certificate.verification_url}}
{% endif %}
</div>
</div>
</body>
</html>`,
type: 'pdf'
})
});
const requestData = await response.json();
const requestId = requestData.data.id;
// Poll for completion
let document_url = null;
while (!document_url) {
await new Promise(resolve => setTimeout(resolve, 2000));
const statusResponse = await fetch(
`https://dash.liquidtemplater.com/items/template_request/${requestId}`,
{
headers: { 'Authorization': 'Bearer YOUR_API_TOKEN' }
}
);
const statusData = await statusResponse.json();
if (statusData.data.result) {
document_url = `https://dash.liquidtemplater.com/assets/${statusData.data.result}?download=true`;
}
}
// Update certificate with PDF URL
await db.certificates.update({
where: { id: certificateId },
data: { pdf_url: document_url }
});
// Send certificate email
await sendCertificateEmail(enrollment.student.email, {
student_name: enrollment.student.first_name,
course_name: enrollment.course.title,
pdf_url: document_url,
verification_url: certificate.verification_url
});
// Update enrollment status
await db.enrollments.update({
where: { id: enrollmentId },
data: {
certificate_issued: true,
certificate_id: certificateId
}
});
return certificate;
};
// Webhook for course completion
app.post('/webhooks/course-completed', async (req, res) => {
const { enrollment_id } = req.body;
const certificate = await generateCourseCertificate(enrollment_id);
res.json({ certificate_id: certificate.id });
});
Certificate PDFs are generated on-demand and stored securely in our German data centers for 7 days. This allows recipients to download their certificates multiple times while maintaining data privacy.