MetaCard API: Dynamic Social Thumbnail Generator
Generate high-resolution, branded Open Graph and Twitter Card preview images on the fly using simple URL parameters.
Generate Your Thumbnail
Technical Architecture: Reverse-Engineering Dynamic Social Card Generation​
Modern social platforms (X / Twitter, LinkedIn, Facebook, Slack, Discord) scrape a URL's <meta property="og:image"> tag when links are shared. Static social cards require manual Figma exports for every blog post. MetaCard automates thumbnail synthesis via an edge microservice that renders customizable vector and typography layouts dynamically from URL query parameters.
1. Dynamic SVG/Canvas Image Synthesis​
When a social bot or browser requests the image URL, the edge function parses query parameters, calculates font bounding boxes, applies automatic word wrapping, and streams a pre-rendered PNG or SVG buffer:
<!-- Integration directly in HTML <head> -->
<meta property="og:image" content="https://metacard-beryl.vercel.app/api/generate?title=Understanding%20FastAPI&authorName=Serhii%20Hrekov&authorWebsite=hrekov.com" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="https://metacard-beryl.vercel.app/api/generate?title=Understanding%20FastAPI&authorName=Serhii%20Hrekov&authorWebsite=hrekov.com" />
2. Edge Caching & Fast TTFB​
Because social media crawlers (such as Twitterbot or facebookexternalhit) timeout if an image generation response exceeds 3 seconds, MetaCard serves cached images with HTTP caching directives:
HTTP/1.1 200 OK
Content-Type: image/png
Cache-Control: public, max-age=31536000, s-maxage=31536000, immutable
Subsequent requests with identical URL parameters are served directly from edge CDN cache nodes worldwide in under 50ms.
Programmatic API Reference​
Endpoint​
GET https://metacard-beryl.vercel.app/api/generate
Query Parameters​
| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Required | The main headline text displayed on the card. |
backgroundColor | hex | #1a1a1a | Card background color (e.g. #0f172a or #ffffff). |
fontColor | hex | #ffffff | Color of the primary title text. |
fontSize | int | 60 | Title font size in pixels (ranges from 20 to 100). |
authorName | string | Optional | Author or creator attribution line. |
authorFontColor | hex | #cccccc | Color of the author text. |
authorFontSize | int | 40 | Font size for author attribution. |
authorWebsite | string | Optional | Domain watermark (e.g. hrekov.com). |
authorWebsiteFontSize | int | 20 | Font size for the domain watermark. |
footer | boolean | false | Enable or disable the bottom border accent line. |
Example cURL Request​
# Download a custom social card
curl -o thumbnail.png "https://metacard-beryl.vercel.app/api/generate?title=My%20First%20Article&authorName=Serhii%20Hrekov&backgroundColor=%23111827"
Social Media Image Specifications Matrix​
| Platform | Card Type | Recommended Dimensions | Aspect Ratio | Maximum File Size |
|---|---|---|---|---|
| Open Graph (FB/LinkedIn) | og:image | 1200 × 630 px | 1.91 : 1 | 8 MB |
| X (Twitter) | summary_large_image | 1200 × 675 px | 16 : 9 | 5 MB |
| Slack / Discord | Inline Link Preview | 1200 × 630 px | 1.91 : 1 | 5 MB |
Security, Performance & Zero-Server Data Guarantee​
- No Database Storage: Cards are rendered purely in-flight from URL parameters. No article titles, draft content, or metadata are stored in backend databases.
- XSS & Injection Protection: Input query strings are sanitized to prevent font injection, malicious script payloads, or SSRF attacks.
- Stateless Edge Runtime: Runs on distributed Vercel serverless functions ensuring high availability and zero single point of failure.
Get notified about updates to this tool
No spam. Just high-quality updates about new features and guides.
Related APIs​
Related Posts​
A deep dive into distributed tracing in Python microservices, exploring how to link logs across services using Trace and Span IDs for enhanced observability.
Markdown is a lightweight markup language that allows you to format plain text. It is widely used for documentation, writing articles, and creating web content.
A guide for senior developers on identifying and avoiding off-by-one errors in JavaScript with practical code examples.

