Skip to main content

Screenshot API

The Screenshot API is the core of BoltShot. It allows you to capture high-quality screenshots of any website with extensive customization options.

Endpoint

GET /capture

The screenshot API uses GET requests with query parameters for all options.

Authentication

Pass your API key as a query parameter:

GET https://api.boltshot.dev/capture?url=https://example.com&apiKey=your_api_key_here

You can also pass the API key in the X-API-Key header as an alternative. See Authentication for details.

Basic Usage

Simple Request

GET https://api.boltshot.dev/capture?url=https://example.com&apiKey=your_api_key_here

Request Parameters

Required Parameters

ParameterTypeDescription
urlstringThe URL of the webpage to screenshot
apiKeystringYour API key (can also be passed in X-API-Key header)

Optional Parameters

Format & Output

ParameterTypeDefaultDescription
formatstring"png"Output format: png, webp, or pdf
returnFilebooleantrueIf true, returns binary file; if false, returns JSON with base64 data
imageQualitynumber90Image quality (1-100) for JPEJ/WebP
scaleFactornumber1.0Scale factor (0.1-3.0) for image resolution

Viewport & Device

ParameterTypeDefaultDescription
devicestring"desktop"Device type: desktop, mobile, or tablet
viewportWidthnumber1920Viewport width in pixels
viewportHeightnumber1080Viewport height in pixels
themestring"auto"Theme: light, dark, or auto

Page Capture

ParameterTypeDefaultDescription
fullPagebooleanfalseCapture entire page including content below fold
fullPageScrollbooleanfalseEnable enhanced scrolling for lazy-loaded content
fullPageScrollDurationnumber1000Scroll duration in milliseconds
clipSelectorstringnullCSS selector to capture only specific element

Timing & Waiting

ParameterTypeDefaultDescription
delaynumber0Delay in milliseconds before taking screenshot
waitUntilstring"load"Wait condition: load, domcontentloaded, networkidle0, networkidle2
waitForSelectorstringnullCSS selector to wait for before screenshot

Content Filtering

ParameterTypeDefaultDescription
removeAdsbooleanfalseAutomatically remove ads
removeCookieBannersbooleanfalseAutomatically remove cookie consent banners
removeSelectorsstringnullComma-separated CSS selectors to remove
blockResourcesstring""Comma-separated resource types to block: stylesheet, script, image, font, media
blockUrlsstring""Comma-separated URLs or patterns to block (supports wildcards)

Proxy & Network

ParameterTypeDefaultDescription
proxyUrlstringnullProxy URL (e.g., http://proxy.example.com:8080)
proxyUsernamestringnullProxy username (if required)
proxyPasswordstringnullProxy password (if required)

Caching

ParameterTypeDefaultDescription
cacheEnabledbooleanfalseEnable response caching
cacheTtlnumber3600Cache TTL in seconds

Storage (Per-Request)

ParameterTypeDefaultDescription
requestStorageEnabledbooleanfalseUse per-request storage configuration
requestStorageEndpointstringnullS3-compatible endpoint URL
requestStorageAccessKeyIdstringnullStorage access key ID
requestStorageSecretAccessKeystringnullStorage secret access key
requestStorageBucketstringnullStorage bucket name
requestStorageRegionstring"us-east-1"Storage region

Response Format

Binary Response (returnFile: true)

When returnFile=true (default), the API returns the screenshot as a binary file:

Headers:

Content-Type: image/png (or image/webp or application/pdf)
Content-Disposition: inline; filename="screenshot.png"
Content-Length: <file_size>

Body: Binary file data

JSON Response (returnFile: false)

When returnFile=false, the API returns JSON in standardized format:

{
"success": true,
"data": {
"requestId": "uuid",
"fileName": "screenshot.png",
"processingTime": 2500,
"fileSize": 1024000,
"url": "https://storage.example.com/screenshots/screenshot.png",
"imageData": "data:image/png;base64,iVBORw0KGgoAAAANS..."
}
}

Response Fields:

  • success: Always true for successful requests
  • data: Object containing the screenshot information

Data Fields:

  • requestId: Unique identifier for this request
  • fileName: Generated filename
  • processingTime: Time taken in milliseconds
  • fileSize: File size in bytes
  • url: Storage URL (if storage is configured)
  • imageData: Base64-encoded image (for PNG/WebP, not PDF)

Examples

Basic Screenshot

GET https://api.boltshot.dev/capture?url=https://example.com&apiKey=your_api_key_here

Full-Page Screenshot

GET https://api.boltshot.dev/capture?url=https://example.com&fullPage=true&format=png&apiKey=your_api_key_here

Mobile Screenshot

GET https://api.boltshot.dev/capture?url=https://example.com&device=mobile&viewportWidth=375&viewportHeight=667&apiKey=your_api_key_here

Capture Specific Element

GET https://api.boltshot.dev/capture?url=https://example.com&clipSelector=%23main-content&format=png&apiKey=your_api_key_here

Note: URL-encode special characters in selectors (e.g., # becomes %23)

GET https://api.boltshot.dev/capture?url=https://example.com&removeAds=true&removeCookieBanners=true&fullPage=true&apiKey=your_api_key_here

Block Resources

GET https://api.boltshot.dev/capture?url=https://example.com&blockResources=stylesheet,script&format=png&apiKey=your_api_key_here

Wait for Element

GET https://api.boltshot.dev/capture?url=https://example.com&waitForSelector=.content-loaded&delay=2000&waitUntil=networkidle0&apiKey=your_api_key_here

Generate PDF

GET https://api.boltshot.dev/capture?url=https://example.com&format=pdf&fullPage=true&apiKey=your_api_key_here

High-Quality Screenshot

GET https://api.boltshot.dev/capture?url=https://example.com&format=png&imageQuality=100&scaleFactor=2.0&viewportWidth=3840&viewportHeight=2160&apiKey=your_api_key_here

Dark Mode Screenshot

GET https://api.boltshot.dev/capture?url=https://example.com&theme=dark&fullPage=true&apiKey=your_api_key_here

With Proxy

GET https://api.boltshot.dev/capture?url=https://example.com&proxyUrl=http://proxy.example.com:8080&proxyUsername=user&proxyPassword=pass&apiKey=your_api_key_here

JSON Response with Preview

GET https://api.boltshot.dev/capture?url=https://example.com&returnFile=false&format=png&apiKey=your_api_key_here

URL Encoding

When using query parameters, make sure to URL-encode special characters:

  • #%23
  • &%26
  • =%3D
  • (space) → %20 or +
  • ,%2C

Most HTTP clients (like cURL) handle this automatically, but be aware when constructing URLs manually.

Device Presets

Desktop

  • Viewport: 1920x1080
  • User Agent: Desktop Chrome

Mobile

  • Viewport: 375x667 (iPhone)
  • User Agent: Mobile Safari

Tablet

  • Viewport: 768x1024 (iPad)
  • User Agent: Tablet Safari

Best Practices

Performance

  1. Use appropriate wait conditions

    • load: Fastest, waits for page load
    • networkidle0: Waits for all network activity to stop
    • networkidle2: Waits for max 2 network connections
  2. Optimize image quality

    • Use imageQuality=80-90 for most cases
    • Use scaleFactor=1.0 unless you need higher resolution
  3. Enable caching

    • Set cacheEnabled=true for repeated screenshots
    • Adjust cacheTtl based on content update frequency

Reliability

  1. Use delays for dynamic content

    • Add delay parameter for JavaScript-rendered content
    • Use waitForSelector for specific elements
  2. Handle errors gracefully

    • Check response status codes
    • Implement retry logic for transient failures
  3. Monitor usage

    • Track request IDs for debugging
    • Monitor processing times

Error Handling

See Errors for detailed error codes and handling.

Error Response Format

All errors follow this standardized format:

{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error message",
"details": "Additional error details (optional)"
}
}

Common Error Codes

  • 400 Bad Request:

    • VALIDATION_ERROR - Validation failed
    • MISSING_REQUIRED_FIELD - Required field missing
    • INVALID_INPUT - Invalid input provided
  • 401 Unauthorized:

    • API_KEY_REQUIRED - API key is required
    • INVALID_API_KEY - Invalid API key
    • API_KEY_EXPIRED - API key has expired
  • 402 Payment Required:

    • INSUFFICIENT_CREDITS - Insufficient credits
  • 429 Too Many Requests:

    • RATE_LIMIT_EXCEEDED - Rate limit exceeded
  • 500 Internal Server Error:

    • INTERNAL_ERROR - Internal server error
    • OPERATION_FAILED - Operation failed

Example Error Response

{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Validation failed",
"details": [
{
"field": "viewportWidth",
"message": "Must be a number",
"value": "invalid"
}
]
}
}

Next Steps