How to capture a mobile-sized website screenshot with Abstract Screenshot API
Set a mobile viewport with Abstract Screenshot API, choose viewport-only or full-page output, and handle common rendering issues.
To capture a mobile-sized website screenshot with Abstract Screenshot API, send a GET request to https://screenshot.abstractapi.com/v1/ with your API key, the complete target URL, and integer width and height values. For a screenshot limited to that viewport, set capture_full_page=false; the documented default is true, which captures the full page. The example below uses 390 × 844 pixels as an illustrative viewport, not an official device preset.
1. Choose viewport-only or full-page output
The viewport dimensions determine the browser area used for capture. They do not guarantee that the page behaves exactly as it would on a physical phone. Abstract accepts an optional user_agent, but its documentation does not prescribe a universal mobile user-agent string or viewport size.
| Goal | Parameters | Result |
|---|---|---|
| Capture the visible mobile viewport | width, height, capture_full_page=false |
An image bounded to the requested viewport. |
| Capture the whole page at a mobile width | width, height, capture_full_page=true |
A full-page image using the requested viewport dimensions. This is also the documented default for capture_full_page. |
Use dimensions that match the layout you need to inspect. If fidelity matters, try the dimensions and optional user-agent against the specific target page. A viewport setting alone does not establish device-specific behavior, and the reviewed documentation does not identify a standard phone profile.
2. Make a request with cURL
Set the API key in an environment variable so it is not written directly into shell history or committed to source control. cURL encodes query parameters supplied with -d and --data-urlencode.
export ABSTRACT_API_KEY='YOUR_UNIQUE_API_KEY'
curl -G 'https://screenshot.abstractapi.com/v1/' \
-d "api_key=$ABSTRACT_API_KEY" \
--data-urlencode 'url=https://example.com' \
-d 'width=390' \
-d 'height=844' \
-d 'capture_full_page=false' \
-d 'export_format=png' \
-o mobile-viewport.png
The key and target URL are required. Replace the illustrative dimensions and URL with your own values. The example explicitly requests PNG; the documented default format is JPEG.
3. Make a request with Python
Install the requests package if it is not already available in your environment (python -m pip install requests). This example checks the HTTP response before writing the returned image.
import os
import requests
api_key = os.environ['ABSTRACT_API_KEY']
params = {
'api_key': api_key,
'url': 'https://example.com',
'width': 390,
'height': 844,
'capture_full_page': 'false',
'export_format': 'png',
}
response = requests.get(
'https://screenshot.abstractapi.com/v1/',
params=params,
timeout=90,
)
response.raise_for_status()
with open('mobile-viewport.png', 'wb') as image_file:
image_file.write(response.content)
Set the environment variable before running the script, for example with export ABSTRACT_API_KEY='YOUR_UNIQUE_API_KEY' in a Unix-like shell. The timeout shown is a client-side example; choose one suitable for your application.
4. Make a request with Node.js
This example uses the built-in fetch available in current Node.js versions. It constructs the query with URLSearchParams, checks for an unsuccessful HTTP status, and saves the response bytes.
import { writeFile } from 'node:fs/promises';
const apiKey = process.env.ABSTRACT_API_KEY;
if (!apiKey) throw new Error('Set ABSTRACT_API_KEY first');
const params = new URLSearchParams({
api_key: apiKey,
url: 'https://example.com',
width: '390',
height: '844',
capture_full_page: 'false',
export_format: 'png',
});
const response = await fetch(
`https://screenshot.abstractapi.com/v1/?${params}`,
{ signal: AbortSignal.timeout(90_000) },
);
if (!response.ok) {
throw new Error(`Screenshot request failed: HTTP ${response.status}`);
}
await writeFile('mobile-viewport.png', Buffer.from(await response.arrayBuffer()));
Run as an ES module, or adapt the imports to the module system in your project. Keep the API key on a server or in a protected environment variable; do not expose it in browser-side code.
5. Configure optional capture parameters
The following options are described in Abstract’s Screenshot API v1 documentation. Use only the ones needed for the target page.
| Parameter | What it controls | Notes |
|---|---|---|
api_key |
Authentication credential. | Required. Treat it as a secret. |
url |
Page to capture. | Required; include http:// or https://. |
width, height |
Viewport dimensions in pixels. | Integer values. Choose dimensions for the layout you want to inspect. |
capture_full_page |
Whether to capture the entire page or only the viewport. | Defaults to true. Set to false for a viewport-bounded capture. |
user_agent |
User-agent string used for the request. | Optional. The reviewed docs do not prescribe a canonical mobile value. |
delay |
Wait time in seconds between page load and capture. | Optional; useful when a page needs extra time to render. |
css_injection |
CSS applied before capture. | Optional. Encode the value as a query parameter when constructing a raw URL; request libraries handle encoding. |
export_format |
Image format. | Optional; supported values are jpeg and png. The default is jpeg. |
For example, to allow an additional two seconds for a page to settle and inject CSS, add delay=2 and a URL-encoded css_injection value to the request. Keep in mind that a delay adds waiting time; it does not guarantee that every page-specific animation or asynchronous task has completed.
6. Understand mobile capture limits
- Viewport is not a complete device profile. Width and height set the capture viewport. A chosen user-agent may affect server responses, but the reviewed sources do not define a universal combination that reproduces every phone.
- Viewport-only and full-page are different outputs. Explicitly pass
capture_full_page=falsewhen you need only the visible viewport; omitting it uses the documented full-page default. - Rendering can vary by site. A page that loads content after initial navigation may need a
delay. Check the returned image for the target page’s behavior. - Private pages require verified access. Do not assume a screenshot request can capture a logged-in page. The reviewed material does not establish an authenticated-page setup for arbitrary targets.
- Location-specific rendering is unsupported. Abstract’s product FAQ says location-specific screenshots are not currently supported. A mobile viewport request should not be used as a substitute for region-based capture.
- Use TLS. The v1 documentation requires TLS 1.2 or greater; use the documented HTTPS endpoint.
7. Troubleshoot common problems
| Symptom | Likely cause | What to check |
|---|---|---|
| The image includes the whole page. | capture_full_page was omitted or set to true. |
Pass capture_full_page=false explicitly. |
| The request is rejected or cannot authenticate. | The API key is missing, invalid, or named incorrectly. | Send the required api_key parameter and verify the key in your environment. Keep it private. |
| The requested page does not load. | The URL is malformed or the target is unavailable to the capture service. | Use a complete URL beginning with https:// or http://, and check that the target is reachable. |
| The result looks like a desktop layout. | Viewport dimensions alone may not cause the target to serve a mobile-specific experience. | Confirm width and height are being sent as intended. If appropriate, try an explicit user_agent; Abstract does not document one universal mobile value. |
| Content is missing from the screenshot. | The page may render content after its initial load. | Try the optional delay and inspect whether the target needs additional rendering time. |
| CSS injection has no visible effect. | The CSS may be incorrectly encoded or may not match the page’s elements. | Pass it as a query parameter through a request library or URL encoder, then check that its selectors match the target DOM. |
| The saved file is not the format expected. | export_format was omitted, misspelled, or the file extension does not match the response. |
Request png or jpeg explicitly and use a matching output filename. |
| The request fails with a TLS connection error. | The client or network may not meet the documented TLS requirement. | Use HTTPS and a client/network that supports TLS 1.2 or newer. |
Abstract’s docs describe the endpoint and options, but they do not guarantee capture success for every website. Diagnose the HTTP response and the actual image before treating a request as a valid capture.
8. Plan for latency, reliability, and cost
A screenshot call includes remote page loading and image generation, so its elapsed time depends in part on the target and any configured delay. Avoid adding a delay by default if the page does not need it. For recurring captures, record the requested URL, viewport, full-page setting, format, response status, and capture time so you can identify changes in your own workflow.
Use bounded client timeouts and handle unsuccessful responses explicitly. Retry only errors your application considers transient, with a limit and backoff; repeated calls can create additional API usage. Keep credentials server-side and avoid logging the full request URL if it contains the API key, since the documented authentication credential is passed in the query string.
Abstract’s product page offers free and paid plans, but plan limits and prices can change and may differ between monthly and yearly billing selections. Check the live pricing page before estimating ongoing cost. The reviewed sources do not establish an independent speed benchmark or mobile-accuracy statistic.
9. Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF. Its options include viewport dimensions, 12 device presets, full-page capture with lazy images loaded, and control over the output format. 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 -d width=390 -d height=844 -o shot.webp
Cookie banners, popups, and chat widgets are removed before the shot. Bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.
Sign up for 1,000 free screenshots a month, with no card.
10. Frequently asked questions
What dimensions should I use for a mobile screenshot?
Choose dimensions that represent the viewport you want to inspect. The 390 × 844 example in this guide is illustrative; Abstract does not prescribe a universal mobile size.
Does setting a mobile user-agent make the screenshot identical to a real phone?
No such guarantee is documented. A user-agent is optional, and the viewport and user-agent should be treated as inputs to test for the specific page.
Can I capture a page as it appears in a particular country?
Abstract’s product FAQ says location-specific screenshots are not currently supported.
Which image formats can I request?
The documented choices are JPEG and PNG. JPEG is the default.
Where are the official API details?
See Abstract’s Website Screenshot API documentation and product FAQ for the current parameter and service details.


