Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To use a screenshot API from ASP.NET Core, make an outbound HTTP request with HttpClient, send the provider’s required credentials and rendering options, then return the result as a file or process its JSON response. You do not need a .NET SDK: the exact endpoint, authentication method, and response format depend on the service. This guide shows a provider-neutral ASP.NET Core setup and explains what to change for the API you choose.

How a screenshot API fits into an ASP.NET Core app

Your ASP.NET Core endpoint receives a request from your application’s caller, asks a hosted screenshot service to render a web page, and sends the resulting image or PDF back. The provider performs the browser work; your app handles validation, credentials, HTTP communication, and the response to its own caller.

  1. Accept a target URL and, if needed, rendering options from the caller.
  2. Validate the URL and construct the provider’s documented request.
  3. Send the request through HttpClient using the provider’s authentication scheme.
  4. Check the status and response format; return file bytes or handle a structured response.

Providers are not interchangeable at the request level. One may use GET and return raw image bytes; another may use POST and return JSON containing a URL, or redirect to image bytes. Treat the endpoint and parameter names in the selected provider’s documentation as authoritative. The generic endpoint below is illustrative, not a real provider URL.

Build a Minimal API endpoint that returns an image

This example uses ASP.NET Core’s Minimal API model, an IHttpClientFactory-managed client, and a bearer token. Replace the illustrative endpoint, parameter names, and authorization scheme with the provider’s documented values. The example assumes the provider returns raw image bytes; JSON responses need separate handling.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • 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.

1. Create the app and configure the client

Create a minimal web project with dotnet new web. Add the following registrations in Program.cs, before var app = builder.Build();:

using System.Net.Http.Headers;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddHttpClient("ScreenshotProvider", client =>
{
    client.Timeout = TimeSpan.FromSeconds(90);
});

var app = builder.Build();

The 90-second timeout here is an application choice, not a provider guarantee. Set it to suit the provider’s documented limits and your own request budget.

2. Map a route and return the capture

Add this route after building the app. It checks that the key is configured, restricts input to absolute HTTP or HTTPS URLs, escapes the URL as a query parameter, and returns the provider’s bytes with its reported media type.

app.MapGet("/screenshot", async (
    string url,
    IHttpClientFactory factory,
    IConfiguration config,
    CancellationToken cancellationToken) =>
{
    if (!Uri.TryCreate(url, UriKind.Absolute, out var target) ||
        (target.Scheme != Uri.UriSchemeHttp && target.Scheme != Uri.UriSchemeHttps))
    {
        return Results.BadRequest("url must be an absolute HTTP or HTTPS URL");
    }

    var apiKey = config["ScreenshotApi:ApiKey"];
    if (string.IsNullOrWhiteSpace(apiKey))
    {
        return Results.Problem("Screenshot API credentials are not configured.", statusCode: 500);
    }

    var client = factory.CreateClient("ScreenshotProvider");
    client.DefaultRequestHeaders.Authorization =
        new AuthenticationHeaderValue("Bearer", apiKey);

    var endpoint = "https://provider.example/v1/screenshot?url=" +
                   Uri.EscapeDataString(target.ToString());

    try
    {
        using var response = await client.GetAsync(endpoint, cancellationToken);
        if (!response.IsSuccessStatusCode)
        {
            return Results.Problem(
                $"Screenshot provider returned HTTP {(int)response.StatusCode}.",
                statusCode: 502);
        }

        var bytes = await response.Content.ReadAsByteArrayAsync(cancellationToken);
        if (bytes.Length == 0)
        {
            return Results.Problem("Screenshot provider returned an empty response.", statusCode: 502);
        }

        var contentType = response.Content.Headers.ContentType?.MediaType ?? "image/png";
        return Results.File(bytes, contentType, "screenshot.png");
    }
    catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested)
    {
        return Results.Problem("Screenshot provider request timed out.", statusCode: 504);
    }
    catch (HttpRequestException)
    {
        return Results.Problem("Could not reach the screenshot provider.", statusCode: 502);
    }
});

app.Run();

The fallback media type and download filename are examples; set them based on the provider’s actual response and requested format. If your route accepts format options, validate them against formats the provider supports rather than passing arbitrary values through.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Keep the key out of source control

Use configuration binding or environment variables, and do not commit a live API key to appsettings.json or source code. For local development, ASP.NET Core user secrets can hold a setting outside the project files. In deployment, use your hosting platform’s secret or environment-variable facility. For an environment variable, use the hierarchical key ScreenshotApi__ApiKey; the double underscore maps to the colon in ScreenshotApi:ApiKey.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 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.

In production code, avoid putting credentials in a URL query string unless the provider requires it. Query strings can appear in server logs and other records. Prefer the documented authorization header where available, and never log the key.

Use a typed client for production code

A typed client keeps provider-specific HTTP details out of the route and makes the integration easier to test. This example still uses an illustrative endpoint and assumes raw image bytes.

Register the typed client

builder.Services.AddHttpClient<ScreenshotClient>(client =>
{
    client.Timeout = TimeSpan.FromSeconds(90);
});

Implement the client

using System.Net.Http.Headers;

public sealed class ScreenshotClient
{
    private readonly HttpClient _http;
    private readonly IConfiguration _config;

    public ScreenshotClient(HttpClient http, IConfiguration config)
    {
        _http = http;
        _config = config;
    }

    public async Task<(byte[] Bytes, string ContentType)> CaptureAsync(
        Uri target,
        CancellationToken cancellationToken)
    {
        var apiKey = _config["ScreenshotApi:ApiKey"];
        if (string.IsNullOrWhiteSpace(apiKey))
            throw new InvalidOperationException("Screenshot API key is not configured.");

        using var request = new HttpRequestMessage(
            HttpMethod.Get,
            "https://provider.example/v1/screenshot?url=" +
            Uri.EscapeDataString(target.ToString()));
        request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);

        using var response = await _http.SendAsync(
            request, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
        response.EnsureSuccessStatusCode();

        var bytes = await response.Content.ReadAsByteArrayAsync(cancellationToken);
        var contentType = response.Content.Headers.ContentType?.MediaType ?? "image/png";
        return (bytes, contentType);
    }
}

Inject ScreenshotClient into a route or controller and call CaptureAsync. In a larger application, use a dedicated options class for the API key and endpoint, validate required settings at startup, and translate provider exceptions into appropriate HTTP responses at the application boundary.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Return the result from an MVC controller

For a controller-based application, return the byte array using File(byte[], contentType). The sample below assumes the same typed client and URL validation as above.

using Microsoft.AspNetCore.Mvc;

[ApiController]
[Route("api/screenshots")]
public sealed class ScreenshotsController : ControllerBase
{
    private readonly ScreenshotClient _screenshots;

    public ScreenshotsController(ScreenshotClient screenshots)
    {
        _screenshots = screenshots;
    }

    [HttpGet]
    public async Task<IActionResult> Get(
        [FromQuery] string url,
        CancellationToken cancellationToken)
    {
        if (!Uri.TryCreate(url, UriKind.Absolute, out var target) ||
            (target.Scheme != Uri.UriSchemeHttp && target.Scheme != Uri.UriSchemeHttps))
        {
            return BadRequest("url must be an absolute HTTP or HTTPS URL");
        }

        try
        {
            var result = await _screenshots.CaptureAsync(target, cancellationToken);
            return File(result.Bytes, result.ContentType, "screenshot.png");
        }
        catch (HttpRequestException)
        {
            return StatusCode(502, "Screenshot provider request failed.");
        }
        catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested)
        {
            return StatusCode(504, "Screenshot provider request timed out.");
        }
    }
}

The browser or calling application receives your ASP.NET Core response, not necessarily the provider’s original response. If the provider returns a redirect, URL, or JSON object, decide whether your endpoint should pass that through, download the linked image server-side, or transform it into a file response.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • 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.

Handle providers that return JSON, a URL, or base64

Do not assume every successful response is an image. Inspect the provider’s documented response contract and the response Content-Type. Some services return an image URL or redirect; others return JSON with a URL, base64 data, or extracted page text.

  • Raw image or PDF bytes: read the response body as bytes and return the actual media type.
  • JSON with a hosted image URL: deserialize the documented JSON model. You can return the JSON to your caller or make a second HTTP request to fetch the image. If fetching it server-side, validate the host and scheme to avoid turning the endpoint into an unrestricted proxy.
  • Base64 in JSON: deserialize the specified field, decode it with Convert.FromBase64String, and return the bytes with the provider’s documented format. Handle malformed base64 as an upstream response error.
  • Extracted text alongside an image: use the provider’s structured endpoint and model its JSON explicitly instead of treating the entire body as an image.

Screenshot API documents a GET endpoint at /v1/screenshot that returns raw image bytes, and a separate GET /v1/capture endpoint for JSON containing an image and page text. Screenshot API.org documents a POST endpoint at /api/v1/screenshot and describes a response that may provide a URL or redirect to image bytes. Those differences affect both request construction and response handling.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose an API and .NET integration approach

There is no universal screenshot API contract, and a package is not required to call one. The details below are limited to the providers’ documented endpoint and SDK facts; verify current formats, controls, quotas, rate limits, availability, data retention, and support directly with each service before relying on them.

Service Documented request and response .NET integration detail Source
ScreenshotNeo One GET request to its screenshot API returns a screenshot in PNG, JPEG, or WebP, or a PDF. Use ordinary HTTP from ASP.NET Core; an MCP server is also available for AI agents. ScreenshotNeo documentation
Screenshot API GET /v1/screenshot with bearer authentication returns raw image bytes; ?key= is documented as a convenience form. GET /v1/capture returns JSON with image and page text. A direct HttpClient call can consume the documented endpoints. Screenshot API documentation
Screenshot API.org POST /api/v1/screenshot, bearer API-key authentication, and viewport, format, and full-page parameters are documented. The documentation lists dotnet add package ScreenshotApi. Screenshot API.org documentation
ScreenshotAPI.to Its C# page recommends direct REST calls using HttpClient on .NET 6 or later. It states, “There’s no official .NET SDK yet.” ScreenshotAPI.to C# documentation
Screenshot Scout Screenshot Scout’s SDK documentation lists the package and runtime requirement; other endpoint details are not stated there. Official ScreenshotScout NuGet package; .NET 8 or later required. Screenshot Scout .NET SDK documentation

When comparing candidates, check how each handles authentication, image formats, viewport and full-page capture, JavaScript wait conditions, element selection, response shape, quotas, rate limits, regional availability, failed captures, SDK maintenance, and data retention. Do not infer pricing, an SLA, or compliance certification from the endpoint or SDK documentation.

Rendering options to verify before adding parameters

Rendering parameters are provider-specific. Start with the smallest working request, then add only options the chosen API documents. Depending on the provider, useful controls may include:

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • 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
  • Output: PNG, JPEG, WebP, or PDF and any image-quality or page settings.
  • Viewport: width, height, device emulation, scale factor, or full-page capture.
  • Wait behavior: a delay, network-idle condition, or wait for a CSS selector so that JavaScript-rendered content has time to appear.
  • Targeting: capture a particular element rather than the full page, if supported.

Screenshot API.org’s documentation lists viewport, format, and full-page parameters, but it does not establish the complete option set for every provider. Consult the provider’s current API reference rather than copying parameter names between services.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common integration failures

  • 401 or 403 from the provider: check that the key is present, active, and sent in the right place. Confirm whether the service expects a bearer header or another documented form. Do not put a production key in a query string just to make a sample work.
  • 400 response: verify the endpoint method, required parameter names, URL encoding, and allowed values for format or viewport. A GET-only API will not accept a POST body unless its documentation says so.
  • 429 response: treat this as rate limiting. Follow the provider’s published retry guidance and any Retry-After header; use bounded backoff rather than retrying immediately in a tight loop.
  • 502 or 5xx response: distinguish an upstream provider error from an error in your own route. Record the provider status and a safe correlation identifier, but never log credentials or sensitive response content.
  • 504 or cancellation: compare your HttpClient timeout, ASP.NET Core request-abort behavior, and the provider’s rendering time limits. A caller disconnecting should normally cancel the outbound request rather than leave it running.
  • Corrupt or blank file: inspect the upstream status and Content-Type before returning bytes. The response may be JSON error text, a redirect, or an empty body rather than an image.
  • Screenshot misses page content: use the provider’s documented wait or selector options if available. A successful HTTP response does not by itself prove the page rendered the content your application expected.

Performance, reliability, and cost considerations

Each request to a hosted screenshot service adds network time and remote rendering time to your endpoint. Set an explicit timeout, pass the caller’s cancellation token, and avoid holding application resources longer than needed. For higher request volume, consider queueing captures or using the provider’s asynchronous job mechanism if offered; confirm the service’s current limits and delivery behavior first.

Use IHttpClientFactory rather than creating a new unmanaged client per request. It manages handler lifetimes and supports centralized configuration. Keep responses as bytes only as long as necessary, especially for full-page images or PDFs, which can be larger than a typical thumbnail. If you cache results, account for the target page changing and for any provider cache behavior; do not assume a cache hit or a particular billing rule unless the provider documents it.

Pricing, quotas, rate limits, and service-level commitments were not established for the providers listed here, so compare their current pricing and operational terms before selecting one for production. Also decide how your app handles provider outages: return an upstream failure, serve a previously captured result if appropriate, or enqueue a retryable job.

Or skip the browser setup

For a direct screenshot request, ScreenshotNeo exposes a GET API; you can call it from ASP.NET Core with the same ordinary outbound HTTP approach. Its API returns PNG, JPEG, or WebP, or a PDF. See the ScreenshotNeo API documentation for request parameters and response details.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo’s clean-shot flow accepts cookie and consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents using Claude, Cursor, or another MCP client. Its Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots.

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

Frequently Asked Questions

Do I need a .NET SDK to call a screenshot API?

No. ASP.NET Core can call a REST endpoint with HttpClient; a provider SDK is optional.

Can an ASP.NET Core endpoint return a screenshot as a download?

Yes. Return the bytes with the provider’s actual content type using Results.File in a Minimal API or File in a controller.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I use the same request parameters with different screenshot APIs?

Not safely. HTTP method, authentication, parameter names, and response format vary by provider, so use that service’s documentation.

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.