Take a mobile website screenshot at any device viewport
A mobile website screenshot has to show what a phone actually renders: the mobile layout, the mobile user agent and the phone’s pixel density. The Screenshot API emulates the device before it captures, so responsive website screenshots for QA runs, client reports, app store assets and social previews all come from one request. You can try a capture in the browser first with the mobile screenshot tool.
Desktop screenshots hide what mobile visitors actually see
A page can look perfect at 1440px and break at 390px: overlapping menus, clipped tables, buttons too small to tap. If your captures only cover desktop, the bugs your visitors hit on their phones never show up in a QA run, a monitoring job or a client report.
Shrinking the browser window does not fix it. Many sites also branch on the user agent, the device pixel ratio and the meta viewport tag, so a narrow desktop window still gets the desktop markup, just squeezed. Running your own headless browser with device descriptors works until the descriptors go stale and the fleet needs patching.
The device parameter loads a complete profile, including the viewport and the user agent, for a named phone, tablet or desktop. When you need exact numbers, viewport overrides individual fields and merges them over the device defaults. Both settings apply to the whole request, so the site serves its mobile variant before the capture happens.
How to take a mobile screenshot of a website
Start with a device preset, because it sets everything a site can sniff. Drop down to a custom screenshot viewport only when you need a size that no real device has. The browser settings guide covers every rendering option in depth.
import createClient from 'microlink.io'
const microlink = createClient({
apiKey: process.env.MICROLINK_API_KEY
})
const { url, width, height } = await microlink.screenshot(
'https://example.com',
{ device: 'iPhone 15 Pro' }
)The browser renders the page with that device’s viewport and user agent, then returns the hosted image URL with its real width and height. Device names are case-insensitive.
import createClient from 'microlink.io'
const microlink = createClient({
apiKey: process.env.MICROLINK_API_KEY
})
const { url } = await microlink.screenshot('https://example.com', {
viewport: {
width: 390,
height: 844,
deviceScaleFactor: 3,
isMobile: true,
hasTouch: true
}
})isMobile makes the browser respect the meta viewport tag and hasTouch enables touch events. Any field you leave out keeps the value of the default device.
import createClient from 'microlink.io'
const microlink = createClient({
apiKey: process.env.MICROLINK_API_KEY
})
const devices = ['iPhone 15 Pro', 'Pixel 5', 'iPad Pro']
const captures = await Promise.all(
devices.map(device =>
microlink.screenshot('https://example.com', { device })
)
)Each device is its own request and its own cache entry. There is no throttling, so the three captures run in parallel within your quota.
curl 'https://api.microlink.io/?url=https%3A%2F%2Fexample.com&screenshot=true&meta=false&device=iPhone+15+Pro'Every option is a query parameter, so the request works from any language. Add embed and the URL returns the image itself, ready for an img tag.
- device Named preset such as iPhone 15 Pro, Pixel 5, iPad Pro or Macbook Pro 16. Defaults to Macbook Pro 13.
- viewport width, height, deviceScaleFactor, isMobile, hasTouch and isLandscape, merged over the device defaults.
- screenshot.fullPage Captures the whole scrollable page instead of the first screen. Off by default.
- meta Set it to false to skip metadata detection when you only need the image.
Tablets ship with landscape presets such as iPad Pro landscape, and isLandscape puts a custom viewport in landscape mode. When no device is set, the request renders with the default Macbook Pro 13 profile.
Why device emulation beats resizing the window
Three details separate a narrow desktop capture from a device emulation screenshot that matches a real phone.
Pair it with a wait for JavaScript-rendered content when the mobile layout hydrates after load.
The faster, smaller screenshots recipe lists the other settings that cut response time and bytes.
When not to: if you need the page laid out for paper rather than for a screen, the PDF API with a paper format is the better fit.
FAQ
Which devices can I emulate for a mobile screenshot?
How do I take a website screenshot at a custom viewport size?
Why does my mobile screenshot still show the desktop layout?
Does a mobile screenshot capture the full page?
Do mobile screenshots use more requests than desktop ones?
Solve the next problem with the same API
Screenshot a single element
Screenshots in dark mode
Faster, smaller screenshots
Screenshots with a browser frame
Screenshots of JavaScript-rendered pages
Paper size, margins and orientation
Ready to capture mobile screenshots?
One request per device, no browsers to run. Start on the free endpoint with 25 requests per day and add an API key when you move to production.