Capture full-page screenshots of any website. Custom viewport, format options. Headless Chrome powered. Free tier.
Welcome to the DevProToolkit API platform, where you can capture any website as an image using our free screenshot API. In this article, we'll explore the features and benefits of our API, as well as provide a step-by-step guide on how to get started.
Our screenshot API allows you to capture full page screenshots, emulate mobile devices, and customize the viewport to suit your needs. You can also delay the screenshot capture to allow for JavaScript rendering, and generate thumbnails for faster loading times. With multiple output formats available, including PNG, JPG, and WebP, you can choose the format that best suits your application.
Try our free screenshot API today and start capturing high-quality images of any website!
Open API PlaygroundA screenshot API is a web service that allows you to capture images of websites programmatically. This can be useful for a variety of applications, such as link previews, social media cards, monitoring, archiving, and testing.
Capturing screenshots via API offers several advantages over traditional methods, including increased efficiency, accuracy, and scalability. With our screenshot API, you can capture high-quality images of any website, without the need for manual intervention or expensive software.
To get started with our screenshot API, simply sign up for a free account on our website at https://api.commandsector.in/signup. Once you have an account, you can use the API endpoint GET /api/screenshot/capture to capture screenshots of any website. You will need to provide the URL of the website you want to capture, as well as any optional parameters, such as the width, height, and format of the screenshot.
| Parameter | Description | Default Value |
|---|---|---|
| url | The URL of the website to capture | required |
| width | The width of the screenshot in pixels | 1280 |
| height | The height of the screenshot in pixels | 800 |
| format | The format of the screenshot (png, jpg, or webp) | png |
| full_page | Whether to capture the full page or just the visible area | false |
| delay | The delay in milliseconds before capturing the screenshot | 0 |
| device | The device to emulate (desktop, mobile, or tablet) | desktop |
Our screenshot API supports three output formats: PNG, JPG, and WebP. Each format has its own advantages and disadvantages, and the choice of which to use will depend on your specific application. Here is a brief comparison of the three formats:
curl -X GET \ https://api.commandsector.in/api/screenshot/capture \ -H 'X-API-Key: YOUR_API_KEY' \ -d 'url=https://example.com&width=1280&height=800&format=png'
curl -X GET \ https://api.commandsector.in/api/screenshot/capture \ -H 'X-API-Key: YOUR_API_KEY' \ -d 'url=https://example.com&width=1280&height=800&format=png&full_page=true'
curl -X GET \ https://api.commandsector.in/api/screenshot/capture \ -H 'X-API-Key: YOUR_API_KEY' \ -d 'url=https://example.com&width=1280&height=800&format=png&device=mobile'
import requests
api_key = 'YOUR_API_KEY'
url = 'https://example.com'
width = 1280
height = 800
format = 'png'
response = requests.get('https://api.commandsector.in/api/screenshot/capture', headers={'X-API-Key': api_key}, params={'url': url, 'width': width, 'height': height, 'format': format})
if response.status_code == 200:
with open('screenshot.png', 'wb') as f:
f.write(response.content)
else:
print('Error:', response.status_code)
const axios = require('axios');
const api_key = 'YOUR_API_KEY';
const url = 'https://example.com';
const width = 1280;
const height = 800;
const format = 'png';
axios.get('https://api.commandsector.in/api/screenshot/capture', {
headers: {'X-API-Key': api_key},
params: {'url': url, 'width': width, 'height': height, 'format': format},
responseType: 'arraybuffer'
})
.then(response => {
const screenshot = response.data;
// Save the screenshot to a file
const fs = require('fs');
fs.writeFileSync('screenshot.png', screenshot);
})
.catch(error => {
console.error('Error:', error);
});
Our screenshot API has a variety of use cases, including:
Device emulation allows you to capture screenshots of your website or application as it would appear on different devices, such as mobile phones, tablets, or desktop computers. The DevProToolkit API provides a range of device presets that you can use to emulate different viewport settings.
| Device | Viewport Dimensions |
|---|---|
| 390x844 | |
| iPad Pro | 1024x1366 |
| Samsung Galaxy | 360x800 |
| Pixel 8 | 393x851 |
curl -X POST \
https://api.commandsector.in/screenshot \
-H 'Content-Type: application/json' \
-d '{"url": "https://example.com", "device": "iPhone 15", "width": 390, "height": 844}'
You can also specify custom viewport dimensions to emulate other devices or screen sizes.
The DevProToolkit API allows you to capture screenshots of either the full page or the current viewport. The `full_page` parameter determines which type of screenshot to capture.
curl -X POST \
https://api.commandsector.in/screenshot \
-H 'Content-Type: application/json' \
-d '{"url": "https://example.com", "full_page": true}'
When `full_page` is set to `true`, the API will capture a screenshot of the entire scrollable page, including any content that is not currently visible in the viewport.
For example, if you have a webpage with a long scrollable content area, setting `full_page` to `true` will capture the entire content area, including any sections that are not currently visible.
Link preview thumbnails are a great way to enhance the user experience of your application, and the DevProToolkit API makes it easy to generate them. Here's an example of how you can use the API to build an Open Graph image generator/link preview service using Node.js:
const axios = require('axios');
const url = 'https://example.com';
const apiEndpoint = 'https://api.commandsector.in/screenshot';
axios.post(apiEndpoint, {
url,
width: 1200,
height: 630,
full_page: true,
format: 'png'
})
.then(response => {
const screenshot = response.data;
// Use the screenshot to generate a link preview thumbnail
})
.catch(error => {
console.error(error);
});
This example uses the `axios` library to send a POST request to the DevProToolkit API, capturing a screenshot of the specified URL. The `width`, `height`, `full_page`, and `format` parameters are used to customize the screenshot.
The DevProToolkit API can be used for automated visual regression testing of web applications. Here's an example of how you can use the API to capture screenshots and compare them using Python:
import requests
from PIL import Image
from io import BytesIO
def capture_screenshot(url):
api_endpoint = 'https://api.commandsector.in/screenshot'
response = requests.post(api_endpoint, json={
'url': url,
'width': 1920,
'height': 1080,
'full_page': True,
'format': 'png'
})
return response.content
def compare_screenshots(screenshot1, screenshot2):
image1 = Image.open(BytesIO(screenshot1))
image2 = Image.open(BytesIO(screenshot2))
# Compare the images using a library like OpenCV or scikit-image
# Return True if the images are identical, False otherwise
url = 'https://example.com'
screenshot1 = capture_screenshot(url)
screenshot2 = capture_screenshot(url)
if compare_screenshots(screenshot1, screenshot2):
print('The screenshots are identical')
else:
print('The screenshots are different')
This example uses the `requests` library to send a POST request to the DevProToolkit API, capturing a screenshot of the specified URL. The `capture_screenshot` function returns the screenshot as a binary string, which can then be compared using a library like OpenCV or scikit-image.
The following table compares the DevProToolkit API with other popular screenshot APIs:
| API | Free Tier | JavaScript Rendering | Full Page | Mobile Emulation | Output Formats |
|---|---|---|---|---|---|
| DevProToolkit | 1000 requests/month | Yes | Yes | Yes | PNG, JPEG, GIF, PDF |
| ScreenshotAPI.net | 100 requests/month | Yes | No | No | PNG, JPEG |
| URLBox | 500 requests/month | Yes | Yes | Yes | PNG, JPEG, GIF |
| Screendot | 200 requests/month | Yes | No | No | PNG, JPEG |
Each API has its own strengths and weaknesses, and the choice of which one to use will depend on your specific needs and requirements.
We offer three pricing plans:
A: You can use the delay parameter to specify a delay in milliseconds before capturing the screenshot. This will allow the JavaScript to render before the screenshot is taken.
A: You can authenticate your API requests by including your API key in the X-API-Key header.
A: The timeout for API requests is 30 seconds. If the request takes longer than 30 seconds to complete, it will be cancelled and an error will be returned.
A: Yes, you can specify the resolution of the screenshot using the width and height parameters.
A: The rate limits for the API are as follows: 100 requests per day for the free plan, 10,000 requests per day for the pro plan, and unlimited requests for the enterprise plan.
Get your free API key and start making requests in minutes.
curl "http://147.224.212.116/api/..." \
-H "X-API-Key: YOUR_API_KEY"
Get a free API key with 100 requests/day. No credit card required.
Get Free API Key