Web Scraping API for Java
Integrate AlterLab's web scraping API into Java applications using HttpClient (Java 11+), OkHttp, or Apache HttpComponents. Works in Spring Boot services, Quarkus, and standalone JVM applications.
Quick Start
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class AlterLabExample {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String body = """
{"url": "https://example.com"}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://alterlab.io/api/v1/scrape"))
.header("X-API-Key", "YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Need an API key? Sign up free — no credit card required.
How It Works
Send a URL
POST any public URL to the AlterLab API with your API key. The API handles JavaScript rendering and access automatically.
Receive structured data
The API returns clean JSON with page content, metadata, and any structured fields you requested via an extraction schema.
Use in your project
Integrate the response into your Java application, database, or workflow. No scraper maintenance required.
Common Use Cases
Frequently Asked Questions
Explore All Integrations
View all SDK and tool integrations on the Integrations overview.
Responsible Use
AlterLab is designed for extracting publicly available data. Always review the terms of service for any website you access, respect robots.txt directives, and ensure your use case complies with applicable laws in your jurisdiction.
Your first scrape.
Sixty seconds.
$1 free balance. No credit card. No SDK.
Just a POST request.
No credit card required · Up to 5,000 free scrapes · Balance never expire