Show your dynamically generated LeetCode stats on your GitHub profile or your website!
LeetCode and LeetCode CN are both supported.
- 📈 Clean and simple LeetCode stats, for both
us
andcn
sites - 🎨 Multiple themes and fonts - Theme, Font
- 🪄 Fully customizable using CSS - Custom Stylesheets
- ⚡️ Fast and global edge network - Cloudflare Workers
- 🚫 No tracking, controlable cache - Cache
- 🍀 Open source - MIT License
- ⚙️ Extended-cards:
activity
,contest
,heatmap
Welcome to the LeetCode Stats Card API documentation. This API allows you to generate and embed customizable stat cards for LeetCode profiles.
Workers: https://leet-card-gen.devagn.workers.dev/
https://leet-card-gen.devagn.workers.dev?username=YOUR_LEETCODE_USERNAME
Example: https://leet-card-gen.devagn.workers.dev?username=devagn_maniya
Generates a LeetCode stats card image.
- username (required): LeetCode username
- theme (required): Card theme (e.g., dark, light)
- font (required): Font style for the card
- extension (optional): File extension
- site (optional): Site identifier
Returns: The stats card image data
Generates embed code for the LeetCode stats card.
- username (required): LeetCode username
- theme (required): Card theme (e.g., dark, light)
- font (required): Font style for the card
- extension (optional): File extension
- site (optional): Site identifier
Returns: JSON object containing embedHtml and markdown
Provides a preview of the stats card.
- username (required): LeetCode username
- theme (required): Card theme (e.g., dark, light)
- font (required): Font style for the card
- extension (optional): File extension
- site (optional): Site identifier
Returns: The source of the embed code
fetch('https://leet-card-generator.onrender.com/api/cardgen?username=devagn_maniya&theme=dark&font=changa')
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
fetch('https://leet-card-generator.onrender.com/api/cardgenDetail?username=devagn_maniya&theme=dark&font=changa')
.then(response => response.json())
.then(data => {
console.log('Embed HTML:', data.embedHtml);
console.log('Markdown:', data.markdown);
})
.catch(error => console.error('Error:', error));
fetch('https://leet-card-generator.onrender.com/api/preview?username=devagn_maniya&theme=dark&font=changa')
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
If required parameters are missing or an error occurs, the API will return a JSON response with an error message:
{
"error": "Username, theme, and font are required."
}