ScreenshotsAPI Docs

Getting Started

Quick start guide for the Screenshots API

Getting Started with Screenshots API

The Screenshots API is a powerful serverless service that allows you to capture high-quality screenshots of web pages with advanced features like ad blocking, cookie consent handling, and device emulation.

Prerequisites

  1. An API key (contact support to get one)
  2. Basic understanding of HTTP requests
  3. A target URL to capture

Basic Usage

The API is simple to use. Here's a basic example:

async function takeScreenshot() {
  const response = await fetch('https://api.screenshotsapi.dev/screenshot', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
      url: 'https://example.com',
      format: 'jpeg',
      quality: 90
    })
  });
  
  if (!response.ok) {
    throw new Error(`HTTP error! status: ${response.status}`);
  }
  
  return await response.blob();
}

Key Features

The API supports several powerful features:

  1. Multiple Formats: Capture screenshots in JPEG or PNG format
  2. Quality Control: Adjust image quality for JPEG format
  3. Full Page Capture: Capture entire webpage height
  4. Ad Blocking: Remove advertisements from screenshots
  5. Cookie Consent Handling: Automatically handle cookie consent banners
  6. Device Emulation: Simulate different devices and screen sizes
  7. Dark Mode: Capture pages in dark mode
  8. Element Selection: Capture specific elements using CSS selectors

Next Steps

On this page