Skip to main content

Urlbox Plugin

The Urlbox plugin captures website screenshots using the Urlbox API. It generates preview images for work items during the generation pipeline, with support for retina rendering, image quality control, and automatic cookie banner removal.

Source: packages/plugins/urlbox/src/urlbox.plugin.ts

Overview

PropertyValue
Plugin IDurlbox
Categoryscreenshot
Capabilitiesscreenshot
Version1.0.0
Configuration Modehybrid
Auto-enableNo
Built-inNo
System PluginNo
Dependenciesurlbox

The plugin implements IPlugin and IScreenshotPlugin. It uses the official urlbox npm package to generate render links and download the resulting images.

Architecture

Urlbox uses a two-step approach:

  1. Generate render link -- the SDK builds a URL that encodes all capture options (viewport, format, quality, etc.) and signs it with the API secret
  2. Fetch the image -- the plugin makes a standard fetch() request to the render link, which triggers Urlbox to capture the screenshot and return the image

Configuration

Settings Schema

SettingTypeRequiredDefaultScopeDescription
apiKeystringYes--userUrlbox API key (secret)
apiSecretstringNo--userAPI secret for signed render links (secret)
viewportWidthnumberNo1280--Viewport width in pixels (320--3840)
viewportHeightnumberNo1024--Viewport height in pixels (200--2160)
formatstringNo"png"--Image format: png, jpg, jpeg, or webp
fullPagebooleanNofalse--Capture the full scrollable page
qualitynumberNo80--Image quality for lossy formats (1--100)
retinabooleanNofalse--Enable retina/HiDPI rendering (2x scale)
blockAdsbooleanNotrue--Block ads during capture
hideCookieBannersbooleanNotrue--Hide cookie consent banners

Environment Variables

VariableDescription
PLUGIN_URLBOX_API_KEYAPI key fallback
PLUGIN_URLBOX_API_SECRETAPI secret fallback
PLUGIN_URLBOX_VIEWPORT_WIDTHViewport width fallback
PLUGIN_URLBOX_VIEWPORT_HEIGHTViewport height fallback
PLUGIN_URLBOX_FORMATImage format fallback

Settings Resolution

API keys are resolved through the standard 4-level hierarchy:

  1. Work settings (highest priority)
  2. User settings
  3. Admin settings
  4. Environment variables (lowest priority)

Features

Screenshot Capture

async capture(options: ScreenshotOptions): Promise<ScreenshotResult>

Generates a render link, fetches the screenshot, and returns the image as a Buffer, base64 string, and URL. Per-call options override plugin-level defaults.

URL Generation

async getScreenshotUrl(options: ScreenshotOptions): Promise<string | null>

Generates a render link URL without downloading the image. Useful for embedding screenshot URLs directly in content.

Credential Validation

async validateCredentials(): Promise<ScreenshotValidationResult>

Verifies API credentials by generating a test render link and checking that it points to api.urlbox.com.

Image Quality Control

The quality setting (1--100) controls compression for lossy formats like JPG and WebP. Higher values produce better quality at larger file sizes. This setting has no effect on PNG format.

Retina Rendering

When retina is enabled, Urlbox renders the page at 2x device pixel ratio. This produces sharper images on HiDPI displays but doubles the image dimensions and increases file size.

Cookie consent banners are hidden by default (hideCookieBanners: true). This is mapped to the hide_cookie_banners option in the Urlbox SDK's RenderOptions.

Render Delay and Selector Waiting

  • delay -- wait a specified number of milliseconds before capturing
  • waitForSelector -- mapped to the selector render option, waits until a specific element appears

Supported Formats

  • png -- lossless, best for UI screenshots
  • jpg / jpeg -- lossy, smaller file size
  • webp -- modern format with excellent compression

Maximum Dimensions

The maximum viewport dimensions are 3840 x 2160 pixels (4K UHD).

Render Options Mapping

The plugin maps ScreenshotOptions to Urlbox RenderOptions:

Plugin OptionUrlbox RenderOptionNotes
viewportWidthwidthViewport width
viewportHeightheightViewport height
formatformatCast to RenderOptions['format']
fullPagefull_pageFull page capture
blockAdsblock_adsAd blocking
blockCookieBannershide_cookie_bannersCookie banner removal
delaydelayMilliseconds before capture
waitForSelectorselectorCSS selector to wait for
userAgentuser_agentCustom user agent string

Usage in Pipelines

During work generation, the screenshot facade sends capture requests to Urlbox for items that have a source URL. The resulting images are stored as item preview thumbnails.

Comparison with ScreenshotOne

FeatureUrlboxScreenshotOne
SDKurlboxscreenshotone-api-sdk
Default viewport1280 x 10241280 x 800
Quality controlYes (1--100 slider)No
Retina renderingBoolean toggle (2x)Device scale factor (0.5--3)
Cookie banner blockingDefault enabledPer-request
Tracker blockingNoYes
Ad blockingYesYes
Server-side cachingNoYes (with TTL)
Supported formatsPNG, JPG, JPEG, WebPPNG, JPG, JPEG, WebP
Max dimensions3840 x 21603840 x 2160

Urlbox provides a quality slider and simple retina toggle. ScreenshotOne offers more granular device scale factor control, tracker blocking, and built-in server-side caching.

API Reference

Class: UrlboxPlugin

class UrlboxPlugin implements IPlugin, IScreenshotPlugin {
readonly id: 'urlbox';
readonly category: 'screenshot';

capture(options: ScreenshotOptions): Promise<ScreenshotResult>;
getScreenshotUrl(options: ScreenshotOptions): Promise<string | null>;
validateCredentials(): Promise<ScreenshotValidationResult>;
getSupportedFormats(): readonly ScreenshotFormat[];
getMaxDimensions(): { width: number; height: number };
}

ScreenshotResult Fields

FieldDescription
successWhether capture succeeded
imageBufferRaw image data as a Buffer
imageBase64Base64-encoded image string
imageUrlThe render link URL
widthViewport width used
heightViewport height used
fileSizeImage file size in bytes
errorError message (on failure)

Getting Started

  1. Sign up at urlbox.com
  2. Copy your API key and API secret
  3. Enable the Urlbox plugin on the Plugins page
  4. Enter your credentials in the plugin settings
  5. Select Urlbox as the screenshot provider for your work

Troubleshooting

IssueCauseSolution
"API key not configured"Missing credentialsSet the API key in plugin settings or via environment variable
Blank or incomplete screenshotsPage loads dynamic contentUse the delay option or waitForSelector
Cookie banners in screenshotshideCookieBanners disabledSet hideCookieBanners to true (default)
Blurry imagesRetina mode disabledEnable retina for HiDPI output
Large file sizesHigh quality + retinaLower quality value or disable retina
Render failed with status 4xxInvalid API key or quota exceededVerify credentials and check Urlbox dashboard for usage