To take a screenshot from Elixir, make an HTTP GET request to a screenshot API, pass the page URL and your API key, then save the returned image bytes. You do not need a dedicated Elixir SDK: an HTTP client such as Req can make the request. The exact endpoint, parameters, authentication, and response format depend on the provider; do not mix settings from similarly named services.
What you need before making the request
- An Elixir project and a configured HTTP client. The example below uses Req.
- An API key from the screenshot provider you intend to call.
- A target page URL that the provider can access.
The ScreenshotDEV example uses Req with the dependency constraint {:req, "~> 0.5"}. That is the constraint in that vendor’s example, not a recommendation that it is the newest Req release or compatible with every project. Check the current Req documentation and your project’s dependency constraints before selecting a version. The example endpoint and request fields below are also specific to ScreenshotDEV; verify its live documentation before relying on them as a current API contract.
Minimal Elixir screenshot example with Req
Add Req to your project’s dependencies in mix.exs if it is not already present:
defp deps do
[
{:req, "~> 0.5"}
]
end
Fetch dependencies with mix deps.get. This minimal example follows the ScreenshotDEV vendor example: it sends a GET request with the target URL and access key as query parameters, then writes the response body to a PNG file.
#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.
access_key = System.fetch_env!("SCREENSHOTDEV_ACCESS_KEY")
{:ok, response} = Req.get(
"https://api.screenshotdev.com/v1/screenshot",
params: [url: "https://example.com", access_key: access_key]
)
File.write!("screenshot.png", response.body)
Set SCREENSHOTDEV_ACCESS_KEY in the environment before running your script. For example, in a Unix-like shell:
export SCREENSHOTDEV_ACCESS_KEY="your-key"
mix run screenshot.exs
This sample demonstrates the request shape shown in the provider’s example; it does not establish that every response is a PNG, that the endpoint remains unchanged, or that every successful HTTP response contains image bytes. Confirm those details with the exact provider documentation. If the provider returns a different format or an error payload, use the corresponding file extension and handle the response accordingly.
Handle HTTP failures and request errors
A production integration should distinguish an HTTP response with a successful status from an HTTP response with a non-success status and from a failure to make the request at all. Do not blindly save an error page or JSON error body as an image.
defmodule Screenshot do
def capture(url, path) do
access_key = System.fetch_env!("SCREENSHOTDEV_ACCESS_KEY")
case Req.get(
"https://api.screenshotdev.com/v1/screenshot",
params: [url: url, access_key: access_key]
) do
{:ok, %{status: status, body: body}} when status in 200..299 ->
case File.write(path, body) do
:ok -> {:ok, path}
{:error, reason} -> {:error, {:file_write, reason}}
end
{:ok, %{status: status, body: body}} ->
{:error, {:http_status, status, body}}
{:error, exception} ->
{:error, {:request_failed, exception}}
end
end
end
case Screenshot.capture("https://example.com", "screenshot.png") do
{:ok, path} -> IO.puts("Saved #{path}")
{:error, reason} -> IO.inspect(reason, label: "Screenshot failed")
end
This pattern assumes the selected Req version returns the response and error shapes shown; check the installed version’s documentation if you adapt it. For stricter validation, inspect the response’s content type if the provider documents one, and confirm that the body matches the requested image format before saving. The available ScreenshotDEV example does not establish its content-type behavior.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →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.
Capture options: confirm the provider’s parameter names
The ScreenshotDEV example excerpt describes optional settings for format, width, full-page capture, and dark mode. It gives WebP, width 1280, full-page disabled, and dark mode disabled as defaults. Because the live page was not available for verification, treat these as details of that example rather than guaranteed current behavior. Confirm accepted values, limits, parameter spelling, defaults, and output type in the documentation for your chosen API.
- Format: Select only a format the specific endpoint supports. Match the filename extension to the returned image format.
- Width: A viewport width can change layout and output dimensions. Confirm whether the service treats it as CSS pixels or another unit, and whether it also accepts a height.
- Full-page capture: This may capture content beyond the initial viewport. Check how the provider handles long pages and content that loads while scrolling.
- Dark mode: This setting may affect page rendering only if the provider supports it. Test pages with their own theme controls rather than assuming the API can override every site.
Capture options are API-specific. Do not copy a parameter name or default from another screenshot vendor simply because the products have similar names.
Choosing an HTTP client and output approach
Req or another Elixir HTTP client
Req is the client used in the ScreenshotDEV example, but a dedicated vendor SDK is not inherently required for a REST API. Another Elixir HTTP client can work if it supports the request method, query parameters or other authentication mechanism required by your provider, and gives you access to the status and response body.
GET parameters and credential handling
The ScreenshotDEV example places both the page URL and access key in GET parameters. Follow the provider’s documented authentication method rather than assuming that another method is available. Query-string credentials can be exposed in application, proxy, or server logs; avoid logging complete request URLs, keep keys out of source control, and store credentials in runtime configuration or environment variables. If a provider documents header-based authentication or a POST request, use that provider’s instructions instead.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsRank #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.
Saving, returning, or storing bytes
Writing the response body to a file suits a script or batch task. An application may instead return the bytes to its caller or pass them to its own storage layer. The ScreenshotDEV excerpt establishes a file-writing example, not streaming support or a particular content-type contract. Check the selected provider’s documentation before designing around streaming or a specific response header.
Or skip the browser setup
ScreenshotNeo provides a screenshot API and MCP server for developers. Its one-call HTTP endpoint can return a PNG, JPEG, WebP, or PDF. From Elixir, you can call it with Req and write the returned bytes just as you would with another HTTP service. See the ScreenshotNeo API documentation for request details.
access_key = System.fetch_env!("SCREENSHOTNEO_ACCESS_KEY")
{:ok, response} = Req.get(
"https://api.screenshotneo.com/v1/shot",
params: [access_key: access_key, url: "https://example.com"],
receive_timeout: 90_000
)
File.write!("shot.webp", response.body)
ScreenshotNeo accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server gives AI agents tools for taking screenshots, getting page information, and capturing PDFs. 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 without a card.
Free tools Windows power users keep installed
One-click scans. No signup required.
Troubleshooting common problems
The request fails before an HTTP response arrives
This is a transport or client-side failure rather than an HTTP status returned by the API. Check network access, DNS, TLS configuration, proxy settings, and the timeout behavior of your installed Req version. Verify that the endpoint is reachable from the environment running the application.
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
The API responds with a non-success status
Keep the status and response body available for diagnosis, but redact credentials and sensitive target URLs in logs. Check the provider’s documentation for authentication requirements, valid parameters, and status-specific error meanings. Do not assume that an error response body is an image.
The saved file is not an image
Inspect the HTTP status and, when documented, the content type and error payload before writing the file. A successful request at the HTTP layer does not by itself prove that the body is an image. Confirm the requested format, parameter names, and response contract with the same provider whose endpoint you called.
The screenshot shows the wrong layout or misses content
Check viewport and full-page settings, and determine whether the page requires time to load data or images. If the provider offers wait conditions or other rendering controls, use only options documented for that provider. The ScreenshotDEV excerpt does not establish additional wait controls.
Recommended Free Tools
The screenshot API works locally but not in deployment
Confirm that the deployed process receives the API key through its runtime environment, can make outbound HTTPS requests, and can write to the destination path. Avoid relying on a developer machine’s shell environment or filesystem permissions in production.
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.
Performance, reliability, and cost decisions
A screenshot call depends on both your HTTP request and the provider’s ability to load and render the target page. Set a timeout that fits the application’s job and user experience, and decide whether a slow capture should be retried, queued, or reported as a failure. For batch work, account for the time and storage needed to process each response rather than assuming one request always completes immediately.
Before choosing a provider for a production workflow, verify its current response contract, supported options, request limits, retry guidance, and pricing directly. The ScreenshotDEV excerpt advertises 100 free API calls per month, but the date and current terms are not established here; do not budget on that allowance without checking the provider’s live plan details. Keep service-specific prices, endpoints, credentials, and behavior tied to the service that documents them.
Frequently Asked Questions
Do I need an Elixir screenshot SDK?
No. A screenshot API that accepts HTTP requests can be called from Elixir with a general-purpose HTTP client such as Req.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows 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 reinstallCan I use the ScreenshotDEV endpoint shown in the example with another screenshot provider’s key?
No. Endpoint URLs, credentials, parameter names, and response contracts belong to the individual provider; use matching documentation and credentials.
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.

