Can I get a screenshot of a page? – DataForSEO

Can I get a screenshot of a page?

Yes, you can.

Using the new Page Screenshot endpoint of On-Page API, you can make a high-quality screenshot of any page.

  1. Call the endpoint.

    https://api.dataforseo.com/v3/on_page/page_screenshot

  2. Specify the URL of a page you wish to make a screenshot of in the url field. Note: you should indicate an absolute URL with http://, https://, or www..

    Example:

    "url": "https://docs.dataforseo.com/v3/on_page/page_screenshot/"

  3. Specify the language header for accessing the website in the accept_language field. Note: if you do not specify this parameter, some websites may deny access. In this case, you will obtain "error_message":"Screenshot is empty" in the response array

    Example: "accept_language": "en-US"

Your POST request should be structured as in the following example:

[\
{\
    "url": "https://docs.dataforseo.com/v3/on_page/page_screenshot/"\
}\
]

In the API response, you will receive the URL of the page screenshot on the DataForSEO storage.

{
    "version": "0.1.20220428",
    "status_code": 20000,
    "status_message": "Ok.",
    "time": "3.3395 sec.",
    "cost": 0.004,
    "tasks_count": 1,
    "tasks_error": 0,
    "tasks": [\
        {\
            "id": "05181113-2806-0444-0000-0e13e6bc4076",\
            "status_code": 20000,\
            "status_message": "Ok.",\
            "time": "3.2689 sec.",\
            "cost": 0.004,\
            "result_count": 1,\
            "path": [\
                "v3",\
                "on_page",\
                "page_screenshot"\
            ],\
            "data": {\
                "api": "on_page",\
                "function": "page_screenshot",\
                "url": "https://docs.dataforseo.com/v3/on_page/page_screenshot/"\
            },\
            "result": [\
                {\
                    "crawl_progress": "finished",\
                    "error_message": null,\
                    "items_count": 1,\
                    "items": [\
                        {\
                            "image": "https://api.dataforseo.com/cdn/screenshot/05181113-2806-0444-0000-0e13e6bc4076"\
                        }\
                    ]\
                }\
            ]\
        }\
    ]
}

Embed DataForSeo widget on your website

Width:

Height:

Embed code:

Copy Code

Preview: