Screenshot any webpage via API in milliseconds.
# Install dependencies
npm install
# Install Chromium for Playwright
npx playwright install chromium
# Copy environment config
cp .env.example .env
# Run in development mode
npm run devThe server starts at http://localhost:3000.
# Build and run
docker compose up -d
# Or build manually
docker build -t snapapi .
docker run -p 3000:3000 --shm-size=1g snapapi- Push this repo to GitHub
- Connect to Railway
- Railway auto-detects the Dockerfile
- Set environment variables in Railway dashboard
- Deploy
- Push to GitHub
- Create a new Web Service on Render
- Select Docker environment
- Set environment variables
- Deploy
curl "http://localhost:3000/api/screenshot?url=https://example.com" -o screenshot.pngcurl "http://localhost:3000/api/screenshot?url=https://github.com&width=1920&height=1080&format=jpeg&fullPage=true&quality=90" -o page.jpgcurl "http://localhost:3000/api/screenshot?url=https://example.com&response=json"curl -H "X-API-Key: sk_live_your_key" \
"http://localhost:3000/api/screenshot?url=https://example.com"| Parameter | Type | Default | Description |
|---|---|---|---|
| url | string | - | URL to capture (required) |
| width | number | 1280 | Viewport width (320-3840) |
| height | number | 720 | Viewport height (200-2160) |
| format | string | png | png or jpeg |
| fullPage | boolean | false | Capture full scrollable page |
| quality | number | 80 | JPEG quality (1-100) |
| delay | number | 0 | Wait after page load (ms) |
| response | string | image | json for base64 response |
| Variable | Default | Description |
|---|---|---|
| PORT | 3000 | Server port |
| NODE_ENV | - | production or development |
| API_KEYS | - | Comma-separated valid API keys |
| FREE_RATE_LIMIT | 10 | Free tier requests per window |
| FREE_RATE_WINDOW | 60 | Free tier window in seconds |
| PRO_RATE_LIMIT | 1000 | Pro tier requests per window |
| PRO_RATE_WINDOW | 86400 | Pro tier window in seconds |
| BROWSER_TIMEOUT | 30000 | Page load timeout in ms |
| CHROMIUM_PATH | - | Custom Chromium executable path |
| BROWSER_WS_ENDPOINT | - | Remote browser WebSocket URL |
- SSRF protection: blocks private IPs, localhost, cloud metadata endpoints
- DNS resolution validation to prevent DNS rebinding
- Rate limiting per IP (free) or API key (paid)
- Helmet security headers
- Non-root Docker user
- In-page request blocking for private addresses
MIT