How do I get a screenshot of a SERP page?
in
Using the SERP API Page Screenshot endpoint, you can capture a screenshot of any SERP page.
1 Call the endpoint.
POST https://api.dataforseo.com/v3/serp/screenshot
2 Specify the ID of the task for which you would like to receive a screenshot in the task_id
field.
That should be enough to send a basic POST request. Structure it as in the following example:
[
{
"task_id": "07181408-2806-0139-0000-6c377ba904f5"
}
]
You can also use additional POST parameters to receive more specific results:
browser_preset
— browser preset associated with a certain device type. Can take the following values:desktop
,mobile
,tablet
. By default, the API uses the device type specified in the initial POST request.browser_screen_width
,browser_screen_height
— in these fields, you can indicate a specific browser screen width and height.browser_screen_scale_factor
— browser scale factor. Can take the range from 0.5 to 3.
In the API response, you will receive the URL to a high-quality page screenshot on the DataForSEO storage.
{
"version": "0.1.20220627",
"status_code": 20000,
"status_message": "Ok.",
"time": "2.9924 sec.",
"cost": 0.004,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "07181411-2806-0454-0000-02a53fd86515",
"status_code": 20000,
"status_message": "Ok.",
"time": "2.9350 sec.",
"cost": 0.004,
"result_count": 1,
"path": [
"v3",
"serp",
"screenshot"
],
"data": {
"api": "serp",
"function": "screenshot",
"task_id": "07181408-2806-0139-0000-6c377ba904f5"
},
"result": [
{
"items_count": 1,
"items": [
{
"image": "https://api.dataforseo.com/cdn/s/beb24f74-aabc-4f00-9bc3-9445ca70bc3a"
}
]
}
]
}
]
}