API Reference

Documentation

Everything you need to capture screenshots, generate PDFs, and extract web content via a simple REST API.

Base URL

https://urlsnap.dev

Pass your API key as an x-api-key header or ?api_key= query parameter.

Authentication — Pass your API key as a header on every request:
curl "https://urlsnap.dev/api/screenshot?url=https://example.com" -H "x-api-key: YOUR_KEY"
Get your free API key →

Endpoints

GET
/api/screenshot
Capture a full-page or viewport screenshot of any URL. Returns PNG image.
Free · Starter · Pro
GET
/api/pdf
Generate a PDF from any URL or raw HTML content. Returns PDF file.
Free · Starter · Pro
GET
/api/extract
Extract clean Markdown or plain text from any URL. Full JS rendering.
Starter · Pro only
GET
/api/preview
Extract Open Graph metadata, title, favicon, and description from any URL. JS-rendered.
Free · Starter · Pro
POST
/api/html-to-image
Convert HTML/CSS to a PNG or JPEG. Social cards, certificates, OG images.
Free · Starter · Pro

GET /api/screenshot

Capture a screenshot of any URL. Returns a PNG image directly (binary).

Example
Authentication note

x-api-key header required.

curl "https://urlsnap.dev/api/screenshot?url=https://github.com" -H "x-api-key: YOUR_KEY"
ParameterTypeRequiredDescription
urlstringrequiredThe URL to screenshot
widthintegeroptionalViewport width in px (default: 1280)
heightintegeroptionalViewport height in px (default: 800)
full_pagebooleanoptionalCapture full page scroll height (default: false)
delayintegeroptionalWait ms after load before capture (default: 0)
formatstringoptionalImage format: png or jpeg (default: png)
Code Examples
// Node.js
const res = await fetch('https://urlsnap.dev/api/screenshot?url=https://example.com', { headers: { 'x-api-key': 'YOUR_KEY' } });
const buffer = await res.arrayBuffer();
fs.writeFileSync('screenshot.png', Buffer.from(buffer));
# Python
import requests
r = requests.get('https://urlsnap.dev/api/screenshot', params={'url': 'https://example.com'}, headers={'x-api-key': 'YOUR_KEY'})
open('screenshot.png', 'wb').write(r.content)
# cURL
curl "https://urlsnap.dev/api/screenshot?url=https://example.com" -H "x-api-key: YOUR_KEY" -o screenshot.png

GET /api/pdf

Generate a PDF from any URL. Returns a PDF file directly (binary).

Example
Authentication note

x-api-key header required.

curl "https://urlsnap.dev/api/pdf?url=https://github.com" -H "x-api-key: YOUR_KEY"
ParameterTypeRequiredDescription
urlstringrequiredThe URL to convert to PDF
formatstringoptionalPage size: A4, Letter, etc. (default: A4)
landscapebooleanoptionalLandscape orientation (default: false)
delayintegeroptionalWait ms after load (default: 0)
POST /api/pdf — HTML to PDF

POST raw HTML in the request body to generate a PDF from custom HTML.

curl -X POST "https://urlsnap.dev/api/pdf" \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: text/html" \
  -d "<!DOCTYPE html><html><body><h1>Hello World</h1></body></html>" \
  --output page.pdf

GET /api/preview

Extract Open Graph metadata, title, favicon, and description from any URL. Renders JavaScript — works on SPAs and dynamic pages.

Example
curl "https://urlsnap.dev/api/preview?url=https://github.com" \
  -H "x-api-key: YOUR_KEY"
ParameterTypeRequiredDescription
urlstringrequiredThe URL to extract metadata from
Response
{
  "title": "GitHub: Let's build from here",
  "description": "GitHub is where over 100 million developers shape the future...",
  "image": "https://github.githubassets.com/images/modules/site/social-cards/homepage.png",
  "favicon": "https://github.com/favicon.ico",
  "siteName": "GitHub",
  "url": "https://github.com"
}

POST /api/html-to-image

Render an HTML string as a PNG or JPEG image. Useful for social cards, certificates, email images, and reports.

Example
curl -X POST "https://urlsnap.dev/api/html-to-image" \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"html":"<div style=\"background:#6366f1;color:#fff;padding:40px;font-size:48px\">Hello</div>","width":1200,"height":630}' \
  --output card.png
FieldTypeRequiredDescription
htmlstringrequiredHTML to render
widthintegeroptionalWidth in px (default: 1200)
heightintegeroptionalHeight in px (default: 630)
formatstringoptionalpng (default) or jpeg

Plans & Rate Limits

Free
$0
20 req/day
Screenshot + PDF
Starter
$9/mo
500 req/day
+ Extract API
Pro
$29/mo
5,000 req/day
All endpoints

Rate limit resets daily at midnight UTC. Exceeded requests return HTTP 429.

/api/extract — Web Page to Markdown
Full JavaScript rendering → clean Markdown or plain text. Perfect for AI pipelines, content ingestion, and scraping. Starter+ plan.
View Extract Docs →

Ready to start?

Get your free API key in seconds — no credit card required.

Get Free API Key View Pricing