API Documentation

Everything you need to integrate the Screenshot API into your application

Authentication

All API requests require an API key passed in the x-api-key header.

Demo API Key

Use ek_live_74qlNSbK5jTwq28Y for testing. This key has free tier limits (10 requests/minute, 100/month).

API Endpoint

POSThttps://screenshot.endpnt.dev/api/v1/capture
GEThttps://screenshot.endpnt.dev/api/v1/capture?url=...

Both GET and POST methods are supported. For POST requests, send parameters in the request body as JSON. For GET requests, send parameters as URL query parameters.

Parameters

ParameterTypeRequiredDefaultDescription
urlstringYesURL to screenshot. Must be valid http:// or https://
formatstringNopngOutput format: "png", "jpeg", "pdf"
widthnumberNo1280Viewport width in pixels (320-3840)
heightnumberNo720Viewport height in pixels (320-2160)
full_pagebooleanNofalseCapture entire scrollable page
wait_fornumberNo0Milliseconds to wait after load (max: 10000)
selectorstringNoCSS selector to capture specific element
qualitynumberNo80JPEG quality (1-100)
dark_modebooleanNofalseEmulate dark color scheme preference
devicestringNodesktopDevice preset: "desktop", "mobile", "tablet"

Response Format

Success Response

{
  "success": true,
  "data": {
    "image": "base64_encoded_image_data...",
    "width": 1280,
    "height": 720,
    "format": "png",
    "file_size_bytes": 284720
  },
  "meta": {
    "request_id": "req_a1b2c3d4",
    "processing_ms": 1840,
    "remaining_credits": 99
  }
}

Error Response

{
  "success": false,
  "error": {
    "code": "INVALID_URL",
    "message": "The provided URL is not valid. Must be http:// or https://"
  },
  "meta": {
    "request_id": "req_a1b2c3d4",
    "processing_ms": 120
  }
}

Interactive API Tester

Test the API directly from this page. The demo key is pre-filled for convenience.

Interactive API Tester

Code Examples

cURL

curl -X POST https://screenshot.endpnt.dev/api/v1/capture \
  -H "x-api-key: ek_live_demo123" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "format": "png",
    "width": 1280,
    "height": 720,
    "full_page": true,
    "dark_mode": false
  }'

JavaScript (Browser/Node.js)

// Using fetch
const response = await fetch('https://screenshot.endpnt.dev/api/v1/capture', {
  method: 'POST',
  headers: {
    'x-api-key': 'your_api_key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    url: 'https://example.com',
    format: 'png',
    width: 1280,
    height: 720,
    full_page: true
  })
});

const result = await response.json();
if (result.success) {
  // result.data.image contains base64 image data
  const img = document.createElement('img');
  img.src = `data:image/${result.data.format};base64,${result.data.image}`;
  document.body.appendChild(img);
}

Node.js with axios

// Using Node.js with axios
const axios = require('axios');
const fs = require('fs');

async function takeScreenshot(url) {
  try {
    const response = await axios.post(
      'https://screenshot.endpnt.dev/api/v1/capture',
      {
        url: url,
        format: 'png',
        width: 1280,
        height: 720,
        full_page: true
      },
      {
        headers: {
          'x-api-key': 'your_api_key',
          'Content-Type': 'application/json'
        }
      }
    );

    if (response.data.success) {
      const imageBuffer = Buffer.from(response.data.data.image, 'base64');
      fs.writeFileSync('screenshot.png', imageBuffer);
      console.log('Screenshot saved!');
    }
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
  }
}

takeScreenshot('https://example.com');

Python

import requests
import base64

# Make the API request
response = requests.post(
    'https://screenshot.endpnt.dev/api/v1/capture',
    headers={
        'x-api-key': 'your_api_key',
        'Content-Type': 'application/json'
    },
    json={
        'url': 'https://example.com',
        'format': 'png',
        'width': 1280,
        'height': 720,
        'full_page': True
    }
)

result = response.json()
if result['success']:
    # Decode and save the image
    image_data = base64.b64decode(result['data']['image'])
    with open('screenshot.png', 'wb') as f:
        f.write(image_data)
    print(f"Saved screenshot: {result['data']['width']}x{result['data']['height']}")

Error Codes

CodeStatusDescription
AUTH_REQUIRED401Missing x-api-key header
INVALID_API_KEY401API key does not exist or is invalid
RATE_LIMIT_EXCEEDED429Too many requests for your tier
INVALID_URL400URL is malformed or not http/https
INVALID_PARAMS400Parameter validation failed
CAPTURE_FAILED500Browser could not capture the page
TIMEOUT504Page took too long to load
INTERNAL_ERROR500Internal server error

Rate Limits

Rate limits depend on your subscription tier:

Free Tier

10 requests per minute
100 requests per month

Starter ($29/month)

60 requests per minute
5,000 requests per month

Pro ($99/month)

300 requests per minute
25,000 requests per month

Enterprise (Custom)

1,000+ requests per minute
100,000+ requests per month

Rate Limit Headers

Check the remaining_credits field in the response to track your usage. When limits are exceeded, you'll receive a 429 status code.

Need Help?

Can't find what you're looking for? We're here to help.