Website Screenshots in Java — Spring Boot Ready
Capture any website screenshot from Java using the built-in HttpClient or OkHttp. Works with Spring Boot, Quarkus, and plain Java 11+. No Selenium needed.
import com.fasterxml.jackson.databind.ObjectMapper;
import java.net.URI;
import java.net.http.*;
import java.util.Map;
// Spring Boot Service
@Service
public class ScreenshotService {
@Value("${goscreenapi.key}")
private String apiKey;
private final HttpClient client = HttpClient.newHttpClient();
private final ObjectMapper mapper = new ObjectMapper();
public String capture(String url) throws Exception {
var payload = Map.of(
"url", url,
"full_page", true,
"format", "png",
"block_ads", true
);
var request = HttpRequest.newBuilder()
.uri(URI.create("https://goscreenapi.com/api/v1/screenshot"))
.header("X-API-Key", apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(mapper.writeValueAsString(payload)))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
var result = mapper.readValue(response.body(), Map.class);
return (String) result.get("image_url");
// => "https://cdn.goscreenapi.com/screenshots/abc123.png"
}
}
Everything you need.
Nothing you don't.
Java 11+ HttpClient
Uses the built-in java.net.http.HttpClient — no extra Maven dependencies.
Spring Boot Integration
Inject as a @Service with @Value for API key. Works with RestTemplate and WebClient too.
Async CompletableFuture
Use client.sendAsync() for non-blocking screenshot calls in reactive Spring apps.
OkHttp Support
Works with OkHttp, Apache HttpClient, or any Java HTTP library.
Full-Page & PDF
full_page: true for scrollable pages, format: "pdf" for PDF output.
No Selenium WebDriver
No WebDriver, no chromedriver, no browser automation setup.
Built for real workflows
From solo developers to enterprise teams — GoScreenAPI fits into any stack.
Spring Boot Microservices
Screenshot service as a Spring @Service — inject anywhere in your application.
Quarkus & Jakarta EE
Works with any Java framework that supports HTTP calls.
PDF Report Generation
Generate PDF reports from dashboard URLs without iText or Apache PDFBox.
Scheduled Monitoring
Use @Scheduled in Spring Boot to capture screenshots on a cron schedule.
| Parameter | Type | Description |
|---|---|---|
url |
String | Target URL to capture (required) |
full_page |
boolean | Capture entire scrollable page |
format |
String | png | jpeg | webp | pdf |
selector |
String | CSS selector — capture one element |
block_ads |
boolean | Remove ads and cookie banners |
device |
String | desktop | mobile | tablet |
async |
boolean | Background processing with webhook |
webhook_url |
String | POST callback URL for async results |
Speed. Scale. Simplicity.
Sync mode results in under 3 seconds for most pages.
Production-grade reliability with redundant infrastructure.
Handle high-volume workloads without throttling.
Common questions
Start building with GoScreenAPI
250 free screenshots every month. No credit card required. Production-ready in minutes.
Fast Screenshot API Overview
The screenshot API offers a powerful means for developers to capture any URL as an image format like PNG, JPEG, or WebP via a REST interface. Remarkably, the response time is typically under three seconds. With this tool, you can specify custom viewport dimensions, full-page capture, retina 2x resolution, and even enable dark mode effortlessly.
Interested in trying it out? The API provides 250 free credits each month, perfect for testing and integration. With over 2000 developers relying on it, this free screenshot tool is rapidly becoming a developer favorite.
Features and Customization
Our screenshot API enables extensive customization options for your website screenshot needs. You can capture full pages or specific sections by setting your preferred viewport size. Additionally, our full page capture capability ensures you do not miss any vital content on the target page.
Besides capturing the standard view, you can opt for retina 2x resolution for higher clarity or transform the page display with dark mode. These features make the API versatile for capturing various display scenarios programmatically.
Efficient REST API Usage
Using the REST API screenshot capability, developers can convert any URL to an image with simple HTTP requests. The API is designed for ease of use, providing rapid responses in less than three seconds and supporting multiple image formats.
You can perform HTML to image conversion efficiently, thanks to our streamlined endpoint architecture. The HTML to image conversion page offers further insights into the API's functionality.
Getting Started with 250 Free Credits
New users can leverage 250 free credits each month to test and integrate the screenshot API into their workflows. This allocation empowers developers to explore different API features without initial costs, facilitating seamless incorporation into projects.
The simple setup process and comprehensive documentation make it easy to get started. Join the community of over 2000 developers who are already reaping the benefits of this programmatic screenshot solution.
FAQ
What image formats are supported?
The screenshot API supports PNG, JPEG, and WebP formats, allowing flexibility in choosing the best format for your use case.
How do I enable dark mode?
Dark mode can be activated by setting a specific parameter in your API request, allowing you to capture a website in an alternate color scheme.
What is the maximum capture resolution supported?
The API supports retina 2x resolution, ensuring high-quality images that are suitable for detailed analysis and presentations.
How quickly can I expect a response?
The API typically delivers responses in under three seconds, making it one of the fastest options available for capturing website screenshots via REST.
Ready to capture your first website screenshot? Start using the screenshot API today and transform the way you work with web images.