Create realistic Twitter/X.com screenshots from any text
Your generated image will be displayed here.
Single Tweet
POST /api/twitter-screenshotreturns: image/pngGenerate a single tweet screenshot
POST /api/upload-screenshotreturns: JSON (url)Generate and upload to Tigris storage (returns URL)
Bulk
POST /api/tweets/bulkreturns: JSONSelf-hosted worker threads (~164 tweets/sec)
POST /api/tweets/bulk-serverlessreturns: JSONServerless horizontal scaling (Vercel: ~100-150 tweets/sec)
For /api/twitter-screenshot and /api/upload-screenshot
textstringrequiredTweet content. Supports @mentions and #hashtags.
usernamestringrequiredTwitter username (without @).
displayNamestringDisplay name. Defaults to username if not provided.
isReplybooleanSet to true for a reply format. Defaults to false.
replyingTostringUsername being replied to. Used when isReply is true.
profilePicUrlstringURL for a custom profile picture.
themestringTheme for the tweet. Can be "light", "dark", or "dim". Defaults to "dark".
paddingstringPadding around the tweet container (e.g., "50px"). Defaults to "20px".
backgroundColorstringCustom background color for the image (e.g., "#f0f0f0"). Overrides theme's background.
backgroundImageUrlstringURL for a background image. Overrides backgroundColor.
tweetBackgroundColorstringCustom background color for the tweet box itself. Overrides theme's tweet background.
textColorstringCustom color for the main tweet text. Overrides theme's text color.
Examples call /api/twitter-screenshot and return an image/png. For a hosted URL, use /api/upload-screenshot.
// Basic usage with Fetch API
const response = await fetch('https://your-deployment.vercel.app/api/twitter-screenshot', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
text: 'Hello from the API!',
username: 'developer',
displayName: 'JS Dev',
theme: 'light'
})
});
const imageBlob = await response.blob();
const imageUrl = URL.createObjectURL(imageBlob);
// Display in img element: document.getElementById('tweet-img').src = imageUrl;For /api/tweets/bulk and /api/tweets/bulk-serverless
tweets(array, required)Array of tweet objects. Each tweet object supports all parameters from single tweet endpoints: text, username, displayName, isReply, replyingTo, profilePicUrl, padding, backgroundColor, backgroundImageUrl, tweetBackgroundColor, textColor
theme(string, optional)Default theme for all tweets: "dark", "light", or "dim". Default: "dark". Can be overridden per-tweet using custom color parameters.
POST /api/upload-screenshotGenerate a single screenshot and upload to Tigris storage. Returns a permanent URL with deduplication (same parameters = same URL).
Request Body (same as /api/twitter-screenshot):
Response:
POST /api/tweets/bulkSelf-HostedHigh-throughput bulk generation using worker threads. Best for VPS, Railway, fly.io, or any self-hosted Node.js server. Parallelizes across CPU cores (~164 tweets/sec on multi-core).
Request Body:
Response:
Limits: Max 1000 tweets per batch
Best for: Self-hosted servers, VPS, Docker, Railway, fly.io
Performance: ~164 tweets/sec (8.78x faster than baseline)
POST /api/tweets/bulk-serverlessVercel/LambdaServerless bulk generation with horizontal scaling. Best for Vercel, AWS Lambda, or any serverless platform. Shards work across multiple function invocations (~100-150 tweets/sec on production Vercel).
Request Body (identical to /api/tweets/bulk):
Response (identical to /api/tweets/bulk):
Limits: Max 1000 tweets per batch
Best for: Vercel, AWS Lambda, serverless platforms
Performance: ~100-150 tweets/sec (scales horizontally)
Note: Local dev runs sequentially; production benefits from true horizontal scaling