How to schedule recurring AI Analysis web page screenshots with the Screenshot API

Learn how to use the Screenshot API to take screenshots of web pages and have AI analyze the images on a recurring schedule.

Introduction

With PagePixels' Screenshot API, you can create scheduled screenshots of web pages and run an AI-powered analysis on the content in the images.

To accomplish this, you can use the Screenshot API's analyze_image_with_ai and ai_prompt parameters. These API Options send your screenshot images to OpenAI (creators of ChatGPT) for visual analysis guided by your custom text prompt.

AI Analysis functionality is ready to go in PagePixels. No OpenAI keys are required, and all PagePixels accounts get 25 FREE AI Analysis credits per month.

This tutorial provides an example of how to create an hourly scheduled screenshot configuration that includes AI analysis, and after the screenshot is taken, retrieves the AI analysis response.

Prerequisites

Before you start, you'll need:

  • A PagePixels account.
  • The cURL command line utility installed on your computer.
  • A link to the web page you'd like to screenshot and analyze.

How to create scheduled AI Analysis screenshots using the Screenshot API

To schedule hourly screenshots of a web page and AI analyze the images using the Create Endpoint of the Screenshot API:

1

Get your API Key

You can access your API Key in two locations:

  • While signed in, go to the Authentication section of the API documentation. Copy the Private API Key value.
  • Or click on "Profile" in the right sidebar, navigate to "API Keys", and copy the Private API Key value.
2

Create a scheduled AI Analysis screenshot

POST
/screenshot_configs
$ curl -X POST "https://api.pagepixels.com/screenshot_configs" \ -d scheduled_screenshot=true \ -d scheduled_every=1 \ -d scheduled_interval="hours" \ --data-urlencode url="https://forecast.weather.gov/MapClick.php?lat=19.0605&lon=-155.5871" \ -d analyze_image_with_ai=true \ --data-urlencode "ai_prompt=What is the detailed weather forecast for tomorrow?" \ -d access_token="your-api-key"

Make a POST request to the Scheduled Screenshot Create Endpoint to create a scheduled screenshot configuration.

Copy the example above and replace the value of the access_token with your API Key.

Update the url and ai_prompt values to match the web page you want to screenshot and the AI prompt you want to use.

Once updated, paste the request into your terminal and press enter.

Note: cURL must be already installed for this to work.

3

Get Screenshot Configuration ID

json response
{
  "success":true,
  "screenshot_configuration_id":"4034a8f6-2640-419e-a1ce-7296a6398d49",
  "embed_url":"https://api.pagepixels.com/app/screenshots/4034a8f6-2640-419e-a1ce-7296a6398d49/embed",
  "job_id": "job_id"
}

If the previous step was successful, you'll receive the screenshot configuration id value in the response. Have this value ready as you'll need it in the next step.

3

Get the AI Analysis response

GET
/screenshot_configs/:screenshot_configuration_id/screenshots
$ curl -X GET "https://api.pagepixels.com/screenshot_configs/4034a8f6-2640-419e-a1ce-7296a6398d49/screenshots?access_token=your-api-key"

Use the screenshot_configuration_id to retrieve the AI's Analysis response from the Screenshot API's Scheduled Screenshot (screenshot_configs) Get Endpoint.

If successful, the response will include the AI's analysis response for the screenshot image.

For example:

json response
{
  "success":true,
  "screenshots":
  [
    {
        "id": "21ece268-e747-4b44-b03b-33ab9c0d9f45",
        "embed_url": "https://pagepixels.com/app/screenshots/4034a8f6-2640-419e-a1ce-7296a6398d49/embed",
        "screenshot_configuration_id": "4034a8f6-2640-419e-a1ce-7296a6398d49",
        "direct_link": "https://cdn.pagepixels.com/4034a8f6-2640-419e-a1ce-7296a6398d49/adfda6ee637a0b-1734846444662.jpg",
        "direct_thumbnail_link": "https://cdn.pagepixels.com/4034a8f6-2640-419e-a1ce-7296a6398d49/thumb_adfda6ee637a0b-1734846444662.jpg",
        "taken_at_timestamp": "1734846455308",
        "taken_at": "2024-12-22T05:47:35+00:00",
        "ai":
        {
            "ai_analyzed": true,
            "ai_prompt": "What is the detailed weather forecast for tomorrow?",
            "ai_response": "The detailed weather forecast for tomorrow in Naalehu, HI is as follows:\n\n- **Day:** Sunny, with a high near 76°F. North northeast wind 7 to 10 mph, becoming east in the afternoon.\n- **Night:** Mostly clear, with a low around 67°F. Breezy, with an east northeast wind 7 to 12 mph, increasing to 15 to 20 mph after midnight. Winds could gust as high as 26 mph."
        },
        "job_id": "634d88139e099a1cf62e7f0e"
    }
  ]
}

Your AI Analysis screenshot automation will continue to run in your PagePixels account according to the schedule you set.

See our Screenshot API documentation for more comprehensive information.

What else can PagePixels do?

When you use PagePixels' Screenshot API for your screenshot automation needs, you can also:

  • Use the Snap endpoint to take an instant one-time screenshot.
  • Click buttons, fill out forms, perform a search, and more - all before taking a screenshot - with Multi-Step Screenshots functionality.
  • Have AI compare and contrast multiple images with the Multiple Image AI Analysis endpoint.
  • Convert data from third-party APIs, HTML emails, and other HTML content into screenshots using the Custom HTML Screenshots endpoint.
  • Capture screenshots from thousands of locations around the world with the Screenshot API's Real Location Screenshots feature.
  • Dynamically display and share the latest screenshots on your website or app with a single Embed URL. Embed URLs are available for every create screenshot endpoint.
  • Use the Screenshot API's Extract HTML option to fetch the raw HTML from a web page (instead of taking a screenshot).
  • Leverage no-code integration platforms Zapier and Make (Integromat) to automatically capture, AI analyze, and send screenshots to thousands of services and apps, such as Google Sheets, Google Drive, and OneDrive.

Explore even more possibilities of what you can do on our Features page →

Support

Questions? Contact us anytime by email:

support-tickets@pagepixels.com

Or send us a message through our Support page.