Appearance
Getting Started with PageWitness
Welcome to PageWitness! This guide will help you get up and running with our Screenshot API so you can start capturing screenshots in a matter of minutes.
Overview
PageWitness is a powerful screenshot service that lets you capture:
- Full-page and viewport-sized screenshots
- Mobile and desktop emulations
- Screenshots of private, logged-in pages (with authentication tokens)
- Various file formats (JPEG, PNG, PDF)
- ...and more!
By using our RESTful API, you can easily integrate PageWitness into your existing infrastructure, CI/CD pipelines, or any custom application.
Prerequisites
- A PageWitness account. If you don’t have one, sign up to get started.
- A unique API key associated with your account.
- Familiarity with making HTTP requests (using tools such as
curl
,fetch
, or any HTTP client library).
Getting Your API Key
To use the PageWitness Screenshot API, you’ll need an API key:
- Sign in to your PageWitness account.
- Go to the API Keys section of the dashboard.
- Create or copy an existing key to use in your API requests.
Keep your API key private; it should be treated like a password.
Basic Usage
Once you have your API key, you can start making requests. Below is an example using curl
. The request will capture a screenshot of the specified URL and return the image.
Example Request
bash
curl "https://api.pagewitness.com/v1/screenshot?url=https://example.com" \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-o example.png
Result:
PageWitness - Additional Features & Troubleshooting
Parameters
Parameter | Description | Required | Default |
---|---|---|---|
url | The URL of the webpage to capture. | Yes | — |
width | The width of the browser’s viewport (in pixels). | No | 1280 |
height | The height of the browser’s viewport (in pixels). | No | 800 |
format | The output file format. Accepts png , jpeg , or pdf . | No | png |
delay | The delay (in milliseconds) before capturing the screenshot. | No | 0 |
device | Specify a device preset (e.g., iPhone 12 ), overriding width, height, and UA. | No | desktop |
Tip: You can pass these parameters via query string or, depending on your client, as a JSON body. Refer to our API Reference for all available parameters and usage details.
Advanced Features
Full-Page Screenshots
To capture the full length of a webpage, you can add the full_page=true
parameter (when using the REST API) or set fullPage: true
(when using the SDK):
bash
curl "https://api.pagewitness.com/v1/screenshot?url=https://example.com&full_page=true" \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-o fullpage.png