Quick Snaps
/snap
Create an instant screenshot using the snap endpoint with only two required arguments:
| Option | Expected Value |
|---|---|
| url | The URL for the web page you want to capture. |
| access_token | Your account's Private API Key. |
This example uses the Mars Rover Perseverance's Wikipedia page as the value for the url:
/snap
http
https://api.pagepixels.com/snap?url=https://en.wikipedia.org/wiki/Perseverance_(rover)&access_token=your-api-key
Returns the requested screenshot image as the result if successful.
JSON Parameter
By default, the snap endpoint returns the screenshot image as a raw binary. To get a link to the screenshot image instead of the raw version, you can use the json parameter.
| Key | Description |
|---|---|
| json | Pass json=true to receive links to the image and thumbnail, instead of the raw image. |
More Options
All screenshots are highly configurable using the Screenshot API Options as parameters in your URL or POST body.
AI Analysis
Want the AI to look at the page too? Add analyze_image_with_ai=true and an ai_prompt and the answer comes back with the screenshot. You can also ask for the answer as structured JSON, or run the analysis on your own Claude, OpenAI or OpenRouter account. See AI Analysis Screenshots for the details and examples.
TTL Parameter
Captured screenshots are automatically saved to Your Account. If the same URL is used again within 24 hours, the saved version is delivered via our CDN network for fast delivery.
The 24 hour time period can be increased or decreased by specifying the period in seconds using the ttl parameter.
For instance, the example below will capture the screenshot and then only deliver the saved version for the next 10 minutes on subsequent requests. If the URL is requested again after 10 minutes, a new screenshot will be captured and delivered.
/snap
http
https://api.pagepixels.com/snap?ttl=600&url=https://en.wikipedia.org/wiki/Perseverance_(rover)&access_token=your-api-key
Public Web Pages
If you use the snap endpoint on a public web page, as opposed to a backend process, you probably do not want to use your private API Key. If you do, anyone could use it without your permission.
PagePixels provides the API Secret Token and API Publishable Key to solve this problem.
-
API Secret Token
Use the API Secret Token to create a HMAC SHA1 hash of the URL location you would like to screenshot and use the result as the
Click Here to get your Free API Secret Token →hash_keyparameter. -
API Publishable Key
Use the API Publishable Key as your
Click Here to get your Free API Publishable Key →access_tokenparameter.
Here is a quick example of how this can work in Ruby
require 'openssl'
# SPECIFY THE IMAGE LOCATION
url_to_image = "https://en.wikipedia.org/wiki/Perseverance_(rover)"
# SET YOUR API SECRET TOKEN AND API PUBLISHABLE KEY
api_secret_token = "your-api-secret-token"
api_publishable_key = "your-api-publishable-key"
# GENERATE YOUR HMAC SHA1 HASH WITH YOUR SECRET TOKEN AND IMAGE URL
api_hash_key = OpenSSL::HMAC.hexdigest('sha1', api_secret_token, url_to_image)
=> "2dbe2a4799de317572d81a5a9aceffcd9255067d"
# CREATE YOUR API URL WITH YOUR IMAGE URL, HASH KEY, AND API PUBLISHABLE KEY
request_location = "https://api.pagepixels.com/snap?url=#{url_to_image}&hash_key=#{api_hash_key}&access_token=#{api_publishable_key}"
=> "https://api.pagepixels.com/snap?url=https://en.wikipedia.org/wiki/Perseverance_(rover)&hash_key=2dbe2a4799de317572d81a5a9aceffcd9255067d&access_token=your-api-publishable-key"
Support
Questions? Contact us anytime by email:
support-tickets@pagepixels.com
Or send us a message through our Support page.