API Reference
Complete reference documentation for the Screenshot API endpoint.
Base URL
https://snappkit.comAll API requests should be made to this base URL.
Authentication
All requests require authentication using an API key in theAuthorization header:
Authorization: Bearer YOUR_API_KEYSee theAuthentication Guidefor more details.
Screenshot Endpoint
Capture a screenshot of any publicly accessible webpage
Full URL
https://snappkit.com/api/screenshotRequest Parameters
Send parameters as JSON in the request body:
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Required | The URL of the webpage to screenshot. Must be a valid HTTP or HTTPS URL. Must start with http:// or https:// |
width | number | Optional | Viewport width in pixels. Default: 1920Min: 320, Max: 3840 |
height | number | Optional | Viewport height in pixels. Default: 1080Min: 320, Max: 3840 |
format | string | Optional | Output image format. Default: pngOptions: png, jpeg, webp |
quality | number | Optional | Image quality for JPEG and WEBP formats (ignored for PNG). Default: 90Min: 1, Max: 100 |
fullPage | boolean | Optional | Capture the entire scrollable page instead of just the viewport. Default: false |
device | string | Optional | Emulate a specific device type with preset viewport and user agent. Options: mobile, tablet, desktop |
delay | number | Optional | Wait time in milliseconds before taking the screenshot (for JavaScript execution). Default: 0Min: 0, Max: 30000 |
Device Presets
When using the device parameter, the following presets are applied:
- mobile: 390x844 (iPhone 13) with mobile user agent
- tablet: 768x1024 (iPad) with tablet user agent
- desktop: 1920x1080 with desktop user agent
Device presets override custom width andheight parameters.
Request Examples
Basic screenshot request:
curl -X POST https://snappkit.com/api/screenshot \
-H"Authorization: Bearer YOUR_API_KEY" \
-H"Content-Type: application/json" \
-d'{
"url":"https://example.com",
"width": 1920,
"height": 1080,
"format":"png"
}' \
--output screenshot.pngResponse
On success (HTTP 200), the response body contains the binary image data.
Response Headers
| Header | Value |
|---|---|
| Content-Type | image/png, image/jpeg, orimage/webp |
| Content-Length | Size of image in bytes |
| ETag | MD5 hash for caching |
| Cache-Control | public, max-age=3600, stale-while-revalidate=86400 |
Success Example
HTTP/1.1 200 OK
Content-Type: image/png
Content-Length: 245678
ETag:"a1b2c3d4e5f6g7h8"
Cache-Control: public, max-age=3600, stale-while-revalidate=86400
[Binary PNG data]Error Responses
On error, the API returns a JSON object with error details:
400 Bad Request
Invalid parameters or validation errors
{
"error":"Invalid URL format",
"details": [
{
"code":"invalid_string",
"path": ["url"],
"message":"Invalid URL format"
}
]
}401 Unauthorized
Missing or invalid API key
{
"error":"Invalid API key"
}402 Payment Required
Insufficient credits
{
"error":"Insufficient credits",
"required": 2,
"available": 0
}429 Too Many Requests
Rate limit exceeded (100 requests/hour)
{
"error":"Rate limit exceeded",
"limit": 100,
"reset": 1704123600
}500 Internal Server Error
Screenshot generation failed
{
"error":"Screenshot generation failed",
"url":"https://example.com",
"message":"Navigation timeout exceeded"
}For detailed error handling strategies, see theError Handling documentation.
Advanced Examples
Full-Page Mobile Screenshot
{
"url":"https://example.com",
"device":"mobile",
"fullPage": true,
"delay": 1000
}High-Quality JPEG
{
"url":"https://example.com",
"width": 2560,
"height": 1440,
"format":"jpeg",
"quality": 95
}Optimized WEBP
{
"url":"https://example.com",
"format":"webp",
"quality": 80,
"fullPage": true
}Wait for JavaScript
{
"url":"https://spa-example.com",
"delay": 3000,
"width": 1920,
"height": 1080
}Use delay for single-page applications (SPAs) that need time to render content via JavaScript.
Credit Costs
Each screenshot consumes credits based on complexity:
| Screenshot Type | Credits | Conditions |
|---|---|---|
| Basic Screenshot | 1 credit | Standard viewport, no full-page |
| Full-Page Screenshot | 2 credits | fullPage: true |
| High-Resolution Screenshot | 3 credits | Width or height > 2560px |
SeeRate Limits & Pricingfor more details.