Capture Website Screenshots with a REST API
Need to capture a screenshot of any website from your backend, CI pipeline, or automation script? The Apixies Screenshot API lets you render a URL and receive a pixel-perfect PNG or JPEG image in a single HTTP request -- no headless browser infrastructure to maintain.
How the Screenshot API Works
The endpoint accepts a GET request with the target URL as a query parameter. Behind the scenes, a real Chromium browser loads the page, waits for rendering to complete, and streams back a binary image.
GET https://apixies.io/api/v1/screenshot?url=https://example.com
The response is the raw image bytes with the appropriate Content-Type header (image/png or image/jpeg). There's no JSON wrapper -- you save the response body directly to a file or pass it downstream.
Authentication
Pass your API key in the X-API-Key header. You can start testing immediately: anonymous requests are allowed at 20 requests per day, and a free registered account unlocks 75 requests/day -- more than enough for development and light production workloads.
curl -H "X-API-Key: YOUR_API_KEY" \
"https://apixies.io/api/v1/screenshot?url=https://example.com" \
-o screenshot.png
Get a free API key to raise your daily limit and unlock additional features.
Available Parameters
The endpoint exposes five parameters that cover the most common screenshot scenarios:
| Parameter | Required | Default | Description |
|---|---|---|---|
url |
Yes | -- | The webpage URL to capture |
format |
No | png |
Output format: png or jpeg |
full_page |
No | false |
Capture the entire scrollable page |
width |
No | 1280 |
Viewport width in pixels |
height |
No | 800 |
Viewport height in pixels |
See the full Screenshot API reference for details on rate limits, error codes, and response headers.
Step-by-Step: Your First Screenshot
1. Capture a Simple Screenshot
The quickest way to test is with cURL. This command saves a 1280x800 viewport screenshot of example.com as a PNG file:
curl -H "X-API-Key: YOUR_API_KEY" \
"https://apixies.io/api/v1/screenshot?url=https://example.com" \
-o example.png
2. Change the Viewport Size
If you need a mobile-width screenshot or a wide desktop capture, set width and height:
curl -H "X-API-Key: YOUR_API_KEY" \
"https://apixies.io/api/v1/screenshot?url=https://example.com&width=375&height=812" \
-o mobile-screenshot.png
A 375x812 viewport simulates an iPhone-sized screen -- useful for verifying responsive layouts or generating mobile-specific thumbnails.
3. Request JPEG Instead of PNG
JPEG files are significantly smaller, which matters when you're storing thousands of thumbnails or serving them over a bandwidth-constrained connection:
curl -H "X-API-Key: YOUR_API_KEY" \
"https://apixies.io/api/v1/screenshot?url=https://example.com&format=jpeg" \
-o example.jpg
PNG is lossless and better for text-heavy pages or design accuracy checks. JPEG is ideal when file size matters more than pixel-perfect fidelity.
4. Capture the Full Page
By default, the API returns only the visible viewport. Pass full_page=true to render the entire scrollable document as a single tall image:
curl -H "X-API-Key: YOUR_API_KEY" \
"https://apixies.io/api/v1/screenshot?url=https://example.com&full_page=true" \
-o full-page.png
Full-page mode is covered in depth in the full-page screenshot guide.
Code Examples
JavaScript (Node.js)
const fs = require("fs");
async function captureScreenshot(url) {
const endpoint = "https://apixies.io/api/v1/screenshot";
const params = new URLSearchParams({ url, width: "1280", format: "png" });
const response = await fetch(`${endpoint}?${params}`, {
headers: { "X-API-Key": process.env.APIXIES_KEY },
});
if (!response.ok) {
throw new Error(`Screenshot failed: ${response.status}`);
}
const buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync("screenshot.png", buffer);
console.log("Saved screenshot.png");
}
captureScreenshot("https://example.com");
Python
import requests
import os
api_key = os.environ["APIXIES_KEY"]
response = requests.get(
"https://apixies.io/api/v1/screenshot",
params={"url": "https://example.com", "format": "png", "width": 1280},
headers={"X-API-Key": api_key},
)
response.raise_for_status()
with open("screenshot.png", "wb") as f:
f.write(response.content)
print("Saved screenshot.png")
PHP
$apiKey = getenv('APIXIES_KEY');
$query = http_build_query([
'url' => 'https://example.com',
'format' => 'png',
'width' => 1280,
]);
$ch = curl_init("https://apixies.io/api/v1/screenshot?{$query}");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: {$apiKey}"]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$image = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status === 200) {
file_put_contents('screenshot.png', $image);
echo "Saved screenshot.png\n";
}
Viewport vs. Full-Page Screenshots
Understanding the difference between these two modes is important for choosing the right approach:
- Viewport screenshot (
full_page=false, the default) -- renders only the area visible inside the browser window at the givenwidthandheight. This is the equivalent of what a user sees without scrolling. Ideal for thumbnails, link previews, and OG images. - Full-page screenshot (
full_page=true) -- renders the entire document from top to bottom regardless of viewport height. The resulting image can be very tall for long pages, making it well-suited for archival, QA testing, and design review.
If you're generating link preview images, check out the dedicated link preview guide for tips on sizing and caching.
Common Use Cases
- Link previews and OG images -- generate a thumbnail for every URL your users submit.
- Automated QA and visual regression -- screenshot staging pages in CI and compare against baselines.
- Archival and compliance -- save a visual record of a page at a specific point in time.
- Monitoring dashboards -- display a live preview of external sites without embedding iframes.
- PDF alternatives -- when you need a quick visual snapshot instead of a full PDF conversion.
Tips for Reliable Screenshots
- URL-encode the
urlparameter -- special characters in query strings can break the request. In most languages, use the built-in URL encoding function (encodeURIComponentin JavaScript,urllib.parse.quotein Python,urlencodein PHP). - Use JPEG for thumbnails -- if you're serving small preview images, JPEG keeps file sizes low without visible quality loss at thumbnail scale.
- Set realistic viewport dimensions -- a 1280x800 default works for most desktop pages; use 375x812 for mobile.
- Handle errors gracefully -- if the target site is slow or unreachable, the API returns an appropriate HTTP error code. Retry with exponential backoff for transient failures.
- Cache aggressively -- if the target page doesn't change often, store the screenshot locally and refresh on a schedule rather than re-requesting every time.
Next Steps
The free tier gives you 75 requests/day with a free account, which is enough to integrate screenshots into a side project, internal tool, or staging environment. When you're ready for higher volume, paid plans are available.
- Screenshot API documentation -- full parameter reference and error codes.
- Build link previews -- generate social sharing thumbnails automatically.
- Full-page screenshots -- capture long scrollable pages in one image.
- All guides -- browse every tutorial and use case.
Get your free API key and start capturing screenshots in minutes.