API Reference

Complete reference documentation for the Screenshot API endpoint.

Base URL

https://snappkit.com

All 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_KEY

See theAuthentication Guidefor more details.

Screenshot Endpoint

POST/api/screenshotTry it

Capture a screenshot of any publicly accessible webpage

Full URL

https://snappkit.com/api/screenshot

Request Parameters

Send parameters as JSON in the request body:

ParameterTypeRequiredDescription
urlstringRequired
The URL of the webpage to screenshot. Must be a valid HTTP or HTTPS URL.
Must start with http:// or https://
widthnumberOptional
Viewport width in pixels.
Default: 1920
Min: 320, Max: 3840
heightnumberOptional
Viewport height in pixels.
Default: 1080
Min: 320, Max: 3840
formatstringOptional
Output image format.
Default: png
Options: png, jpeg, webp
qualitynumberOptional
Image quality for JPEG and WEBP formats (ignored for PNG).
Default: 90
Min: 1, Max: 100
fullPagebooleanOptional
Capture the entire scrollable page instead of just the viewport.
Default: false
devicestringOptional
Emulate a specific device type with preset viewport and user agent.
Options: mobile, tablet, desktop
delaynumberOptional
Wait time in milliseconds before taking the screenshot (for JavaScript execution).
Default: 0
Min: 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.png

Response

On success (HTTP 200), the response body contains the binary image data.

Response Headers

HeaderValue
Content-Typeimage/png, image/jpeg, orimage/webp
Content-LengthSize of image in bytes
ETagMD5 hash for caching
Cache-Controlpublic, 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 TypeCreditsConditions
Basic Screenshot1 creditStandard viewport, no full-page
Full-Page Screenshot2 creditsfullPage: true
High-Resolution Screenshot3 creditsWidth or height > 2560px

SeeRate Limits & Pricingfor more details.

Ready to Get Started?

Try theInteractive Playgroundto test these parameters without writing code, or check outCode Examplesfor more language-specific implementations.