API Documentation

Contents

Authentication

All API requests require an API key. You can pass your API key in one of three ways:

  • Query parameter: ?api_key=YOUR_KEY
  • Header: X-API-Key: YOUR_KEY
  • Header: Authorization: Bearer YOUR_KEY

Screenshot Endpoint

GET/api/v1/screenshot
POST/api/v1/screenshot

Basic Parameters

ParameterTypeDefaultDescription
urlstringrequiredURL to capture
widthnumber1280Viewport width (320-3840)
heightnumber800Viewport height (240-2160)
full_pagebooleanfalseCapture full scrollable page
formatstringpngOutput format: png, jpeg, webp, pdf
qualitynumber90Image quality (1-100, jpeg/webp only)
delaynumber0Wait time in ms before capture (0-10000)
block_adsbooleanfalseBlock advertisements
block_cookie_bannersbooleantrueHide cookie consent popups
dark_modebooleanfalseEmulate dark mode preference
device_scale_factornumber1Device pixel ratio (1-3)

Example Request (GET)

curl "https://shotapi.dev/api/v1/screenshot?url=https://example.com&api_key=YOUR_KEY&width=1920&full_page=true"

Example Request (POST)

curl -X POST https://shotapi.dev/api/v1/screenshot \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "width": 1920,
    "full_page": true,
    "device": "desktop",
    "dark_mode": true
  }'

Example Response

{
  "success": true,
  "data": {
    "screenshot_url": "https://r2.shotapi.dev/screenshots/abc123.png",
    "width": 1920,
    "height": 3200,
    "format": "png",
    "file_size": 524288,
    "cached": false
  },
  "usage": {
    "credits_used": 43,
    "credits_limit": 500,
    "credits_remaining": 457
  }
}

Premium Features

The following features are available on paid plans only. Free plan users will receive a 403 error when trying to use these features.

ParameterTypeDescription
devicestringDevice preset (desktop, mobile, tablet, iphone-14, etc.)
selectorstringCSS selector to capture specific element only
hide_selectorsstring[]CSS selectors of elements to hide (comma-separated for GET)
custom_cssstringCustom CSS to inject into the page (max 10KB)
custom_jsstringCustom JavaScript to execute (max 10KB)
wait_for_selectorstringWait for element before capture (10s timeout)
custom_headersobjectCustom HTTP headers (POST only)
user_agentstringCustom user agent string
thumbnailobjectGenerate thumbnail: {width, height}
extract_htmlbooleanInclude page HTML in response
clipobjectCrop region: {x, y, width, height}

Example: Capture Specific Element

curl -X POST https://shotapi.dev/api/v1/screenshot \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "selector": "#main-content",
    "hide_selectors": [".ads", ".cookie-banner", ".popup"]
  }'

Example: Custom CSS Injection

curl -X POST https://shotapi.dev/api/v1/screenshot \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "custom_css": "body { background: #f0f0f0; } .header { display: none; }"
  }'

Example: Generate Thumbnail

curl -X POST https://shotapi.dev/api/v1/screenshot \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "thumbnail": { "width": 300, "height": 200 }
  }'

Response includes thumbnail_url in addition to the full screenshot.

PDF Generation

Generate PDF documents from any webpage by setting format=pdf.

Example Request

curl "https://shotapi.dev/api/v1/screenshot?url=https://example.com&format=pdf&api_key=YOUR_KEY"

PDF Response

{
  "success": true,
  "data": {
    "pdf_url": "https://r2.shotapi.dev/screenshots/abc123.pdf",
    "page_count": 3,
    "format": "pdf",
    "file_size": 156789
  },
  "usage": {
    "credits_used": 44,
    "credits_limit": 500,
    "credits_remaining": 456
  }
}

Device Presets

Use device presets to emulate common device viewports and user agents automatically.

PresetWidthHeightScaleMobile
desktop192010801xNo
laptop13667681xNo
tablet76810242xYes
tablet-landscape10247682xYes
mobile3758123xYes
mobile-landscape8123753xYes
iphone-143908443xYes
iphone-14-pro-max4309323xYes
ipad-pro102413662xYes
pixel-74129152.625xYes

Example: Mobile Screenshot

curl "https://shotapi.dev/api/v1/screenshot?url=https://example.com&device=iphone-14&api_key=YOUR_KEY"

Error Codes

CodeStatusDescription
MISSING_API_KEY401No API key provided
INVALID_API_KEY401API key is invalid or revoked
RATE_LIMIT_EXCEEDED429Too many requests
CREDITS_EXHAUSTED402Monthly credit limit reached
PREMIUM_REQUIRED403Feature requires paid plan
INVALID_URL400URL is invalid or not accessible
VALIDATION_ERROR400Invalid parameter value
SCREENSHOT_FAILED500Failed to capture screenshot

Rate Limits

PlanRequests/minScreenshots/monthPremium Features
Free10500No
Starter602,500Yes
Pro12010,000Yes
Business30050,000Yes

Ready to get started? Create a free account or upgrade your plan to unlock premium features.