API Reference
Complete documentation for the SnapAPI screenshot and PDF capture API.
Authentication
All API requests require a Bearer token in the Authorization header. Get your API key from the Dashboard.
Header
Authorization: Bearer YOUR_API_KEYBase URL
Endpoint
GET /api/v1/screenshotAll parameters are passed as query string parameters.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | required | - | The URL of the webpage to capture. Must be a valid HTTP or HTTPS URL. |
format | string | optional | png | Output format. Options: "png", "jpeg", "pdf". |
width | integer | optional | 1280 | Viewport width in pixels. Range: 100-3840. |
height | integer | optional | 720 | Viewport height in pixels. Range: 100-2160. |
fullPage | boolean | optional | false | Capture the full scrollable page instead of just the viewport. |
quality | integer | optional | 80 | Image quality for JPEG format only. Range: 1-100. |
delay | integer | optional | 0 | Wait time in milliseconds after page load before capture. Useful for pages with animations. Range: 0-10000. |
Examples
Basic Screenshot (PNG)
cURL
curl "https://api.snapapi.dev/api/v1/screenshot?url=https://example.com" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o screenshot.pngFull Page JPEG with Custom Quality
cURL
curl "https://api.snapapi.dev/api/v1/screenshot?url=https://example.com&format=jpeg&fullPage=true&quality=90" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o fullpage.jpgPDF with Custom Viewport
cURL
curl "https://api.snapapi.dev/api/v1/screenshot?url=https://example.com&format=pdf&width=1920&height=1080" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o page.pdfScreenshot with Delay (for dynamic content)
cURL
curl "https://api.snapapi.dev/api/v1/screenshot?url=https://example.com&delay=2000" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o delayed.pngResponse
On success, the API returns the binary content of the screenshot or PDF with the appropriate Content-Type header:
image/pngfor PNG screenshotsimage/jpegfor JPEG screenshotsapplication/pdffor PDF documents
Rate limit information is included in the response headers:
Response Headers
X-RateLimit-Limit: 20
X-RateLimit-Remaining: 19
X-RateLimit-Reset: 1711234567Error Codes
Error responses return JSON with an error message:
JSON
{
"error": "Missing required parameter: url"
}| Status | Code | Description |
|---|---|---|
| 400 | BAD_REQUEST | Invalid or missing parameters. Check the error message for details. |
| 401 | UNAUTHORIZED | Missing or invalid Authorization header. |
| 403 | FORBIDDEN | Invalid API key. |
| 429 | RATE_LIMITED | Too many requests. Wait and retry. |
| 500 | INTERNAL_ERROR | Screenshot capture failed. The target URL may be unreachable or timed out. |
Rate Limits
Rate limits are applied per API key + IP combination:
- Free: 20 requests per minute
- Pro: 60 requests per minute
- Business: 200 requests per minute
If you exceed the rate limit, you'll receive a 429 status code. Check the X-RateLimit-Reset header for when you can retry.
SDKs & Libraries
Official SDKs are coming soon. In the meantime, the API is a simple REST endpoint that works with any HTTP client:
- JavaScript/TypeScript: Use
fetchoraxios - Python: Use
requestsorhttpx - Go: Use
net/http - Ruby: Use
Net::HTTPorfaraday