To call a screenshot API from AWS Lambda, make an HTTPS request from your function to the screenshot provider’s endpoint, authenticate with that provider’s credential, and handle the response as binary image data, JSON, or a stored result. This is separate from invoking Lambda itself: AWS service calls use AWS credentials and permissions, while an external screenshot API uses its own request format and key.
1. Choose how the function will call the screenshot service
Use the provider’s documented HTTPS API directly with your runtime’s HTTP client, or use its SDK if one fits your language and runtime. An AWS SDK is appropriate for AWS service APIs; AWS recommends using SDKs rather than making direct requests to those APIs (AWS Lambda Invoke API). It does not authenticate requests to a third-party screenshot vendor.
Before implementing the call, check the provider’s requirements for the target input, HTTP method, credential placement, output format, response behavior, limits, and any asynchronous or storage options. The example below uses ScreenshotOne’s documented HTTP API and Node.js; it is illustrative, not a claim that the code was run in Lambda. ScreenshotOne also provides an official Node.js SDK.
2. Keep the screenshot API key out of the source code
Give the Lambda function its screenshot-provider credential through protected configuration, such as an environment variable or a secrets manager. Limit access to the secret and avoid logging it. If using an AWS secrets service to retrieve the key, grant the function only the AWS permissions needed for that operation.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
ScreenshotOne documents authentication through an access key in a query parameter, JSON body, or X-Access-Key header. Where supported, a header or POST body can reduce the chance that credentials appear in URL logs or shared links. Its documentation also warns that unsigned URLs containing a key can expose it; use its signed-URL method if a URL must be shared (ScreenshotOne authentication documentation).
3. Send a request and handle the binary response
Node.js example: ScreenshotOne HTTP API
This Node.js handler makes a POST request with JSON, checks for an HTTP error, verifies that the result is an image, and returns base64-encoded bytes in a Lambda proxy response. Configure the relevant API Gateway REST API binary media type for the image content type you return. Set SCREENSHOTONE_ACCESS_KEY in Lambda’s protected configuration before invoking the handler.
export const handler = async () => {
const accessKey = process.env.SCREENSHOTONE_ACCESS_KEY;
if (!accessKey) {
throw new Error("Missing SCREENSHOTONE_ACCESS_KEY");
}
const response = await fetch("https://api.screenshotone.com/take", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Access-Key": accessKey
},
body: JSON.stringify({
url: "https://example.com",
format: "png"
})
});
if (!response.ok) {
const errorBody = await response.text();
throw new Error(`Screenshot API returned ${response.status}: ${errorBody}`);
}
const contentType = response.headers.get("content-type") || "";
if (!contentType.startsWith("image/")) {
const responseBody = await response.text();
throw new Error(`Expected an image, received ${contentType}: ${responseBody}`);
}
const image = Buffer.from(await response.arrayBuffer());
return {
statusCode: 200,
headers: { "Content-Type": contentType },
isBase64Encoded: true,
body: image.toString("base64")
};
};
Confirm option names and accepted formats against the provider’s current API documentation before deploying; the request fields above illustrate a URL capture. ScreenshotOne documents GET and POST, with access-key authentication available in the request header or JSON body as well as the query string. Its POST body limit is 100 MiB, according to its API options documentation (ScreenshotOne API options).
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
cURL example
For a direct API call outside Lambda, the equivalent documented endpoint can be exercised with a request such as:
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutecurl -X POST "https://api.screenshotone.com/take"
-H "Content-Type: application/json"
-H "X-Access-Key: $SCREENSHOTONE_ACCESS_KEY"
-d '{"url":"https://example.com","format":"png"}'
-o screenshot.png
Do not put a real key into a shell command that may be saved in shell history or visible in process listings; supply it through a protected mechanism appropriate to your environment.
Python example
In a Python Lambda runtime, use an HTTP library available in the deployed package, or the runtime’s supported HTTP facilities. This example uses requests; include that dependency in the deployment package or layer.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
import os
import requests
def lambda_handler(event, context):
access_key = os.environ["SCREENSHOTONE_ACCESS_KEY"]
response = requests.post(
"https://api.screenshotone.com/take",
headers={
"Content-Type": "application/json",
"X-Access-Key": access_key,
},
json={"url": "https://example.com", "format": "png"},
timeout=60,
)
response.raise_for_status()
content_type = response.headers.get("Content-Type", "")
if not content_type.startswith("image/"):
raise RuntimeError(f"Expected image; received {content_type}")
image_bytes = response.content
return {
"statusCode": 200,
"headers": {"Content-Type": content_type},
"isBase64Encoded": True,
"body": __import__("base64").b64encode(image_bytes).decode("ascii"),
}
As in the Node.js example, this proxy response requires the API Gateway REST API’s binary media type configuration. A function called directly can instead save the bytes to storage or return them in a format expected by its caller.
Use ScreenshotOne’s SDK when useful
ScreenshotOne’s official Node.js/TypeScript SDK is installed as screenshotone-api-sdk. Its documented pattern constructs a client with access and secret keys, calls client.take(options), then converts the returned Blob to a Buffer. That documentation demonstrates the SDK’s response handling, but does not establish that the sample was tested in Lambda (ScreenshotOne SDK documentation).
Free tools Windows power users keep installed
One-click scans. No signup required.
4. Decide what Lambda should do with the screenshot
Return it through API Gateway
For an API Gateway REST API Lambda proxy integration, return the image content type, a base64-encoded body, and isBase64Encoded: true; configure the API’s binary media types to match. AWS documents this binary-response approach and gives a 10 MB payload limit in its binary media guide. Verify the limit for the API type and configuration you use before relying on it (API Gateway binary media).
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Returning a base64 string increases the representation size relative to raw bytes, so consider whether relaying the image through API Gateway is suitable for your output size and caller. If the caller only needs a durable result, storing the image and returning a reference may be a better architecture.
Store it or return status only
ScreenshotOne documents optional storage to a configured S3 bucket or S3-compatible endpoint. That requires storage settings; an API call alone does not imply that an object will be uploaded or that an object URL will be returned. Its API also documents response_type=empty for callers that need status or error information rather than image bytes, and JSON response mode for JSON metadata or options that produce JSON (ScreenshotOne response types).
5. Match invocation style and timeouts to the work
If another application invokes Lambda through the AWS Invoke API, RequestResponse waits for the function to finish; Event queues the event and returns before the work completes. AWS documents maximum Invoke request payloads of 6 MB for synchronous calls and 1 MB for asynchronous calls (AWS Lambda Invoke API). These are Lambda Invoke payload limits, not screenshot image-size limits for the vendor API.
Recommended Free Tools
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
For a synchronous screenshot flow, the provider’s capture time, Lambda’s configured timeout, and the upstream caller’s timeout must fit together. If a capture can exceed the caller’s wait budget, use an asynchronous design and arrange a way to retrieve completion, such as a job record or configured callback supported by the chosen provider. Do not assume asynchronous invocation will return the screenshot in the initial response.
6. ScreenshotNeo option: make a one-call request
To skip setting up a browser in Lambda, use ScreenshotNeo, a screenshot API and MCP server made by Yorker Media. One GET request accepts a URL and returns an image or PDF. See the ScreenshotNeo API documentation for the request contract.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo removes cookie/consent banners, newsletter popups, and chat widgets before capture; those cleanup steps can be disabled. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing status in headers. Its MCP server exposes screenshot, page-info, and PDF-capture tools to AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →7. Troubleshoot common failures
Authentication fails
- Confirm the secret is present in the deployed Lambda configuration and that the code uses the provider’s exact header, query parameter, or body field.
- Check for whitespace, a revoked key, or a key from the wrong account or environment. Never print the key in logs while diagnosing.
The response is an error or not an image
- Check the HTTP status before decoding the body as an image. ScreenshotOne documents JSON errors containing an error code and human-readable message; log a sanitized error body to identify invalid options, denied access, or an unreachable target.
- Check the response content type. A successful HTTP response is not sufficient proof that the body is an image if the selected response mode returns JSON or status-only output.
The function times out
- Set the Lambda timeout to allow for the full capture and request handling, while respecting the invoking caller’s timeout.
- For work that does not need an immediate screenshot response, switch to an asynchronous workflow rather than allowing a synchronous caller to wait indefinitely.
The image response is corrupted or rejected by API Gateway
- Ensure the bytes are base64-encoded exactly once, the proxy response sets
isBase64Encodedto true, and the content type matches the actual format. - Verify binary media type configuration for the API Gateway REST API and check the deployed API’s relevant payload limits.
Large input is rejected
Check the selected provider’s request-body limit and the limits in every intermediary. ScreenshotOne documents a 100 MiB maximum POST body; API Gateway’s binary media guide gives a 10 MB payload limit, subject to API type and configuration.
Frequently Asked Questions
Does AWS Lambda need an AWS SDK to call a screenshot API?
No. A third-party screenshot endpoint is an external HTTP service; use its documented API contract and credential. AWS SDKs are for AWS service APIs such as Lambda Invoke.
Can I save the image instead of returning it through API Gateway?
Yes. Write it to storage available to your workflow and return a reference or job result. A provider-managed destination must be configured before expecting that provider to store the capture.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




