DEVELOPERS

Documentation

Integrate IP lookups and country controls into your application.

Java SDK: source build and lookup

Java 17 and Maven. Build the extracted pom.xml with mvn package and include the module/source and its declared Jackson dependency in your application. This is not a Maven Central release.

Download source archive

import ooo.orig.Origooo;
import java.time.Duration;
var client = new Origooo(System.getenv("ORIGOOO_API_KEY"),
    "https://orig.ooo", Duration.ofSeconds(2), Duration.ofMinutes(5));
try {
    var result = client.lookup("8.8.8.8");
    String country = result.countryCode();
} catch (Origooo.ApiException error) {
    int status = error.status;
    // Apply your fallback.
}

Also handle IOException and InterruptedException, preserving thread interruption. Location has ip, countryCode, city and sourceId. Compilation and application integration still require validation in your Java environment.

Coverage, caching and failures

The source SDKs expose single-IP lookup and country-policy helpers. Use direct HTTP for batch, ASN, comparisons and metadata. A 404 becomes an empty country result. A 429 surfaces as an exception; handle it with bounded backoff in your application. Local SDK cache hits make no HTTP request. API-side cache hits remain billable.

Set the API origin explicitly to https://orig.ooo. Resolve a visitor IP using your configured trusted-proxy rules; a backend /v1/ip/me request identifies the backend server.

Apply a country policy

The following code belongs before protected content. It uses the actual client/policy interfaces in the downloadable SDK. The full guide includes installation assumptions, proxy handling and unknown-country behaviour.

import ooo.orig.Origooo;
import java.time.Duration;
import java.util.Set;

var client = new Origooo(System.getenv("ORIGOOO_API_KEY"),
    "https://orig.ooo", Duration.ofSeconds(2), Duration.ofMinutes(5));
var policy = new Origooo.Policy(Set.of(), Set.of("US", "GB"), "deny");

// In your Servlet/Spring filter before invoking the next handler:
String country = null;
try {
    // Resolve visitorIp with the SDK's configured proxy-chain helper.
    country = client.lookup(visitorIp).countryCode();
} catch (InterruptedException error) {
    Thread.currentThread().interrupt();
} catch (java.io.IOException | IllegalArgumentException error) {
    // Leave country unknown; the configured policy decides.
}
if (!policy.decide(country).equals("allow")) {
    response.setStatus(403);
    return;
}
chain.doFilter(request, response);

Full java country-blocking guide →

YOUR NEXT BUILD STARTS HERE

Get your free API key.

1,000 monthly credits. No credit card required.

Account services are not connected in this preview. Explore the dashboard or download the implementation from your workspace.
Read the integration guide

Production accounts require verified email. Google OAuth and Paddle need deployment credentials.