POST /screenshot

Capture Screenshot

Generate high-quality screenshots from HTML content or URLs.

Request Body

html string Optional

The raw HTML content to render. Required if url is not provided.

url string Optional

The URL to capture. Required if html is not provided.

options object

Configuration options for the screenshot.

fullPage boolean

Capture the entire page. Default: false.

width integer

Viewport width in pixels. Default: 1920.

height integer

Viewport height in pixels. Default: 1080.

Example Request

Here's how to make a request in different languages:

curl -X POST https://feopdf.com/api/screenshot \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "options": {
      "fullPage": true,
      "width": 1920
    }
  }' \
  --output screenshot.png
const axios = require('axios');
const fs = require('fs');

const response = await axios.post(
  'https://feopdf.com/api/screenshot',
  {
    url: 'https://example.com',
    options: {
      fullPage: true,
      width: 1920
    }
  },
  {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    responseType: 'arraybuffer'
  }
);

fs.writeFileSync('screenshot.png', response.data);
import requests

response = requests.post(
    'https://feopdf.com/api/screenshot',
    json={
        'url': 'https://example.com',
        'options': {
            'fullPage': True,
            'width': 1920
        }
    },
    headers={
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
    }
)

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

$ch = curl_init('https://feopdf.com/api/screenshot');

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode([
        'url' => 'https://example.com',
        'options' => [
            'fullPage' => true,
            'width' => 1920
        ]
    ]),
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_API_KEY',
        'Content-Type: application/json'
    ]
]);

$image = curl_exec($ch);
file_put_contents('screenshot.png', $image);
curl_close($ch);

Response

Returns the binary image content with Content-Type: image/png.