API Documentation

Learn how to capture website screenshots with the ScreenAPI REST API. Get started in minutes with our simple, developer-friendly interface.

Getting Started

To start capturing website screenshots, you'll need an API key. Sign up for a free account to get your key immediately. No credit card required.

Your API key will look like: sk_3e35cc5381309a0ea85707be0681528c085bfc669cd5de97

Authentication

All API requests require authentication using your API key. Include it in the X-Api-Key header with every request.

curl "https://screenapi.uk/api/v1/screenshot?url=example.com" \
  -H "X-Api-Key: your_api_key"

Screenshot Endpoint

GET https://screenapi.uk/api/v1/screenshot

Captures a screenshot of the specified URL and returns the image directly. The response content-type will match your requested format (image/png, image/jpeg, or image/webp).

Parameters

Parameter Type Required Description
url string Required The URL to capture. Must be a valid http:// or https:// URL.
width integer Optional Viewport width in pixels. Range: 320-3840. Default: 1280
height integer Optional Viewport height in pixels. Range: 200-2160. Default: 800
format string Optional Image format: png, jpeg, or webp. Default: png
full_page boolean Optional Capture full scrollable page. Requires Pro plan. Default: false

Response

Success (200 OK)

Returns the screenshot image with appropriate Content-Type header.

Header Description
Content-Type image/png, image/jpeg, or image/webp
X-Cache HIT if served from cache, MISS if freshly rendered
X-Response-Time Time taken to capture screenshot (e.g., 2341ms)
X-RateLimit-Remaining Requests remaining in current window

Code Examples

cURL

# Basic screenshot
curl "https://screenapi.uk/api/v1/screenshot?url=https://example.com" \
  -H "X-Api-Key: your_api_key" \
  -o screenshot.png

# Full HD JPEG
curl "https://screenapi.uk/api/v1/screenshot?url=https://example.com&width=1920&height=1080&format=jpeg" \
  -H "X-Api-Key: your_api_key" \
  -o screenshot.jpg

# Mobile viewport
curl "https://screenapi.uk/api/v1/screenshot?url=https://example.com&width=375&height=667" \
  -H "X-Api-Key: your_api_key" \
  -o mobile.png

JavaScript (Node.js / Browser)

const response = await fetch(
  'https://screenapi.uk/api/v1/screenshot?url=https://example.com',
  {
    headers: {
      'X-Api-Key': 'your_api_key'
    }
  }
);

const imageBlob = await response.blob();
// Use imageBlob in your application

Python

import requests

response = requests.get(
    'https://screenapi.uk/api/v1/screenshot',
    params={'url': 'https://example.com'},
    headers={'X-Api-Key': 'your_api_key'}
)

with open('screenshot.png', 'wb') as f:
    f.write(response.content)

PHP

<?php
$url = 'https://screenapi.uk/api/v1/screenshot?url=' . urlencode('https://example.com');

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-Api-Key: your_api_key'
]);

$image = curl_exec($ch);
curl_close($ch);

file_put_contents('screenshot.png', $image);

Error Handling

The API returns JSON error responses with appropriate HTTP status codes.

Code Description
400 Bad Request - Invalid parameters or missing URL
401 Unauthorized - Missing or invalid API key
403 Forbidden - Feature not available on your plan
429 Rate Limited - Too many requests or quota exceeded
502 Bad Gateway - Screenshot capture failed
500 Server Error - Internal error, try again

Error Response Format

{
  "error": "Rate limit exceeded. Try again later.",
  "details": {
    "retry_after": 42
  }
}

Rate Limits

API requests are rate limited to ensure fair usage. The default limit is 60 requests per minute per API key.

Tip: Check the X-RateLimit-Remaining header to monitor your remaining requests. Implement exponential backoff when receiving 429 responses.

Monthly Quotas

Plan Screenshots/Month
Free100
Starter1,000
Pro5,000
Business25,000

Need help? Contact us at support@screenapi.uk