Twitter Screenshot Generator

Create realistic Twitter/X.com screenshots from any text

Tweet Details
Enter the tweet content and user information
Generated Screenshot
Your image will appear here

Your generated image will be displayed here.

API Documentation
Use the API programmatically to generate Twitter screenshots

Overview

Single Tweet

POST /api/twitter-screenshotreturns: image/png

Generate a single tweet screenshot

POST /api/upload-screenshotreturns: JSON (url)

Generate and upload to Tigris storage (returns URL)

Bulk

POST /api/tweets/bulkreturns: JSON

Self-hosted worker threads (~164 tweets/sec)

POST /api/tweets/bulk-serverlessreturns: JSON

Serverless horizontal scaling (Vercel: ~100-150 tweets/sec)

Single Tweet Parameters

For /api/twitter-screenshot and /api/upload-screenshot

textstringrequired

Tweet content. Supports @mentions and #hashtags.

usernamestringrequired

Twitter username (without @).

displayNamestring

Display name. Defaults to username if not provided.

isReplyboolean

Set to true for a reply format. Defaults to false.

replyingTostring

Username being replied to. Used when isReply is true.

profilePicUrlstring

URL for a custom profile picture.

themestring

Theme for the tweet. Can be "light", "dark", or "dim". Defaults to "dark".

paddingstring

Padding around the tweet container (e.g., "50px"). Defaults to "20px".

backgroundColorstring

Custom background color for the image (e.g., "#f0f0f0"). Overrides theme's background.

backgroundImageUrlstring

URL for a background image. Overrides backgroundColor.

tweetBackgroundColorstring

Custom background color for the tweet box itself. Overrides theme's tweet background.

textColorstring

Custom color for the main tweet text. Overrides theme's text color.

Code Examples

Examples call /api/twitter-screenshot and return an image/png. For a hosted URL, use /api/upload-screenshot.

Quick Start

// 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;

Bulk Screenshot Endpoints

Bulk Endpoint Parameters

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.

✨ Each tweet in the array can have its own custom styling parameters for maximum flexibility!
POST /api/upload-screenshot

Generate 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):

{ "text": "Hello Twitter!", "username": "developer", "displayName": "Dev User", "theme": "dark" }

Response:

{ "url": "https://twitter-screenshots-public.t3.storage.dev/screenshots/tweet/developer/abc123.png", "key": "screenshots/tweet/developer/abc123.png", "exists": false, "message": "Screenshot uploaded successfully" }
POST /api/tweets/bulkSelf-Hosted

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

{ "tweets": [ { "text": "First tweet with default theme", "username": "user1", "displayName": "User One", "isReply": false }, { "text": "Second tweet with custom colors", "username": "user2", "backgroundColor": "#15202b", "textColor": "#ffffff", "tweetBackgroundColor": "#192734", "padding": "30px" } ], "theme": "dark" // Default theme for tweets without custom colors }

Response:

{ "ok": true, "count": 2, "results": [ { "key": "images/user1/abc123.png", "url": "https://twitter-screenshots-public.t3.storage.dev/images/user1/abc123.png" }, { "key": "images/user2/def456.png", "url": "https://twitter-screenshots-public.t3.storage.dev/images/user2/def456.png" } ] }

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/Lambda

Serverless 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):

{ "tweets": [ { "text": "Tweet with custom styling", "username": "developer", "displayName": "Dev User", "isReply": true, "replyingTo": "originalposter", "profilePicUrl": "https://example.com/avatar.png", "backgroundColor": "#1ca1f1", "textColor": "#ffffff", "padding": "40px" } ], "theme": "light" }

Response (identical to /api/tweets/bulk):

{ "ok": true, "count": 1, "results": [...], "strategy": "serverless" }

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