Documentation > api > POST Create a screenshot

POST Create a screenshot

Parameters

url

Required.

Type: String.

Width

Type: Int.

Default 1920.

Min: 100.

Max: 5000.

Width of your screenshot in pixels.

Height

Type: Int.

Default 1080.

Min: 100.

Max: 5000.

Height of your screenshot in pixels.

Device

Type: string.

Default: none.

Options desktop, laptop, tablet, phone

Wrap the screenshot in a rendering of a device.

Options

Default: none.

fullPage

Type: boolean. Override width and height to take a screenshot of the entire page.

Default: false. Options: true, false

 

Javascript example

const data = {
	url: url,
	device: device,
	width: width,
	height: height,
};

fetch(
	'https://screenshot.express/api/v1/screenshots',
	{
		method: 'POST',
		headers: {
			'Content-Type': 'application/json',
			'x-api-key': 'your api key',
			"accept": "application/json",
		},
		body: JSON.stringify(data),
	})
	.then((response) => response.json())
	.then((data) => {
		console.log('Success:', data);
		// Do something
	})
	.catch((error) => {
		console.error('Error:', error);
	}
);

Example response

{
    "code": 200,
    "id": 536,
    "src": "https://s3.screenshot.express/files/2022-12-15-11-27-54-https-screenshot-express.png",
    "url": "https://screenshot.express",
    "width": 1920,
    "height": 1080,
    "datetime": "2022-12-15 11:27:54",
    "preview": "https://screenshot.express/screenshot/3212a3ab-4ea4-444a-94a8-*****,
    "endpoint": "https://screenshot.express/api/v1/screenshots/123"
}