Ghost Screenshot

Capture full-page or viewport screenshots of any URL or HTML content using headless Chromium. Supports retina, WebP, clip regions, and SPA rendering.

POST /api/screenshot
Media
~2s avg latency
API Key auth
PNG/JPEG/WebP

What It Does

The Ghost Browser Screenshot API captures high-fidelity screenshots of any webpage, including complex Single Page Applications (SPAs) built with React, Vue, Angular, and other modern frameworks. Powered by PuppeteerSharp and a headless Chromium instance, it renders pages exactly as a real browser would.

Unlike simple screenshot services, this API provides granular control over the capture process, allowing you to specify exact viewport dimensions, device scale factors for retina displays, output formats, and even clip regions for partial captures.

SPA Rendering

Waits for JavaScript execution and async content loading

Device Emulation

Simulate any device with custom viewport and user agent

Clip & Crop

Capture specific regions with pixel-perfect precision

Code Examples

# Returns binary PNG by default — pipe to a file
curl -X POST https://api.atomicapis.dev/api/screenshot \
  -H "X-RapidAPI-Proxy-Secret: YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -o screenshot.png \
  -d '{
    "url": "https://example.com",
    "viewportWidth": 1280,
    "viewportHeight": 800,
    "imageType": "png",
    "deviceScaleFactor": 2,
    "fullPage": true
  }'

# Or request base64 JSON instead of binary
curl -X POST https://api.atomicapis.dev/api/screenshot \
  -H "X-RapidAPI-Proxy-Secret: YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "viewportWidth": 1280,
    "viewportHeight": 800,
    "imageType": "png",
    "deviceScaleFactor": 2,
    "fullPage": true,
    "outputFormat": "base64"
  }'

Request Parameters

Parameter Type Required Description
url string Conditional The URL of the webpage to capture. Must be an absolute HTTP/HTTPS URL. Either url or html is required (not both).
html string Conditional Raw HTML content to render and capture. Either url or html is required (not both).
viewportWidth integer Optional Viewport width in pixels (320-3840). Default: 1280
viewportHeight integer Optional Viewport height in pixels (200-2160). Default: 800
deviceScaleFactor integer Optional Device scale factor for retina (1-3). Default: 1
fullPage boolean Optional Capture full scrollable page. Default: false
imageType string Optional Image format: png, jpeg/jpg, or webp. Default: png
quality integer Optional JPEG quality (1-100). Only applies when imageType is jpeg. Default: 80
omitBackground boolean Optional Omit the default white background (for transparent PNGs). Default: false
delay integer Optional Extra delay in milliseconds after page load to let animations/lazy content settle (max 10000).
clipX decimal Optional X coordinate of clip region. All four clip fields are required together.
clipY decimal Optional Y coordinate of clip region.
clipWidth decimal Optional Width of clip region.
clipHeight decimal Optional Height of clip region.
outputFormat string Optional Set to "base64" to receive a JSON response with base64-encoded image. When omitted or "png", returns the raw image binary.

Response Format

Default: Binary Image Response

By default (when outputFormat is omitted), the API returns the raw image binary with the appropriate Content-Type header (e.g., image/png). The response is a downloadable file named screenshot.{ext}.

Base64 JSON Response

When outputFormat is set to "base64", the API returns a JSON object:

200 OK - Base64 JSON Response (when outputFormat is "base64")
{
  "base64": "iVBORw0KGgoAAAANSUhEUgAAB4AAAAQ0CAYAAAAp...",
  "mimeType": "image/png",
  "sizeBytes": 245760
}
Field Type Description
base64 string Base64-encoded screenshot image data
mimeType string MIME type of the image (e.g., "image/png", "image/jpeg", "image/webp")
sizeBytes integer Size of the raw image data in bytes

Use Cases

Visual Regression Testing

Automate visual regression tests by capturing screenshots before and after deployments. Compare pixel-by-pixel to catch unintended UI changes.

{
  "url": "https://staging.app.com",
  "viewportWidth": 1440,
  "viewportHeight": 900,
  "deviceScaleFactor": 2
}

Social Previews

Generate beautiful link previews for social sharing. Capture the hero section of any webpage at optimal dimensions for Open Graph and Twitter Cards.

{
  "url": "https://blog.example.com",
  "viewportWidth": 1200,
  "viewportHeight": 630,
  "clipX": 0,
  "clipY": 0,
  "clipWidth": 1200,
  "clipHeight": 630
}

Bug Reports

Capture screenshots for automated bug reports. Include full-page captures with device emulation to reproduce issues across different viewports.

{
  "url": "https://app.example.com/error",
  "viewportWidth": 375,
  "viewportHeight": 812,
  "deviceScaleFactor": 3,
  "fullPage": true
}

Build Constraints

Technical Stack

  • PuppeteerSharp

    .NET port of Puppeteer for headless Chrome control

  • Chromium

    Headless browser engine for accurate rendering

  • 512MB Memory

    Per-request memory allocation for browser instance

Output Specifications

  • PNG / JPEG / WebP

    Multiple output formats with quality control

  • Retina Scaling up to 3x

    High-DPI screenshots for crisp displays

  • 15s Timeout

    Maximum wait time for page load and rendering

Max file size: 10MB
Max viewport: 3840x2160
Max delay: 10,000ms

Error Codes

Code Status Description Resolution
400 Bad Request Invalid URL or missing required parameters Check URL format and required fields
401 Unauthorized Invalid or missing API key Include valid Authorization header
403 Forbidden Rate limit exceeded Wait before retrying or upgrade plan
408 Timeout Page load exceeded 15 seconds Try a simpler page or check URL
422 Unprocessable Invalid viewport or clip dimensions Ensure dimensions are within limits
500 Server Error Internal screenshot capture failure Retry request or contact support