Skip to content

Device Emulation

Simulate different devices by adjusting viewport size and device scale.

Mobile Screenshots

Capture a page as it appears on mobile:

bash
# iPhone-sized viewport
curl "https://api.urlpix.com/v1/screenshot?url=https://example.com&width=390&height=844&deviceScale=3" \
  -H "X-API-Key: sk_live_YOUR_KEY" \
  -o mobile.png

Common Device Presets

DeviceWidthHeightDevice Scale
iPhone 143908443
iPhone 14 Pro Max4309323
iPad Air82011802
Galaxy S233607803
Desktop HD192010801
MacBook Pro14409002
4K Display384021601

Tablet Screenshot

bash
curl "https://api.urlpix.com/v1/screenshot?url=https://example.com&width=820&height=1180&deviceScale=2" \
  -H "X-API-Key: sk_live_YOUR_KEY" \
  -o tablet.png

Retina / High-DPI

The deviceScale parameter controls the device pixel ratio (DPR). Higher values produce sharper images at the cost of larger file sizes.

bash
# 2x Retina
curl "https://api.urlpix.com/v1/screenshot?url=https://example.com&deviceScale=2" \
  -H "X-API-Key: sk_live_YOUR_KEY" \
  -o retina.png
  • deviceScale=1 — Standard (default)
  • deviceScale=2 — Retina (2x pixels)
  • deviceScale=3 — Super Retina (3x pixels)

The output image dimensions will be width × deviceScale by height × deviceScale.

JavaScript Example

javascript
const devices = {
  iphone: { width: 390, height: 844, deviceScale: 3 },
  ipad: { width: 820, height: 1180, deviceScale: 2 },
  desktop: { width: 1920, height: 1080, deviceScale: 1 },
}

async function captureDevice(url, device, apiKey) {
  const params = new URLSearchParams({
    url,
    ...Object.fromEntries(
      Object.entries(devices[device]).map(([k, v]) => [k, String(v)])
    ),
    format: 'webp',
  })

  return fetch(`https://api.urlpix.com/v1/screenshot?${params}`, {
    headers: { 'X-API-Key': apiKey },
  })
}

URLPix — Screenshot & OG Image API