Screenshot API - Prepare HTML for Headless Chromium Capture
Takes HTML plus target width, height, and format (png or jpeg). Returns an HTML document with the viewport and body sized exactly to your target dimensions, ready to load in Puppeteer, Playwright, or any headless Chromium. Actual rasterization runs in your own browser runtime.
Code examples
curl -X POST https://api.botoi.com/v1/screenshot/capture \
-H "Content-Type: application/json" \
-d '{"html":"<div style=\"padding:40px;font-family:system-ui\"><h1>Hello world</h1><p>Rendered at 1200×630.</p></div>","width":1200,"height":630,"format":"png"}'When to use this API
Dynamic social share cards
Build OG images on demand by rendering a template with user data and capturing with Puppeteer. The 1200×630 dimensions match Twitter/Open Graph recommendations.
Code snippet screenshots
Combine with /v1/code/highlight. Highlight code to HTML, wrap with this endpoint, and capture for sharing in blog posts or marketing assets.
Automated visual regression tests
Feed this endpoint's HTML output into Playwright's toHaveScreenshot. Captures identical pixels across runs for snapshot comparison.
Frequently asked questions
Why doesn't this return the image directly?
What dimensions are supported?
PNG or JPEG?
How do I capture with Puppeteer?
Can I include web fonts?
Get your API key
Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.