ScreenshotNeo

BlogHow-to

How to Capture a Mobile-Sized Website Screenshot with Microlink

Capture a mobile-emulated website screenshot with Microlink using a device preset or custom viewport, then retrieve the image in your app.

By the ScreenshotNeo team4 October 20268 min read

To capture a mobile-sized website screenshot with Microlink, send the page URL, enable screenshot, and choose either a named mobile device preset or custom viewport.width and viewport.height. Microlink renders the page in a mobile-emulated browser and returns a screenshot asset. This emulation does not guarantee an exact match for every physical phone.

1. Choose a device preset or a custom viewport

Use a device preset when you want a convenient named profile, such as iPhone 15 Pro. Set a custom viewport when you need to check a particular layout width or control the dimensions yourself. The dimensions below are an illustrative choice, not a standard Microlink device profile.

Goal Setting
Emulate a named mobile profile device=iPhone 15 Pro
Control the browser viewport viewport.width and viewport.height
Set output pixel density viewport.deviceScaleFactor
Capture the scrollable document screenshot.fullPage=true
Return the image body directly embed=screenshot.url

Microlink’s screenshot parameter reference documents screenshot options, including full-page capture. Its screenshot guide describes enabling screenshots with the target url and screenshot parameters.

2. Make a basic mobile screenshot request

For a named profile, pass the target URL, enable screenshots, and set the device. The API’s screenshot asset is available at data.screenshot.url in the standard response.

curl -G 'https://api.microlink.io' \
  --data-urlencode 'url=https://example.com' \
  --data-urlencode 'screenshot=true' \
  --data-urlencode 'device=iPhone 15 Pro'

For a custom viewport, replace the device parameter with dimensions and, optionally, a device scale factor:

curl -G 'https://api.microlink.io' \
  --data-urlencode 'url=https://example.com' \
  --data-urlencode 'screenshot=true' \
  --data-urlencode 'viewport.width=390' \
  --data-urlencode 'viewport.height=844' \
  --data-urlencode 'viewport.deviceScaleFactor=1'

These requests return the standard API response. If you need an image body suitable for an <img> or for saving directly, add embed=screenshot.url:

curl -G 'https://api.microlink.io' \
  --data-urlencode 'url=https://example.com' \
  --data-urlencode 'screenshot=true' \
  --data-urlencode 'device=iPhone 15 Pro' \
  --data-urlencode 'embed=screenshot.url' \
  -o mobile-screenshot

Use the standard response when your application needs the screenshot URL and metadata, such as dimensions, content type, or byte size. Use the embedded image response when you only need the image. See Microlink’s guide to taking screenshots for its image embedding example.

Microlink’s guide uses its JavaScript SDK and screenshot method. Install microlink in your project, then request the page and screenshot output:

import { microlink } from 'microlink'

const { data } = await microlink('https://example.com', {
  screenshot: true,
  device: 'iPhone 15 Pro'
})

console.log(data.screenshot.url)

For an exact custom viewport, pass the documented viewport fields instead:

import { microlink } from 'microlink'

const { data } = await microlink('https://example.com', {
  screenshot: true,
  viewport: {
    width: 390,
    height: 844,
    deviceScaleFactor: 1
  }
})

console.log(data.screenshot.url)

Python with the HTTP API

Python can call the HTTP endpoint directly. This example requests JSON, reads the screenshot asset URL, and downloads the image. Install the dependency first with python -m pip install requests.

import requests

params = {
    "url": "https://example.com",
    "screenshot": "true",
    "device": "iPhone 15 Pro",
}
response = requests.get("https://api.microlink.io", params=params, timeout=90)
response.raise_for_status()
body = response.json()

screenshot_url = body["data"]["screenshot"]["url"]
image = requests.get(screenshot_url, timeout=90)
image.raise_for_status()

with open("mobile-screenshot.png", "wb") as file:
    file.write(image.content)

print(screenshot_url)

To use a custom viewport, use Microlink’s dotted query parameter names:

params = {
    "url": "https://example.com",
    "screenshot": "true",
    "viewport.width": 390,
    "viewport.height": 844,
    "viewport.deviceScaleFactor": 1,
}

Node.js with fetch

This Node.js example uses the built-in fetch available in current Node.js releases. It requests the JSON response and saves the returned asset.

const params = new URLSearchParams({
  url: 'https://example.com',
  screenshot: 'true',
  device: 'iPhone 15 Pro'
})

const response = await fetch(`https://api.microlink.io?${params}`)
if (!response.ok) throw new Error(`Microlink request failed: ${response.status}`)
const body = await response.json()

const imageResponse = await fetch(body.data.screenshot.url)
if (!imageResponse.ok) throw new Error(`Image download failed: ${imageResponse.status}`)
const image = Buffer.from(await imageResponse.arrayBuffer())
await import('node:fs/promises').then(({ writeFile }) => writeFile('mobile-screenshot.png', image))

console.log(body.data.screenshot.url)

For a custom viewport, set the dotted fields in URLSearchParams: viewport.width, viewport.height, and optionally viewport.deviceScaleFactor.

4. Choose the screenshot extent and response shape

Viewport screenshot or full page

Mobile viewport settings and page extent are separate choices. A normal screenshot captures the current visible area. Set screenshot.fullPage=true when the image should include the scrollable document. The screenshot reference lists false as the default for fullPage.

curl -G 'https://api.microlink.io' \
  --data-urlencode 'url=https://example.com' \
  --data-urlencode 'screenshot.fullPage=true' \
  --data-urlencode 'device=iPhone 15 Pro'

Standard JSON or image response

The standard response includes data.screenshot.url and screenshot metadata. Use embed=screenshot.url if you want the image returned as the response body. For screenshot-only work, Microlink’s guide recommends meta=false to skip metadata extraction; it describes this as usually the largest speedup.

curl -G 'https://api.microlink.io' \
  --data-urlencode 'url=https://example.com' \
  --data-urlencode 'screenshot=true' \
  --data-urlencode 'device=iPhone 15 Pro' \
  --data-urlencode 'meta=false' \
  --data-urlencode 'embed=screenshot.url' \
  -o mobile-screenshot

Scale factor and image dimensions

viewport.deviceScaleFactor affects the screenshot’s output pixel density and therefore can affect image dimensions and file size. Choose it deliberately: a higher-density output can be useful for sharper assets, while a lower one uses less storage and bandwidth. The API product page demonstrates this viewport parameter; check Microlink’s current reference for supported values and output-format options.

5. Verify the mobile rendering

  1. Use a real page URL, including its scheme such as https://.
  2. Choose a device preset or provide both viewport dimensions.
  3. Set screenshot=true, or use the screenshot object when configuring screenshot-specific options.
  4. Choose viewport-only or full-page capture independently.
  5. Inspect the returned image at the intended display size, especially for responsive menus, text wrapping, sticky elements, and lazy-loaded content.

A device preset or viewport configures browser emulation; it does not establish that a page will look exactly like it does on every physical phone. Check the actual output for the target site and use a real-device test when physical hardware behavior matters.

6. Troubleshoot common problems

Symptom Likely cause What to do
No screenshot appears in the response The screenshot output was not enabled or the response was not parsed as expected. Pass screenshot=true and inspect the standard response for data.screenshot.url.
The result has desktop dimensions The device or viewport settings were omitted, misspelled, or not sent as query parameters. Set a documented device name or both viewport.width and viewport.height; inspect the actual encoded request URL.
The page is cut off below the first screen Default capture extent is the viewport, not the whole document. Set screenshot.fullPage=true.
The request returns JSON when an image was expected The request used the standard response mode. Add embed=screenshot.url to return the screenshot asset as the response body.
The image is much larger or softer than expected The output scale factor changes pixel density, or the displayed image is being resized. Set and verify viewport.deviceScaleFactor, then inspect the returned dimensions and byte size.
The screenshot differs from a physical phone Browser emulation is not proof of exact physical-device parity; sites can also vary content by state or delivery conditions. Inspect the emulated result and validate on physical hardware if exact device behavior is required.
The call is slow when only an image is needed The API may also be extracting page metadata. Try meta=false and use the embedded screenshot response if you do not need JSON metadata.
The image download fails after a successful API call The asset URL request failed, or the client treated a non-success HTTP status as an image. Check the asset request status and download the URL from data.screenshot.url; keep the API JSON and asset download as separate error-handled steps.

7. Performance, reliability, and cost

When you only need a screenshot, disabling metadata extraction with meta=false can reduce unnecessary work; Microlink’s guide identifies it as usually the largest speedup for screenshot-only requests. Full-page captures and larger pixel dimensions produce more image data to transfer and store. Keep the viewport and scale factor aligned with the image’s actual use.

Handle the API call and screenshot asset download as separate network operations: the standard response provides an asset URL, which your code then fetches. Check HTTP status codes for both requests and set a timeout appropriate to your application. If you use only the final image, embedded delivery removes the separate URL parsing and download step.

Microlink’s guide describes direct API calls without an API key and states a free testing allowance of 25 requests per day, while advising a plan for production use. Quotas and plans can change, so confirm current terms in the official guide before budgeting production usage.

8. Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. One GET request captures a URL as PNG, JPEG, WebP, or PDF. For a mobile-sized capture, pass viewport settings supported by its API; the example below shows the basic one-call request and saves the returned image.

See the ScreenshotNeo API documentation for request options, including viewport configuration.

curl -G "https://api.screenshotneo.com/v1/shot" \
  -d access_key=YOUR_API_KEY \
  --data-urlencode url=https://example.com \
  -o shot.webp
import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
    timeout=90,
)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://example.com'
})
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`)

ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card.

9. Frequently asked questions

Can I capture a mobile screenshot without a physical phone?

Yes. Microlink’s device preset and viewport options configure browser emulation, so the request runs through the API rather than on a connected phone.

Should I use a device preset or custom dimensions?

Use a preset for convenient named emulation. Use custom width and height when you are checking a particular responsive breakpoint or need controlled dimensions.

Does mobile viewport mean full-page capture?

No. Viewport dimensions set the emulated browser size. Set screenshot.fullPage=true separately to capture the scrollable document.

Can I use the returned screenshot URL in my app?

Yes. The standard response exposes the asset URL at data.screenshot.url. Use embed=screenshot.url when you need the image in the response body instead.