ScreenshotNeo

BlogHow-to

How to capture a mobile-width website screenshot with ScreenshotMachine

Capture a phone-width website screenshot with ScreenshotMachine using its API or online generator, and choose the right dimensions, page height, and delay.

By the ScreenshotNeo team4 October 20267 min read

To capture a mobile-width website screenshot with ScreenshotMachine, send a GET request to its API with your target URL, customer key, device=phone, and a dimension such as 480x800. The width sets the rendering width; the height sets the initial viewport height. Use 480xfull when you want the entire page at 480 pixels wide.

“Mobile-width” describes the viewport used to render the page. It does not by itself mean that the result matches a particular physical phone. Choose dimensions and device settings to fit the page or layout you need to inspect.

1. Capture a phone-width screenshot with the API

Get a ScreenshotMachine customer key, then make a GET request to https://api.screenshotmachine.com/. Keep the key private and replace the example URL with the page you want to capture.

curl -G 'https://api.screenshotmachine.com/' \
  --data-urlencode 'key=YOUR_KEY' \
  --data-urlencode 'url=https://example.com' \
  --data-urlencode 'device=phone' \
  --data-urlencode 'dimension=480x800' \
  --data-urlencode 'format=png' \
  -o screenshot.png

The response is the image itself, so save the response body to a file with an image extension matching the requested format. The API documentation recommends encoding the target URL; --data-urlencode handles that for cURL.

Python

import requests

response = requests.get(
    "https://api.screenshotmachine.com/",
    params={
        "key": "YOUR_KEY",
        "url": "https://example.com",
        "device": "phone",
        "dimension": "480x800",
        "format": "png",
    },
    timeout=90,
)
response.raise_for_status()

with open("screenshot.png", "wb") as image_file:
    image_file.write(response.content)

Install the dependency with python -m pip install requests. Check the response status before writing the body to a file so that an HTTP error page is not saved with a .png extension.

Node.js

const params = new URLSearchParams({
  key: 'YOUR_KEY',
  url: 'https://example.com',
  device: 'phone',
  dimension: '480x800',
  format: 'png',
});

const response = await fetch(
  `https://api.screenshotmachine.com/?${params}`
);

if (!response.ok) {
  throw new Error(`ScreenshotMachine returned HTTP ${response.status}`);
}

const image = Buffer.from(await response.arrayBuffer());
await import('node:fs/promises').then(({ writeFile }) =>
  writeFile('screenshot.png', image)
);

Run this as an ES module or in a Node.js environment that supports global fetch. The query parameters are encoded by URLSearchParams.

2. Choose width, height, and full-page behavior

The API’s dimension parameter uses widthxheight. The documented width range is 100–1920 pixels. Height can be 100–9999 pixels, or full.

Goal Example dimension What it captures
Phone-width initial viewport 480x800 A 480-pixel-wide rendering with an 800-pixel capture height.
Full page at a phone width 480xfull The full document at 480 pixels wide.
Custom narrow viewport 390x844 A specific requested width and height, within the documented limits.

The documentation’s phone example uses device=phone and dimension=480x800. That is an example, not a universal best width. Select a width that represents the layout you want to review. Use full as the height only when the full document is needed; a full-page image can be much taller than a viewport capture.

3. Configure the other documented options

Parameter Documented behavior When to use it
key Your ScreenshotMachine customer key. Required to authenticate the request. Keep it out of public repositories and browser code.
url The page to capture. Required. URL-encode it, especially if it contains its own query string or special characters.
device desktop, phone, or tablet; default is desktop. Set phone for the documented phone rendering mode.
dimension [width]x[height]; width 100–1920, height 100–9999, or full. Specify the viewport width and capture height, or full-page height.
format Optional output format setting. Choose an image format supported by the service and use a matching output filename.
delay Default 200 ms; documented range 0–10000 ms in listed increments. Allow extra time before capture for animation or content that appears after initial load.
zoom Default 100%; documented range 10–400. The documentation notes that it is ignored for screenshots smaller than the typical dimension mentioned for the selected device. Adjust only when the selected device size makes zoom applicable.
user-agent Optional custom user-agent string; the API page shows a Samsung Galaxy S20-style example. Use if the page responds differently to a particular user-agent. This alone does not establish physical-device fidelity.
cacheLimit Listed as an optional API setting. Consult the current API reference for its accepted values and behavior before relying on it.

For example, increase the delay for a full-page capture with content that takes time to appear:

curl -G 'https://api.screenshotmachine.com/' \
  --data-urlencode 'key=YOUR_KEY' \
  --data-urlencode 'url=https://example.com' \
  --data-urlencode 'device=phone' \
  --data-urlencode 'dimension=480xfull' \
  --data-urlencode 'delay=2000' \
  --data-urlencode 'format=png' \
  -o full-page.png

A longer delay gives the page more time before capture, but it does not guarantee that every script, image, or animation has completed.

4. Use the online generator without writing code

ScreenshotMachine’s online generator provides a no-code route. Set the target page, then choose the device type, width, height, full-page behavior, zoom, and image format in its interface. Review the result at the dimensions you intend to use in your application.

5. Verify the result for your use case

  1. Confirm that the saved file opens as the requested image format.
  2. Check that the screenshot uses the intended width and device mode.
  3. Verify whether you wanted only the initial viewport or the entire document.
  4. If content is missing, try an appropriate longer delay and capture again.
  5. Compare output across runs using the same URL, dimensions, device mode, and delay.

A phone rendering mode or custom user-agent should not be treated as proof that the screenshot is identical to what a particular physical handset displays. The documented settings specify capture parameters; the sources do not establish exact handset emulation.

6. Troubleshooting

Symptom Likely cause What to do
The request is rejected or does not produce an image. The key or target URL is missing or invalid. Check that both key and url are present, and that the URL is encoded correctly.
The output is desktop-sized. device was omitted, misspelled, or left at its documented default of desktop. Set device=phone explicitly and send the intended dimension.
The image has the wrong dimensions. The dimension value is malformed or outside the documented bounds. Use widthxheight, with width 100–1920 and height 100–9999, or use full for height.
The capture stops before the page ends. A fixed height was requested instead of full-page height. Use a dimension such as 480xfull.
Images or animated content are missing or incomplete. The page needed more time before capture. Increase delay within its documented range. Long pages with images or animations may need a delay such as 2000 ms or more.
The saved file cannot be opened as an image. An error response may have been saved as an image, or the extension does not match the requested format. Check the HTTP status in your client, inspect the response content type, and make the file extension match format.
Changing zoom has no visible effect. The documentation says zoom can be ignored for screenshots smaller than the typical dimension for the selected device. Check the selected device and dimensions; do not rely on zoom where that caveat applies.

7. Performance, reliability, and cost considerations

Small viewport captures generally request less page content than a full-page capture, while full pages can take longer to render. ScreenshotMachine specifically suggests allowing a longer delay, such as 2000 ms or more, for long pages with images or animations. Choose the shortest delay that produces the content your task requires, then check the output rather than assuming a delay guarantees readiness.

For repeatable visual checks, keep the URL, device, dimensions, format, and delay consistent. A page’s own loading behavior can still affect what appears. The available research does not establish ScreenshotMachine pricing, quotas, service uptime, or account-specific limits; check its current account and service information before estimating production cost or throughput.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server from ScreenshotNeo. It can return a screenshot or PDF from one GET request. Its capture options include viewport sizing, full-page capture, and image formats including PNG, JPEG, and WebP. See the ScreenshotNeo API documentation.

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

Cookie banners are accepted like a visitor would accept them, and more than 60 known consent platforms, newsletter popups, and chat widgets are removed before the shot; each cleanup step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. An MCP server gives AI agents tools to take screenshots, get page information, and capture PDFs. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to capture 1,000 screenshots a month with no card.

FAQ

Is 480 pixels the best mobile width?

It is ScreenshotMachine’s documented phone example, not a universal recommendation. Choose the width that matches the layout you need to inspect.

Does device=phone reproduce a real handset exactly?

The documented option selects phone mode, but the available documentation does not establish exact behavior for a particular physical device.

Can I capture just the visible screen?

Yes. Use a fixed height, such as 480x800, rather than 480xfull.

Can I use a custom user-agent without changing device mode?

The API lists user-agent as an optional setting. A custom user-agent alone should not be taken to mean that all phone rendering behavior is reproduced.