Professional Screenshot API with Multi-Format Support

🚀 Overview

SnipAPI is a powerful, professional screenshot API that allows you to capture web pages in multiple formats including images, PDFs, HTML, and Markdown. Our service offers enterprise-grade reliability, comprehensive format support, and advanced customization options.

📷

Multi-Format Support

Capture screenshots in 12+ formats including PNG, JPEG, WebP, PDF, HTML, and Markdown

High Performance

Optimized Chrome engine with advanced cleanup and lazy loading support

🛡️

Enterprise Ready

Rate limiting, authentication, monitoring, and comprehensive error handling

🎨

Customizable

Full page capture, mobile view, retina support, and intelligent cleanup

Base URL: https://api.snipapi.com

🔐 Authentication

🔑 API Key Required: All requests must include your API key in the X-API-Key header.

SnipAPI uses API key authentication to secure access to all endpoints. Every request to the API must include a valid API key in the request headers. This ensures that only authorized users can access the screenshot functionality and protects your account from unauthorized usage.

Get Your API Key

Follow these simple steps to obtain your API key:

  1. Login to your dashboard at https://app.snipapi.com
  2. Navigate to "API Keys" section in the sidebar
  3. Create a new key or copy an existing one
  4. Store your API key securely (it won't be shown again)

Using Your API Key

Include your API key in every request using the X-API-Key header:

curl -X GET "https://api.snipapi.com/user/stats" \
  -H "X-API-Key: YOUR_API_KEY_HERE"
🛡️ Security Best Practices:
  • Never expose your API key in client-side code - Always make requests from your server
  • Keep your API key private - Don't share it in public repositories or logs
  • Rotate your keys regularly - Generate new keys periodically for better security
  • Use environment variables - Store API keys in environment variables, not in code
  • Monitor usage - Regularly check your dashboard for any unusual activity

Rate Limiting

Rate limits vary by format to ensure optimal performance and fair usage:

Format Type Rate Limit Description
PDF 5 requests/minute PDF generation is resource intensive
HTML/Markdown 15 requests/minute Text content extraction
Image formats 20 requests/minute PNG, JPEG, WebP, AVIF, etc.

Rate Limit Headers

Every API response includes rate limit information in the headers:

  • X-RateLimit-Remaining: Requests remaining in current window
  • X-RateLimit-Reset: Time when rate limit resets (Unix timestamp)
  • X-RateLimit-Limit: Maximum requests allowed per minute
💡 Rate Limit Tips: If you hit a rate limit, wait for the reset time or upgrade your plan for higher limits. Monitor the rate limit headers to implement proper throttling in your application.

📡 API Endpoints

POST /screenshot
Capture a screenshot with comprehensive format and customization options

Request Parameters

Parameter Type Required Description
url string Required Target URL to screenshot
format string Optional Output format (default: png)
width integer Optional Screenshot width (default: 1920)
height integer Optional Screenshot height (default: 1080)
full_page boolean Optional Capture full page (default: false)
mobile_view boolean Optional Mobile viewport simulation (default: false)
quality integer Optional Quality for lossy formats 1-100 (default: 90)
wait_time integer Optional Wait time in seconds (default: 5)
retina boolean Optional Retina/HiDPI support (default: false)
block_ads boolean Optional Block advertisements (default: true)
hide_popups boolean Optional Hide popups and overlays (default: true)

Example Request

curl -X POST "https://api.snipapi.com/screenshot" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "format": "png",
    "quality": 90,
    "width": 1920,
    "height": 1080,
    "wait_time": 5,
    "full_page": true,
    "mobile_view": false,
    "retina": false,
    "block_ads": true,
    "hide_popups": true,
    "gentle_cleanup": false
  }'

Response

{
  "success": true,
  "screenshot": {
    "id": 12345,
    "filename": "screenshot_20240724_143022.png",
    "url": "https://example.com",
    "public_url": "https://storage.snipapi.com/screenshots/2024/7/screenshot_20240724_143022.png",
    "width": 1920,
    "height": 1080,
    "format": "png",
    "quality": 90,
    "file_size": 245760,
    "processing_time": 3.24,
    "status": "completed",
    "created_at": "2024-07-24T14:30:22Z"
  },
  "format_info": {
    "format": "png",
    "supports_transparency": true,
    "is_lossy": false,
    "mime_type": "image/png"
  },
  "rate_limit": {
    "remaining": 19,
    "reset_at": "2024-07-24T14:31:00Z"
  }
}
GET /screenshots
List your screenshots with filtering and pagination

Query Parameters

Parameter Type Description
page integer Page number (default: 1)
per_page integer Items per page (default: 20, max: 100)
format string Filter by format
status string Filter by status (completed, failed, processing)
sort_by string Sort field (created_at, id, filename, etc.)
sort_order string Sort direction (asc, desc)
GET /screenshots/{id}
Get detailed information about a specific screenshot

Example Request

curl -X GET "https://api.snipapi.com/screenshots/12345" \
  -H "X-API-Key: YOUR_API_KEY"

Response

{
  "screenshot": {
    "id": 12345,
    "filename": "screenshot_20240724_143022.png",
    "url": "https://example.com",
    "public_url": "https://storage.snipapi.com/screenshots/2024/7/screenshot_20240724_143022.png",
    "width": 1920,
    "height": 1080,
    "format": "png",
    "quality": 90,
    "file_size": 245760,
    "processing_time": 3.24,
    "status": "completed",
    "created_at": "2024-07-24T14:30:22Z"
  },
  "format_details": {
    "format": "png",
    "original_format": "png",
    "quality": 90,
    "content_type": "image/png",
    "is_image_format": true,
    "format_properties": {
      "supports_transparency": true,
      "is_lossy": false,
      "mime_type": "image/png"
    }
  },
  "rate_limit": {
    "remaining": 17,
    "reset_at": "2024-07-24T14:31:00Z"
  }
}
DELETE /screenshots/{id}
Delete a screenshot and its associated file

Example Request

curl -X DELETE "https://api.snipapi.com/screenshots/12345" \
  -H "X-API-Key: YOUR_API_KEY"

Response

{
  "success": true,
  "message": "Screenshot (format: png) deleted successfully",
  "deleted_screenshot": {
    "id": 12345,
    "format": "png",
    "filename": "screenshot_20240724_143022.png"
  },
  "rate_limit": {
    "remaining": 16,
    "reset_at": "2024-07-24T14:31:00Z"
  }
}
GET /formats
Get list of supported formats and their properties
GET /user/stats
Get user statistics and usage information
GET /health
API health check and service status

Example Request

curl -X GET "http://localhost:8050/api/health" \
  -H "X-API-Key: YOUR_API_KEY"

Response

{
  "status": "healthy",
  "timestamp": 1690200234.567,
  "version": "2.0.0",
  "service": "SnipAPI",
  "features": {
    "format_support": true,
    "supported_formats": ["png", "webp", "jpeg", "pdf", "html", "markdown", "gif", "avif", "heif", "jp2", "tiff"],
    "total_formats": 12
  },
  "database": "healthy"
}

🎨 Supported Formats

SnipAPI supports a comprehensive range of output formats to meet any use case. Choose the right format based on your specific needs:

📊 Format Comparison Table

Format Extension MIME Type Transparency Lossy/Lossless Quality Setting Best Use Case Rate Limit
PNG .png image/png ✅ Yes 🔒 Lossless ❌ N/A UI elements, graphics 20/min
JPEG .jpg image/jpeg ❌ No 📉 Lossy ✅ 1-100 Photos, content 20/min
WebP .webp image/webp ✅ Yes 📉 Lossy ✅ 1-100 Web optimized images 20/min
AVIF .avif image/avif ✅ Yes 📉 Lossy ✅ 1-100 Next-gen compression 20/min
HEIF .heif image/heif ✅ Yes 📉 Lossy ✅ 1-100 Mobile optimized 20/min
GIF .gif image/gif ✅ Yes 📉 Lossy ❌ N/A Simple animations 20/min
TIFF .tiff image/tiff ✅ Yes 🔒 Lossless ❌ N/A Archival quality 20/min
JP2 .jp2 image/jp2 ✅ Yes 📉 Lossy ✅ 1-100 High quality images 20/min
PDF .pdf application/pdf ❌ No 🔒 Lossless ❌ N/A Documents, reports 5/min
HTML .html text/html ❌ N/A 🔒 Lossless ❌ N/A Source archiving 15/min
Markdown .md text/markdown ❌ N/A 🔒 Lossless ❌ N/A Content extraction 15/min
🖼️

Image Formats

PNG, JPEG, WebP, AVIF, HEIF, GIF, TIFF, JP2

Traditional and modern image formats
📄

Document Format

PDF

Perfect for reports and documentation
📝

Text Formats

HTML, Markdown

For content extraction and archiving
Format Selection Tips: Use PNG for graphics with transparency, JPEG for photos, WebP for web optimization, PDF for documents, and HTML/Markdown for content extraction. Quality settings only apply to lossy formats.

💻 Code Examples

Clean, copy-paste ready examples for each endpoint in all major programming languages.

📸 Take Screenshot

🐍 Python

import requests

response = requests.post(
    'https://api.snipapi.com/screenshot',
    headers={
        'X-API-Key': 'YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    json={
        'url': 'https://chatapp.online/',
        'format': 'webp',
        'quality': 90,
        'width': 1920,
        'height': 1080,
        'wait_time': 5,
        'full_page': True,
        'mobile_view': False,
        'retina': False,
        'block_ads': True,
        'hide_popups': True,
        'gentle_cleanup': False
    }
)

if response.status_code == 201:
    data = response.json()
    print(f"Screenshot URL: {data['screenshot']['public_url']}")
    print(f"Screenshot ID: {data['screenshot']['id']}")
else:
    print(f"Error: {response.status_code}")

🌐 JavaScript

const response = await fetch('https://api.snipapi.com/screenshot', {
    method: 'POST',
    headers: {
        'X-API-Key': 'YOUR_API_KEY',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        url: 'https://chatapp.online/',
        format: 'webp',
        quality: 90,
        width: 1920,
        height: 1080,
        wait_time: 5,
        full_page: true,
        mobile_view: false,
        retina: false,
        block_ads: true,
        hide_popups: true,
        gentle_cleanup: false
    })
});

if (response.status === 201) {
    const data = await response.json();
    console.log('Screenshot URL:', data.screenshot.public_url);
    console.log('Screenshot ID:', data.screenshot.id);
} else {
    console.error('Error:', response.status);
}

🐘 PHP

<?php
$data = json_encode([
    'url' => 'https://chatapp.online/',
    'format' => 'webp',
    'quality' => 90,
    'width' => 1920,
    'height' => 1080,
    'wait_time' => 5,
    'full_page' => true,
    'mobile_view' => false,
    'retina' => false,
    'block_ads' => true,
    'hide_popups' => true,
    'gentle_cleanup' => false
]);

$context = stream_context_create([
    'http' => [
        'method' => 'POST',
        'header' => [
            'X-API-Key: YOUR_API_KEY',
            'Content-Type: application/json'
        ],
        'content' => $data
    ]
]);

$response = file_get_contents('https://api.snipapi.com/screenshot', false, $context);
$result = json_decode($response, true);

if ($result['success']) {
    echo "Screenshot URL: " . $result['screenshot']['public_url'] . "\n";
    echo "Screenshot ID: " . $result['screenshot']['id'] . "\n";
} else {
    echo "Error: " . $result['error']['message'] . "\n";
}
?>

☕ Java

import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;

String json = """
{
    "url": "https://chatapp.online/",
    "format": "webp",
    "quality": 90,
    "width": 1920,
    "height": 1080,
    "wait_time": 5,
    "full_page": true,
    "mobile_view": false,
    "retina": false,
    "block_ads": true,
    "hide_popups": true,
    "gentle_cleanup": false
}
""";

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.snipapi.com/screenshot"))
    .header("X-API-Key", "YOUR_API_KEY")
    .header("Content-Type", "application/json")
    .POST(HttpRequest.BodyPublishers.ofString(json))
    .build();

HttpResponse<String> response = client.send(request, 
    HttpResponse.BodyHandlers.ofString());

if (response.statusCode() == 201) {
    System.out.println("Success: " + response.body());
} else {
    System.out.println("Error: " + response.statusCode());
}

🐹 Go

package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
)

func main() {
	payload := map[string]interface{}{
		"url":             "https://chatapp.online/",
		"format":          "webp",
		"quality":         90,
		"width":           1920,
		"height":          1080,
		"wait_time":       5,
		"full_page":       true,
		"mobile_view":     false,
		"retina":          false,
		"block_ads":       true,
		"hide_popups":     true,
		"gentle_cleanup":  false,
	}

	jsonData, _ := json.Marshal(payload)
	
	req, _ := http.NewRequest("POST", 
		"https://api.snipapi.com/screenshot", 
		bytes.NewBuffer(jsonData))
	req.Header.Set("X-API-Key", "YOUR_API_KEY")
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	
	if err != nil {
		fmt.Println("Error:", err)
		return
	}
	defer resp.Body.Close()

	if resp.StatusCode == 201 {
		fmt.Println("Screenshot created successfully!")
	} else {
		fmt.Println("Error:", resp.StatusCode)
	}
}

⚡ C#

using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        var json = @"{
            ""url"": ""https://chatapp.online/"",
            ""format"": ""webp"",
            ""quality"": 90,
            ""width"": 1920,
            ""height"": 1080,
            ""wait_time"": 5,
            ""full_page"": true,
            ""mobile_view"": false,
            ""retina"": false,
            ""block_ads"": true,
            ""hide_popups"": true,
            ""gentle_cleanup"": false
        }";

        using var client = new HttpClient();
        client.DefaultRequestHeaders.Add("X-API-Key", "YOUR_API_KEY");
        
        var content = new StringContent(json, Encoding.UTF8, "application/json");
        var response = await client.PostAsync("https://api.snipapi.com/screenshot", content);

        if (response.IsSuccessStatusCode)
        {
            var result = await response.Content.ReadAsStringAsync();
            Console.WriteLine("Screenshot created successfully!");
        }
        else
        {
            Console.WriteLine($"Error: {response.StatusCode}");
        }
    }
}

📋 List Screenshots

🐍 Python

import requests

response = requests.get(
    'https://api.snipapi.com/screenshots',
    headers={'X-API-Key': 'YOUR_API_KEY'},
    params={
        'page': 1,
        'per_page': 10,
        'format': 'webp',
        'status': 'completed'
    }
)

if response.status_code == 200:
    data = response.json()
    print(f"Total screenshots: {data['pagination']['total']}")
    for screenshot in data['screenshots']:
        print(f"ID: {screenshot['id']}, URL: {screenshot['url']}")

🌐 JavaScript

const params = new URLSearchParams({
    page: 1,
    per_page: 10,
    format: 'webp',
    status: 'completed'
});

const response = await fetch(`https://api.snipapi.com/screenshots?${params}`, {
    headers: {
        'X-API-Key': 'YOUR_API_KEY'
    }
});

if (response.ok) {
    const data = await response.json();
    console.log('Total screenshots:', data.pagination.total);
    data.screenshots.forEach(screenshot => {
        console.log(`ID: ${screenshot.id}, URL: ${screenshot.url}`);
    });
}

🐘 PHP

<?php
$params = http_build_query([
    'page' => 1,
    'per_page' => 10,
    'format' => 'webp',
    'status' => 'completed'
]);

$context = stream_context_create([
    'http' => [
        'method' => 'GET',
        'header' => 'X-API-Key: YOUR_API_KEY'
    ]
]);

$response = file_get_contents("https://api.snipapi.com/screenshots?{$params}", false, $context);
$data = json_decode($response, true);

echo "Total screenshots: " . $data['pagination']['total'] . "\n";
foreach ($data['screenshots'] as $screenshot) {
    echo "ID: " . $screenshot['id'] . ", URL: " . $screenshot['url'] . "\n";
}
?>

🔍 Get Single Screenshot

🐍 Python

import requests

screenshot_id = 123
response = requests.get(
    f'https://api.snipapi.com/screenshots/{screenshot_id}',
    headers={'X-API-Key': 'YOUR_API_KEY'}
)

if response.status_code == 200:
    data = response.json()
    screenshot = data['screenshot']
    print(f"Filename: {screenshot['filename']}")
    print(f"Format: {screenshot['format']}")
    print(f"File Size: {screenshot['file_size']} bytes")
    print(f"Download URL: {screenshot['public_url']}")

🌐 JavaScript

const screenshotId = 123;
const response = await fetch(`https://api.snipapi.com/screenshots/${screenshotId}`, {
    headers: {
        'X-API-Key': 'YOUR_API_KEY'
    }
});

if (response.ok) {
    const data = await response.json();
    const screenshot = data.screenshot;
    console.log('Filename:', screenshot.filename);
    console.log('Format:', screenshot.format);
    console.log('File Size:', screenshot.file_size, 'bytes');
    console.log('Download URL:', screenshot.public_url);
}

🗑️ Delete Screenshot

🐍 Python

import requests

screenshot_id = 123
response = requests.delete(
    f'https://api.snipapi.com/screenshots/{screenshot_id}',
    headers={'X-API-Key': 'YOUR_API_KEY'}
)

if response.status_code == 200:
    data = response.json()
    print(f"✅ {data['message']}")
else:
    print(f"❌ Error: {response.status_code}")

🌐 JavaScript

const screenshotId = 123;
const response = await fetch(`https://api.snipapi.com/screenshots/${screenshotId}`, {
    method: 'DELETE',
    headers: {
        'X-API-Key': 'YOUR_API_KEY'
    }
});

if (response.ok) {
    const data = await response.json();
    console.log('✅', data.message);
} else {
    console.error('❌ Error:', response.status);
}

📊 Get User Statistics

🐍 Python

import requests

response = requests.get(
    'https://api.snipapi.com/user/stats',
    headers={'X-API-Key': 'YOUR_API_KEY'}
)

if response.status_code == 200:
    data = response.json()
    user = data['user']
    print(f"Plan: {user['plan']}")
    print(f"Monthly Usage: {user['monthly_usage']}/{user['monthly_limit']}")
    print(f"Total Screenshots: {user['total_screenshots']}")
    
    # Format usage breakdown
    if 'format_usage' in user:
        print("\nFormat Usage:")
        for format_name, stats in user['format_usage'].items():
            print(f"  {format_name}: {stats['count']} screenshots")

🌐 JavaScript

const response = await fetch('https://api.snipapi.com/user/stats', {
    headers: {
        'X-API-Key': 'YOUR_API_KEY'
    }
});

if (response.ok) {
    const data = await response.json();
    const user = data.user;
    
    console.log('Plan:', user.plan);
    console.log(`Monthly Usage: ${user.monthly_usage}/${user.monthly_limit}`);
    console.log('Total Screenshots:', user.total_screenshots);
    
    if (user.format_usage) {
        console.log('\nFormat Usage:');
        Object.entries(user.format_usage).forEach(([format, stats]) => {
            console.log(`  ${format}: ${stats.count} screenshots`);
        });
    }
}

📄 Get Supported Formats

🐍 Python

import requests

response = requests.get(
    'https://api.snipapi.com/formats',
    headers={'X-API-Key': 'YOUR_API_KEY'}
)

if response.status_code == 200:
    data = response.json()
    print(f"Total formats supported: {data['total_supported']}")
    print(f"Default format: {data['default_format']}")
    
    print("\nSupported formats:")
    for format_name, info in data['formats'].items():
        transparency = "✅" if info['supports_transparency'] else "❌"
        lossy = "Lossy" if info['lossy'] else "Lossless"
        print(f"  {format_name}: {info['mime_type']}, {lossy}, Transparency: {transparency}")

🌐 JavaScript

const response = await fetch('https://api.snipapi.com/formats', {
    headers: {
        'X-API-Key': 'YOUR_API_KEY'
    }
});

if (response.ok) {
    const data = await response.json();
    
    console.log('Total formats supported:', data.total_supported);
    console.log('Default format:', data.default_format);
    
    console.log('\nSupported formats:');
    Object.entries(data.formats).forEach(([formatName, info]) => {
        const transparency = info.supports_transparency ? '✅' : '❌';
        const lossy = info.lossy ? 'Lossy' : 'Lossless';
        console.log(`  ${formatName}: ${info.mime_type}, ${lossy}, Transparency: ${transparency}`);
    });
}
💡 Quick Tips:
  • Error Handling: Always check HTTP status codes before processing responses
  • Rate Limits: Monitor rate limit headers to avoid being throttled
  • Timeouts: Set appropriate timeouts for screenshot operations (30-60 seconds)
  • Formats: Choose the right format for your use case (PNG for UI, JPEG for photos, WebP for web)

⚠️ Error Handling

SnipAPI uses conventional HTTP status codes and provides detailed error information:

HTTP Status Codes

Code Meaning Description
200 OK Request successful
201 Created Screenshot created successfully
400 Bad Request Invalid request parameters
401 Unauthorized Invalid or missing API key
403 Forbidden Rate limit exceeded or access denied
404 Not Found Resource not found
429 Too Many Requests Rate limit exceeded
500 Internal Server Error Server error

Error Response Format

{
  "success": false,
  "error": {
    "type": "validation_error",
    "message": "Request validation failed",
    "code": 400,
    "details": {
      "url": ["Invalid URL format"],
      "width": ["Width must be between 100 and 4000 pixels"]
    }
  }
}

Common Error Types

  • format_not_supported: Requested format is not supported
  • validation_error: Request parameters are invalid
  • rate_limit_exceeded: Too many requests
  • screenshot_timeout: Screenshot operation timed out
  • invalid_url: URL is malformed or unreachable
  • storage_error: File storage operation failed
Best Practice: Always check the success field in the response and handle errors appropriately in your application.