Docs

Verify emails from Java

A working helper that verifies one address from Java. ValidReach does not publish an official SDK for this language. The examples call the REST API directly, which is the supported way to integrate.

Before you start

Create an API key under Settings → API keys and keep it in an environment variable named VALIDREACH_API_KEY on your server. Never ship it in browser or mobile code.

Verify one address

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Validreach {
    private static final HttpClient CLIENT = HttpClient.newHttpClient();

    public static String verify(String email) throws Exception {
        String json = "{\"email\":\"" + email.replace("\"", "") + "\"}";
        HttpRequest req = HttpRequest.newBuilder(
                URI.create("https://validreach.dev/api/v1/verify/single"))
            .header("Authorization", "Bearer " + System.getenv("VALIDREACH_API_KEY"))
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(json))
            .build();
        HttpResponse<String> res =
            CLIENT.send(req, HttpResponse.BodyHandlers.ofString());
        if (res.statusCode() == 402) throw new IllegalStateException("Out of credits");
        if (res.statusCode() == 429) throw new IllegalStateException("Rate limited");
        return res.body(); // parse the JSON with your preferred library
    }
}

Handle the result

Branch on data.status. Treat invalid and disposable as rejections, retry unknown later when retryable is true (unknown is not billed), and decide on catchall, risky and role by your own policy. HTTP 402 means out of credits and 429 means rate limited.