Skip to main content

Documentation

Learn how to capture screenshots, generate PDFs, and extract data from any webpage.

Introduction

Snappy API is a powerful API for capturing screenshots, generating PDFs, and extracting structured data from web pages. It's designed for developers who need reliable, fast, and scalable web capture capabilities.

Key Features

  • URL Screenshots - Capture any public webpage
  • HTML Rendering - Convert HTML/CSS to images
  • AI Extraction - Extract structured data using Claude Vision
  • Global CDN - Images cached at 200+ edge locations

Authentication

All API requests require authentication using an API key. Include your key in the Authorization header.

Request Header
Authorization: Bearer YOUR_API_KEY

Security Best Practices

  • Never expose your API key in client-side code
  • Use environment variables to store keys
  • Rotate keys periodically
  • Use IP restrictions when possible

Quick Start

Get started in minutes with this simple example:

1. Get your API key

Sign up at app.snappyapi.io to get your API key.

2. Make your first request

JavaScript
const response = await fetch('https://core.snappyapi.io/v1/screenshot', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    url: 'https://example.com',
    format: 'png',
    viewport: { width: 1200, height: 630 }
  })
});

const result = await response.json();
console.log(result.data.url); // Screenshot URL

3. Use the result

The response contains a URL to your screenshot hosted on our global CDN. Use it directly in your application.

URL Screenshots

Capture screenshots of any public webpage with full control over viewport, format, and timing.

POST /v1/screenshot
{
  "url": "https://example.com",
  "format": "png",           // png, jpeg, webp, pdf
  "viewport": {
    "width": 1200,
    "height": 630
  },
  "fullPage": false,         // Capture full scrolling page
  "waitUntil": "networkidle", // load, domcontentloaded, networkidle
  "delay": 0,                // Wait ms after page load
  "selector": null           // CSS selector to screenshot
}

Response

{
  "success": true,
  "data": {
    "url": "https://cdn.screenshotcore.com/screenshots/abc123.png",
    "width": 1200,
    "height": 630,
    "format": "png",
    "size": 245678,
    "cached": false
  }
}

HTML Rendering

Render custom HTML/CSS directly to images. Perfect for generating invoices, certificates, or social cards.

POST /v1/render
{
  "html": "<div style='padding: 40px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);'><h1 style='color: white; font-size: 48px;'>Hello World</h1></div>",
  "css": "",                 // Optional additional CSS
  "format": "png",
  "viewport": {
    "width": 800,
    "height": 400
  }
}

AI Extraction

Extract structured data from webpages using Claude Vision. Define a schema and let AI parse the content.

POST /v1/extract
{
  "url": "https://example.com/product",
  "prompt": "Extract the product information",
  "schema": {
    "type": "object",
    "properties": {
      "name": { "type": "string" },
      "price": { "type": "number" },
      "description": { "type": "string" },
      "inStock": { "type": "boolean" }
    }
  }
}

Response

{
  "success": true,
  "data": {
    "name": "Wireless Headphones",
    "price": 149.99,
    "description": "Premium noise-canceling headphones...",
    "inStock": true
  },
  "screenshot": "https://cdn.screenshotcore.com/screenshots/abc123.png"
}

Caching

Screenshots are cached by default based on the URL and options. This ensures fast delivery and reduces costs.

Cache Behavior

  • Default TTL: 24 hours for standard screenshots
  • Cache Key: Based on URL + all options (viewport, format, etc.)
  • Bypass: Use cache: false to skip cache
Force fresh screenshot
{
  "url": "https://example.com",
  "cache": false  // Always generate a fresh screenshot
}

Options Reference

Option Type Default Description
url string required URL to capture
format string png png, jpeg, webp, pdf
viewport.width number 1280 Viewport width in pixels
viewport.height number 720 Viewport height in pixels
fullPage boolean false Capture full scrolling page
waitUntil string load load, domcontentloaded, networkidle
delay number 0 Wait ms after page load
selector string null CSS selector to screenshot
quality number 90 JPEG/WebP quality (1-100)
cache boolean true Enable response caching

Error Handling

The API uses standard HTTP status codes and returns detailed error messages.

400 Bad Request
Invalid request parameters
401 Unauthorized
Missing or invalid API key
429 Too Many Requests
Rate limit exceeded
500 Internal Server Error
Server error - retry with exponential backoff

Rate Limits

Rate limits vary by plan. Check the X-RateLimit-* headers in responses.

Plan Requests/minute Concurrent
Free 10 2
Pro 60 10
Business 120 25
Enterprise Custom Custom
Response Headers
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1704067200

Need Help?

Can't find what you're looking for? Our team is here to help.