API Documentation

Everything you need to integrate SnapAPI into your application.

Base URL

https://api.test.chmesa.com/api/v1

Authentication

All API requests require authentication using a Bearer token. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Important: Keep your API key secure and never expose it in client-side code.

POST /api/v1/screenshot

Capture a screenshot of any website.

Request Body Parameters

Parameter Type Required Description
url string Yes The URL of the website to screenshot
width integer No Viewport width in pixels (default: 1920)
height integer No Viewport height in pixels (default: 1080)
format string No Image format: png, jpg, or webp (default: png)
full_page boolean No Capture full page or just viewport (default: false)
dark_mode boolean No Enable dark mode (default: false)
delay integer No Wait time in seconds before capture (default: 0, max: 10)
quality integer No Image quality 1-100 for jpg/webp (default: 80)

Example Request

{
  "url": "https://example.com",
  "width": 1920,
  "height": 1080,
  "format": "png",
  "full_page": false,
  "dark_mode": false,
  "delay": 2
}

GET /api/v1/usage

Check your current usage and plan limits.

Example Request

curl -X GET https://api.test.chmesa.com/api/v1/usage \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response

{
  "used": 42,
  "limit": 5000,
  "percentage": 0.84,
  "reset_at": "2026-03-23T18:43:00Z",
  "plan": "Pro"
}

Response Format

Successful screenshot requests return the following format:

Success Response (200 OK)

{
  "success": true,
  "screenshot": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "url": "https://example.com",
    "image_url": "https://api.test.chmesa.com/storage/screenshots/550e8400.png",
    "width": 1920,
    "height": 1080,
    "format": "png",
    "file_size": 245632,
    "cached": false,
    "created_at": "2026-02-23T18:43:00Z"
  }
}

Error Codes

The API uses standard HTTP status codes:

400 Bad Request

Invalid parameters or malformed request.

401 Unauthorized

Missing or invalid API key.

403 Forbidden

SSRF protection triggered or blocked URL.

429 Too Many Requests

Monthly quota exceeded or rate limit hit.

500 Internal Server Error

Server error during screenshot capture.

Error Response Format

{
  "success": false,
  "error": {
    "code": "QUOTA_EXCEEDED",
    "message": "Monthly screenshot quota exceeded",
    "details": "You have used 5000 of 5000 screenshots this month"
  }
}

Code Examples

cURL

curl -X POST https://api.test.chmesa.com/api/v1/screenshot \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "width": 1920,
    "height": 1080,
    "format": "png",
    "full_page": true
  }'

Python

import requests

url = "https://api.test.chmesa.com/api/v1/screenshot"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "url": "https://example.com",
    "width": 1920,
    "height": 1080,
    "format": "png",
    "full_page": True,
    "dark_mode": False
}

response = requests.post(url, headers=headers, json=data)
result = response.json()

if result["success"]:
    print(f"Screenshot saved: {result['screenshot']['image_url']}")
else:
    print(f"Error: {result['error']['message']}")

JavaScript (Node.js)

const axios = require('axios');

async function captureScreenshot() {
  try {
    const response = await axios.post(
      'https://api.test.chmesa.com/api/v1/screenshot',
      {
        url: 'https://example.com',
        width: 1920,
        height: 1080,
        format: 'png',
        full_page: true
      },
      {
        headers: {
          'Authorization': 'Bearer YOUR_API_KEY',
          'Content-Type': 'application/json'
        }
      }
    );
    
    console.log('Screenshot URL:', response.data.screenshot.image_url);
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
  }
}

captureScreenshot();

PHP

$ch = curl_init('https://api.test.chmesa.com/api/v1/screenshot');

$data = [
    'url' => 'https://example.com',
    'width' => 1920,
    'height' => 1080,
    'format' => 'png',
    'full_page' => true
];

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer YOUR_API_KEY',
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

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

$result = json_decode($response, true);

if ($result['success']) {
    echo "Screenshot URL: " . $result['screenshot']['image_url'];
} else {
    echo "Error: " . $result['error']['message'];
}

Go

package main

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

func main() {
    url := "https://api.test.chmesa.com/api/v1/screenshot"
    
    data := map[string]interface{}{
        "url":       "https://example.com",
        "width":     1920,
        "height":    1080,
        "format":    "png",
        "full_page": true,
    }
    
    jsonData, _ := json.Marshal(data)
    
    req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
    req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
    req.Header.Set("Content-Type", "application/json")
    
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()
    
    var result map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&result)
    
    fmt.Println(result)
}

Need Help?

Our support team is here to help you integrate SnapAPI.

Go to Dashboard