Capture a website screenshot programmatically with API

Capture full-page screenshot for any website online in high resolution, mobile emulator with automatic cookie consent, popup blocker to generate clear-clean screenshot.

API

Convert a webpage into a screenshot by passing the URL. You can send HTTP request in Curl, Node.js, PHP, Python, C# etc to generate a full page screenshot via API.

  • Base URL: https://browser.agenty.com
  • API Key: Sign in to your account > go to settings > API Keys to get your api key
GET /api/screenshot
          curl --request GET
  --url https://browser.agenty.com/api/screenshot?apiKey={YOUR_API_KEY}&url=https://example.com
          
POST /api/screenshot
              curl --request POST
  --url https://browser.agenty.com/api/screenshot?apiKey={YOUR_API_KEY}
  --data '{
    "url": "https://example.com"
  }'
              
          

Options

List of options available to customize the screenshot background, login, block ads, wait for a few seconds to render completely or lazy load to customize the webpage screenshot.

Name Description Example
url URL of the web page to capture 'https://example.com'
html HTML content to load into the page instead URL to capture custom HTML screenshot '<!DOCTYPE html><html><head></head><body></body></html>'
userAgent User agent string for the browser for whitelisting 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
authenticate Authentication options for the web page to Login before capturing the screenshot { username: 'your_username', password: 'your_password' }
addScriptTag Additional script tags to add to the page to manipulate HTML [ { content: 'var element = document.querySelector('.ads'); if(element) element.remove();', type: 'script_type' } ]
addStyleTag Additional style tags to add to the page to add custom styles [ { content: 'body: { background: red; }' } ]
cookies Array of cookies to set for the page [ { domain: 'example.com', expires: 3600, httpOnly: true, name: 'cookie_name', path: '/', sameSite: 'Strict', secure: true, url: 'page_url', value: 'cookie_value' } ]
gotoOptions Options for navigating to the page { timeout: 30000, waitUntil: 'networkidle2', referer: 'referer_url' }
manipulate Image manipulation options { resize: { width: 800, height: 600, fit: 'cover', position: 'top' }, flip: true, flop: false, rotate: 90 }
options Screenshot capture options { clip: { height: 600, width: 800, x: 0, y: 0 }, fullPage: true, omitBackground: false, quality: 80, type: 'png' }
rejectRequestPattern Patterns for rejecting requests [ 'doubleclick.js', 'ads.js' ]
rejectResourceTypes Types of resources to reject [ 'csp_report', 'font' ]
requestInterceptors Interceptors for modifying network requests and responses [ { pattern: 'pattern', response: { body: 'response_body', contentType: 'text/plain', headers: { 'header_name': 'header_value' }, status: 200 } } ]
setExtraHTTPHeaders Extra HTTP headers to set for requests { 'header1': 'value1', 'header2': 'value2' }
setJavaScriptEnabled Enable or disable JavaScript for the page true or false
viewport Viewport configuration for the page { deviceScaleFactor: 2, hasTouch: false, height: 800, isLandscape: false, isMobile: false, width: 1280 }
waitFor Elements or events to wait for before taking a screenshot [ 'element_selector', 5000 ]
blockAds Block ads on the page true or false
anonymous Anonymous browsing options { proxy: false, skipResourceTypes: [ 'image', 'stylesheet', 'font' ] }

See all options →

Examples

Full page screenshot

Add the fullPage:true option to capture the full page screenshot and take the webpage screenshot entirely

        curl --request POST
--url https://browser.agenty.com/api/screenshot?apiKey={YOUR_API_KEY}
--data '{
"url": "https://example.com",
  "options": {
      "fullPage": true
  }
}'
        
    

Screenshot with proxy

Add the proxy proxy:true option to proxy the request from US, UK or other region for anonymity

        curl --request POST
--url https://browser.agenty.com/api/screenshot?apiKey={YOUR_API_KEY}
--data '{
"url": "https://example.com",
  "anonymous": {
      "proxy": true
  }
}'
        
    

Close popup before screenshot

Inject custom JavaScript to accept cookie consent, close popup, manipulate DOM before capturing the webpage screenshot

        curl --request POST
--url https://browser.agenty.com/api/screenshot?apiKey={YOUR_API_KEY}
--data '{
"url": "https://example.com",
  "anonymous": {
      "proxy": true
  }
}'
        
    

Mobile view screenshot

Add the device, or resolution option to capture screenshots on different devices.

        curl --request POST
--url https://browser.agenty.com/api/screenshot?apiKey={YOUR_API_KEY}
--data '{
  "url": "https://example.com",
  "device": "mobile"
}'
        
    

Signup now to get 100 pages credit free

14 days free trial, no credit card required!

Agenty® is the registered trademark of Agenty Analytics Private Limited in India and/or other countries.