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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

Use a screenshot API from Spring Boot by creating a small server-side endpoint, storing the provider key in configuration, and sending a JSON capture request over HTTPS. The documented request shape includes the target URL, viewport, image format, and a fullPage flag. You can call the service with a Java SDK or a standard HTTP client. Because SDK method signatures and the provider’s response type change independently of Spring Boot, verify the current provider documentation before treating an SDK snippet as copy-ready.

What you will build

The finished application accepts a validated target URL, calls a screenshot provider from server-side Java, and returns either the provider response or a normalized result to your client. The provider documentation describes a REST endpoint at /api/v1/screenshot, authenticated with an API key; it recommends placing that key in an authorization header.

This approach keeps credentials out of browser JavaScript and lets you apply your own URL allow-list, request limits, timeouts, logging, and response policy. The examples below use Spring Boot’s HTTP client facilities rather than claiming undocumented SDK methods.

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

Prerequisites and project creation

  • JDK 17 or later for the Spring getting-started guide.
  • Gradle 7.5 or later or Maven 3.5 or later, as stated by that guide.
  • An IDE and a Spring Boot version selected deliberately in Spring Initializr. The Spring quickstart recommends BellSoft Liberica JDK 17 or 21.
  • An account and API key for the screenshot provider you select.

Generate a Web project with Spring Initializr. Choose Maven or Gradle, select Java, and confirm that the generated build uses the JDK installed on your machine. The Spring guide estimates about 15 minutes for its own walkthrough; that is not a screenshot-service performance measurement.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Dependencies

For a Maven project, select the Spring Web starter. A current Spring Boot release normally supplies RestClient (Spring Framework 6.1+) or you can use WebClient. If your selected release does not include RestClient, use the provider’s documented Java SDK or the HTTP client available in that release instead of copying this exact class.

The provider’s SDK listing advertises a Java SDK for Spring Boot, Jakarta EE, and Android with the coordinate org.screenshot-api:screenshot-api:1.0.0. Coordinates and versions are volatile: check the provider’s current SDK page and artifact repository before adding it. The listing does not establish current method names, request builders, or response classes, so those details should not be invented in a production tutorial.

Keep the API key on the server

Put the key in an environment-backed property, not in a template, mobile bundle, browser URL, or committed source file.

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.
SCREENSHOT_API_KEY=replace-with-your-key

In application.yml:

screen-shot:
  base-url: https://provider.example
  api-key: ${SCREENSHOT_API_KEY}
  timeout-seconds: 60

Replace the base URL with the provider’s current API host. Do not log the key or include it in exception messages. In production, use your deployment platform’s secret store and rotate the key if it is exposed.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Choose an integration route

Route Advantages What to verify
ScreenshotNeo Clean shots, only clean shots billed, an MCP server for AI agents, and a $5 paid entry plan. Use its documented request parameters and response headers.
Provider Java SDK Typed request objects, dependency-managed authentication, and less HTTP plumbing when the SDK tracks the API. Current artifact version, Spring compatibility, method signatures, supported capture options, and response type.
Direct REST Full control over headers, timeouts, retries, serialization, and error handling; no SDK dependency. Endpoint host, authorization scheme, JSON field names, content type, and whether success is image bytes, a URL, or another JSON document.

Screenshot API’s documentation describes its service as “a simple REST API for capturing website screenshots.” The separate ScreenshotEngine search result describes a bearer-token POST flow; do not apply that authentication pattern to Screenshot API without checking its own documentation.

Direct REST integration with Spring Boot

The provider’s documented request body contains a URL, viewport, image format, and fullPage. The following example sends those fields and preserves the raw response so your application can handle either binary image data or a JSON result without assuming which contract your account receives.

Configuration properties

package com.example.capture;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "screen-shot")
public record ScreenshotProperties(
        String baseUrl,
        String apiKey,
        long timeoutSeconds) {}

Enable this record in your application class:

@SpringBootApplication
@EnableConfigurationProperties(ScreenshotProperties.class)
public class CaptureApplication {
    public static void main(String[] args) {
        SpringApplication.run(CaptureApplication.class, args);
    }
}

HTTP client and service

package com.example.capture;

import java.net.URI;
import java.time.Duration;
import java.util.Map;

import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClient;

@Service
public class ScreenshotClient {
    private final RestClient client;

    public ScreenshotClient(RestClient.Builder builder, ScreenshotProperties props) {
        this.client = builder
                .baseUrl(props.baseUrl())
                .defaultHeader(HttpHeaders.AUTHORIZATION, "Bearer " + props.apiKey())
                .requestFactory(factory -> {
                    factory.setConnectTimeout(Duration.ofSeconds(props.timeoutSeconds()));
                    factory.setReadTimeout(Duration.ofSeconds(props.timeoutSeconds()));
                })
                .build();
    }

    public ResponseEntity capture(URI target, int width, int height,
                                          String format, boolean fullPage) {
        Map<String, Object> body = Map.of(
                "url", target.toString(),
                "viewport", Map.of("width", width, "height", height),
                "imageFormat", format,
                "fullPage", fullPage);

        return client.post()
                .uri("/api/v1/screenshot")
                .contentType(MediaType.APPLICATION_JSON)
                .body(body)
                .retrieve()
                .toEntity(byte[].class);
    }
}

This class demonstrates real request construction, but the provider’s documentation excerpt does not establish whether a successful response is an image, a JSON object containing a screenshot URL, or another representation. Before exposing this method unchanged, inspect the current response schema and set the expected Accept header and Java return type accordingly. If success is JSON, deserialize it to a record; if it is an image, validate the returned content type before streaming bytes.

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

Controller with validation

package com.example.capture;

import java.net.URI;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ScreenshotController {
    private final ScreenshotClient screenshots;

    public ScreenshotController(ScreenshotClient screenshots) {
        this.screenshots = screenshots;
    }

    @GetMapping("/internal/screenshot")
    public ResponseEntity<byte[]> screenshot(
            @RequestParam String url,
            @RequestParam(defaultValue = "1366") int width,
            @RequestParam(defaultValue = "768") int height,
            @RequestParam(defaultValue = "png") String format,
            @RequestParam(defaultValue = "false") boolean fullPage) {

        URI target = URI.create(url);
        if (!"https".equalsIgnoreCase(target.getScheme())) {
            throw new IllegalArgumentException("Only HTTPS target URLs are allowed");
        }
        if (width < 320 || width > 5000 || height < 200 || height > 5000) {
            throw new IllegalArgumentException("Viewport is outside the permitted range");
        }
        if (!(format.equalsIgnoreCase("png") || format.equalsIgnoreCase("jpeg")
                || format.equalsIgnoreCase("webp"))) {
            throw new IllegalArgumentException("Unsupported image format");
        }
        return screenshots.capture(target, width, height, format, fullPage);
    }
}

Do not publish an unrestricted proxy like this on the public internet. Add authentication, rate limiting, an allow-list of domains, maximum response sizes, and SSRF protections. Resolve hostnames carefully and block loopback, link-local, private, and metadata-service addresses if users can submit arbitrary URLs. Map provider 4xx responses to a client error, provider 5xx and timeout responses to a retryable error, and avoid returning upstream secrets.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Request options that matter

Target URL

Require an absolute URL and decide whether redirects are allowed. A redirect can leave your approved domain, so validate the final destination when your security model requires it.

Viewport

Width and height determine responsive layout. Keep a small set of permitted presets for predictable output, and reject extreme dimensions that consume excessive memory.

Image format

PNG is lossless and useful for UI text; JPEG is smaller for photographic pages; WebP can reduce transfer size when every consumer supports it. Confirm the provider’s accepted spelling and returned media type.

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

Full-page mode

fullPage: true asks the provider to capture beyond the initial viewport. Long pages may take longer and produce larger responses. Lazy-loaded content may require provider-specific waiting options; do not assume it is loaded merely because full-page mode is enabled.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Handling responses and failures

Inspect status, Content-Type, and body size before processing. A binary response should be streamed or bounded; a JSON response should be parsed against the provider’s current schema. Preserve the upstream request ID, if supplied, in structured logs, but never log the API key or full sensitive target URL.

Common errors

  • 401 or 403: the key is missing, expired, or sent with the wrong authorization scheme. Recheck the server property and the provider’s header requirement.
  • 400: a field name, format, viewport, or URL is invalid. Compare the serialized JSON with the current API example.
  • 404: the base host or path is stale. Verify the current endpoint rather than adding a guessed version segment.
  • 429: apply bounded exponential backoff only for safe retries and respect any provider retry-after value.
  • 5xx or timeout: use a finite connect/read timeout, return a controlled 502/504, and retry sparingly to avoid duplicate work.
  • Blank or incomplete capture: the target may require JavaScript, authentication, consent handling, or a longer wait. Use provider-supported wait controls and test the page independently.
  • Out-of-memory or oversized output: lower the viewport, avoid unbounded full-page requests, cap response bytes, and queue large jobs.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Testing and operating the endpoint

  1. Start the application with ./gradlew bootRun on macOS or Linux, or use your Maven wrapper’s run goal.
  2. Call the internal endpoint with a known HTTPS page and a small viewport.
  3. Record status, content type, elapsed time, and response size; do not call these measurements provider benchmarks.
  4. Test invalid schemes, private addresses, oversized dimensions, unsupported formats, expired keys, provider timeouts, and rate limits.
  5. Add integration tests with a mocked upstream server so CI never depends on a live screenshot account.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. AI agents can use its take_screenshot, get_page_info, and capture_pdf MCP tools.

One GET request is enough:

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

Java developers can call the same endpoint with RestClient; the response is the returned image or PDF bytes according to the request and headers:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
RestClient client = RestClient.create();
byte[] file = client.get()
    .uri(uriBuilder -> uriBuilder
        .scheme("https")
        .host("api.screenshotneo.com")
        .path("/v1/shot")
        .queryParam("access_key", "YOUR_API_KEY")
        .queryParam("url", "https://stripe.com")
        .build())
    .retrieve()
    .body(byte[].class);

See the ScreenshotNeo documentation for the full option set, including full-page capture, CSS selectors, dark mode, device presets, retina scale, PDF settings, custom CSS and JavaScript, clicks, waits, request blocking, cookies, headers, geolocation, caching, signed links, asynchronous jobs, bulk capture, and usage reporting.

Equivalent Python and Node.js calls

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo’s Free plan includes 1,000 shots per month without a card. Paid plans are Starter $5 for 3,000, Growth $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000, and Business $249 for 1,000,000; yearly billing gives two months free, and every feature is on every plan. Sign up free to try it without a card.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

FAQ

Should I use the SDK or REST?

Use the SDK when its current release documents the options and response classes your application needs. Choose REST when you need exact control or want to avoid SDK upgrade coupling.

Can I put the provider key in a front-end request?

No. Browser-visible code and URLs expose credentials. Send the request through your Spring server or another trusted backend.

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

Is the sample controller production-ready?

No. It demonstrates request shape and validation boundaries. Add authentication, SSRF defenses, rate limits, bounded responses, structured error mapping, and tests before exposing it publicly.

Why does the Java example not deserialize a screenshot URL?

The available provider excerpt shows a JavaScript example logging screenshotUrl but does not establish the exact Java response contract. Confirm whether your endpoint returns bytes, JSON, or a URL before choosing the final type.

Frequently Asked Questions

Which Java version should I select in Spring Initializr?

The cited Spring guide requires Java 17 or later; match that requirement to the Spring Boot release you actually select.

Does full-page capture guarantee lazy-loaded images?

No. Full-page behavior and lazy-loading support are provider-specific; use documented wait or scrolling options and verify the resulting image.

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.

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.