IPGeolocation.io API Java SDK


Overview

The official Java SDK provides streamlined access to IPGeolocation.io, a comprehensive platform offering RESTful IP-based APIs and downloadable databases delivering precise Geolocation, Network, Timezone, Currency, Abuse Contacts, ASN, and Company/ISP details for IPv4 and IPv6 addresses and User-Agent string parsing.

With built-in support for VPN, proxy, TOR detection, and threat detection (via the IPGeolocation's Security API for threat intelligence), this SDK also enables developers to integrate threat intelligence, personalization, fraud prevention, compliance, and analytics features into Java applications.

Whether you're enriching signup forms with ip geolocation data, localizing content, embedding threat intelligence in back-end systems, or converting time zones and currencies, the SDK ensures seamless, scalable integration with IPGeolocation.io’s global API infrastructure.

Based on:

  • API version: 2.0

Official Release:


Requirements

  • Java: 1.8 or higher
  • Build Tools: Maven 3.8.3+ or Gradle 7.2+
  • API Key: Sign up IPGeolocation.io

Installation


1.Using Maven

Add the following dependency to your pom.xml file located at :

<dependency>
  <groupId>io.ipgeolocation</groupId>
  <artifactId>ipgeolocation</artifactId>
  <version>2.0.1</version>
</dependency>

2.Using Gradle

Add this to your build.gradle file:

repositories {
    mavenCentral()
    mavenLocal() // Only needed if using locally built version
}

dependencies {
    implementation "io.ipgeolocation:ipgeolocation:2.0.1"
}

3.Manual Installation

To build the SDK manually:

mvn clean package

Then include the following JARs in your classpath:

  • target/ipgeolocation-sdk-java-2.0.1.jar
  • All JARs in target/lib/

API Plan Tiers and Documentation

The documentation below corresponds to the four available API tier plans:

For a detailed comparison of what each plan offers, visit the Pricing Page.


API Endpoints

All URIs are relative to https://api.ipgeolocation.io/v2

ClassMethodHTTP requestDescription
IPGeolocationAPIgetIPGeolocationGET /ipgeoGet geolocation data for a single IP address
IPGeolocationAPIgetBulkIPGeolocationPOST /ipgeo-bulkGet geolocation data for multiple IP addresses in a single API request
IPSecurityAPIgetIPSecurityGET /securityRetrieve security information (VPN, TOR, proxy, etc.) for a single IP
IPSecurityAPIgetBulkIPSecurityPOST /security-bulkRetrieve security threat intelligence for multiple IPs
ASNLookupAPIgetAsnDetailsGET /asnGet details of any AS number or associated IP address
AbuseContactAPIgetAbuseContactInfoGET /abuseRetrieve abuse reporting contact information for a given IP address
AstronomyAPIgetAstronomyGET /astronomyGet sunrise, sunset, moonrise, moonset, and related data for a location
TimezoneAPIgetTimezoneGET /timezoneGet timezone information details
TimeConversionAPIconvertTimezoneGET /timezone/convertConvert time between two specified timezones
UserAgentAPIgetUserAgentGET /user-agentGet details of user-agent
UserAgentAPIgetBulkUserAgentPOST /user-agent-bulkHandle multiple user-agent string lookups
UserAgentAPIgetUserAgentOfCustomStringPOST /user-agentHandle single User-Agent string

Fields and Methods Availability

IP Geolocation offers four plans from billing point of view: Free, Standard, Security, Advance. The availability of each method calling from the respective class, over all plans are presented below.

ClassMethodFreeStandardSecurityAdvance
IPGeolocationAPIgetIPGeolocationTickTickCrossTick
IPGeolocationAPIgetBulkIPGeolocationCrossTickCrossTick
IPSecurityAPIgetIPSecurityCrossCrossTickCross
IPSecurityAPIgetBulkIPSecurityCrossCrossTickCross
ASNLookupAPIgetAsnDetailsCrossCrossCrossTick
AbuseContactAPIgetAbuseContactInfoCrossCrossCrossTick
AstronomyAPIgetAstronomyTickTickTickTick
TimezoneAPIgetTimezoneTickTickTickTick
TimeConversionAPIconvertTimezoneTickTickTickTick
UserAgentAPIgetUserAgentTickTickTickTick
UserAgentAPIgetBulkUserAgentCrossTickTickTick
UserAgentAPIgetUserAgentOfCustomStringCrossTickTickTick
Tip

The availability of fields in every API endpoint across all API plans is provided in the Reference Table within each respective API Documentation. e.g., for IPGeolocationApi, please visit https://ipgeolocation.io/ip-location-api.html#reference-to-ipgeolocation-api-response.


Authentication Setup

To authenticate API requests, you need an API key from ipgeolocation.io.


1.How to Get Your API Key

  1. Sign up here: https://app.ipgeolocation.io/signup
  2. (optional) Verify your email, if you signed up using email.
  3. Log in to your account: https://app.ipgeolocation.io/login
  4. After logging in, navigate to your Dashboard to find your API key: https://app.ipgeolocation.io/dashboard

2.Setup API Key

Once you've obtained the api key, configure your API client as follows:

import invoker.io.ipgeolocation.sdk.ApiClient;
import invoker.io.ipgeolocation.sdk.Configuration;
import auth.invoker.io.ipgeolocation.sdk.ApiKeyAuth;

ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.ipgeolocation.io/v2");

ApiKeyAuth apiKeyAuth = (ApiKeyAuth) client.getAuthentication("ApiKeyAuth");
apiKeyAuth.setApiKey("YOUR_API_KEY_HERE");
Important

Ensure that your API key is securely stored and not exposed in public repositories.


IP Geolocation Examples

This section provides usage examples of the getIPGeolocation() method from the SDK across Free, Standard, and Advanced subscription tiers. Each example highlights different combinations of parameters: fields , include , and excludes .

Parameters

  • fields : Use this parameter to include specific fields in the response.
  • excludes : Use this parameter to omit specific fields from the response.
  • include : Use this parameter to add optional modules to the response, such as:
    • security
    • user_agent
    • hostname
    • liveHostname
    • hostnameFallbackLive
    • abuse
    • dma
    • time_zone

For complete details, refer to the official documentation: IP Geolocation API Documentation

The ip parameter in the SDK can accept any valid IPv4 address, IPv6 address, or domain name. If the ip() method is not used or the parameter is omitted, the API will return information about the public IP address of the device or server where the SDK is executed.


1.Developer Plan Examples

I.Get Default Fields

import io.ipgeolocation.sdk.api.IPGeolocationAPI;
import io.ipgeolocation.sdk.model.GeolocationResponse;

IPGeolocationAPI api = new IPGeolocationAPI(client);
GeolocationResponse response = api.getIPGeolocation()
        .ip("8.8.8.8")
        .execute();

System.out.println(response);

Sample Response:

Response
1class GeolocationResponse {
2    ip: 8.8.8.8
3    location: class Location {
4        continentCode: NA
5        continentName: North America
6        countryCode2: US
7        countryCode3: USA
8        countryName: United States
9        countryNameOfficial: United States of America
10        countryCapital: Washington, D.C.
11        stateProv: California
12        stateCode: US-CA
13        district: Santa Clara
14        city: Mountain View
15        zipcode: 94043-1351
16        latitude: 37.42240
17        longitude: -122.08421
18        isEu: false
19        countryFlag: https://ipgeolocation.io/static/flags/us_64.png
20        geonameId: 6301403
21        countryEmoji: 🇺🇸
22    }
23    countryMetadata: class CountryMetadata {
24        callingCode: +1
25        tld: .us
26        languages: [en-US, es-US, haw, fr]
27    }
28    currency: class Currency {
29        code: USD
30        name: US Dollar
31        symbol: $
32    }
33}

Filtering Specific Fields from the Response (Use of 'exclude' and 'fields')

GeolocationResponse response = api.getIPGeolocation()
    .ip("8.8.4.4")
    .fields("location")
    .excludes("location.continent_code,location.continent_name")
    .execute();

System.out.println(response);

Sample Response

Response
1class GeolocationResponse {
2    ip: 8.8.4.4
3    location: class Location {
4        countryCode2: US
5        countryCode3: USA
6        countryName: United States
7        countryNameOfficial: United States of America
8        countryCapital: Washington, D.C.
9        stateProv: California
10        stateCode: US-CA
11        district: Santa Clara
12        city: Mountain View
13        zipcode: 94043-1351
14        latitude: 37.42240
15        longitude: -122.08421
16        isEu: false
17        countryFlag: https://ipgeolocation.io/static/flags/us_64.png
18        geonameId: 6301403
19        countryEmoji: 🇺🇸
20    }
21}

2.Standard Plan Examples

I.Get Default Fields

import io.ipgeolocation.sdk.api.IPGeolocationAPI;
import io.ipgeolocation.sdk.model.GeolocationResponse;

IPGeolocationAPI api = new IPGeolocationAPI(client);
GeolocationResponse response = api.getIPGeolocation()
        .ip("8.8.8.8")
        .execute();

System.out.println(response);

Sample Response:

Response
1class GeolocationResponse {
2    ip: 8.8.8.8
3    location: class Location {
4        continentCode: NA
5        continentName: North America
6        countryCode2: US
7        countryCode3: USA
8        countryName: United States
9        countryNameOfficial: United States of America
10        countryCapital: Washington, D.C.
11        stateProv: California
12        stateCode: US-CA
13        district: Santa Clara
14        city: Mountain View
15        zipcode: 94043-1351
16        latitude: 37.42240
17        longitude: -122.08421
18        isEu: false
19        countryFlag: https://ipgeolocation.io/static/flags/us_64.png
20        geonameId: 6301403
21        countryEmoji: 🇺🇸
22    }
23    countryMetadata: class CountryMetadata {
24        callingCode: +1
25        tld: .us
26        languages: [en-US, es-US, haw, fr]
27    }
28    network: class Network {
29        asn: class NetworkAsn {
30            asNumber: AS15169
31            organization: Google LLC
32            country: US
33        }
34        company: class NetworkCompany {
35            name: Google LLC
36        }
37    }
38    currency: class Currency {
39        code: USD
40        name: US Dollar
41        symbol: $
42    }
43}

II.Retrieving Geolocation Data in Multiple Languages

Here is an example to get the geolocation data for IP address '2001:4230:4890::1' in French language:

IPGeolocationAPI api = new IPGeolocationAPI(client);
GeolocationResponse response = api.getIPGeolocation()
        .ip("2001:4230:4890::1")
        .lang("fr")
        .execute();

System.out.println(response);

Sample Response

Response
1class GeolocationResponse {
2    ip: 2001:4230:4890:0:0:0:0:1
3    location: class Location {
4        continentCode: AF
5        continentName: Afrique
6        countryCode2: MU
7        countryCode3: MUS
8        countryName: Maurice
9        countryNameOfficial:
10        countryCapital: Port Louis
11        stateProv: Wilhems des plaines
12        stateCode: MU-PW
13        district: Quatre Bornes
14        city: Quatre Bornes
15        zipcode: 72201
16        latitude: -20.24304
17        longitude: 57.49631
18        isEu: false
19        countryFlag: https://ipgeolocation.io/static/flags/mu_64.png
20        geonameId: 1106777
21        countryEmoji: 🇲🇺
22    }
23    countryMetadata: class CountryMetadata {
24        callingCode: +230
25        tld: .mu
26        languages: [en-MU, bho, fr]
27    }
28    network: class Network {
29        asn: class NetworkAsn {
30            asNumber: AS0
31            organization:
32            country:
33        }
34        company: class NetworkCompany {
35            name: African Network Information Center AfriNIC Ltd
36        }
37    }
38    currency: class Currency {
39        code: MUR
40        name: Mauritius Rupee
41        symbol:42    }
43}

III.Include HostName, Timezone and User-Agent

IPGeolocationAPI api = new IPGeolocationAPI(client);
GeolocationResponse response = api.getIPGeolocation()
        .ip("4.5.6.7")
        .fields("location.country_name,location.country_capital")
        .include("user_agent, time_zone, hostnameFallbackLive")
        .execute();

System.out.println(response);

Sample Response

Response
1class GeolocationResponse {
2    ip: 4.5.6.7
3    hostname: 4.5.6.7
4    location: class Location {
5        countryName: United States
6        countryCapital: Washington, D.C.
7    }
8    timeZone: class TimeZone {
9        name: America/Chicago
10        offset: -6
11        offsetWithDst: -5
12        currentTime: 2025-05-28 06:52:16.748-0500
13        currentTimeUnix: 1748433136.748
14        isDst: true
15        dstSavings: 1
16        dstExists: true
17        dstStart: class TimeZoneDstStart {
18            utcTime: 2025-03-09 TIME 08
19            duration: +1H
20            gap: true
21            dateTimeAfter: 2025-03-09 TIME 03
22            dateTimeBefore: 2025-03-09 TIME 02
23            overlap: false
24        }
25        dstEnd: class TimeZoneDstEnd {
26            utcTime: 2025-11-02 TIME 07
27            duration: -1H
28            gap: false
29            dateTimeAfter: 2025-11-02 TIME 01
30            dateTimeBefore: 2025-11-02 TIME 02
31            overlap: true
32        }
33    }
34    userAgent: class UserAgentData {
35        userAgentString: IPGeolocation/2.0.0/java
36        name: IPGeolocation Java SDK
37        type: Special
38        version: 2.0.0
39        versionMajor: 1
40        device: class UserAgentDataDevice {
41            name: Unknown
42            type: Unknown
43            brand: Unknown
44            cpu: Unknown
45        }
46        engine: class UserAgentDataEngine {
47            name: Unknown
48            type: Unknown
49            version: ??
50            versionMajor: ??
51        }
52        operatingSystem: class UserAgentDataOperatingSystem {
53            name: Unknown
54            type: Unknown
55            version: ??
56            versionMajor: ??
57            build: ??
58        }
59    }
60}
Note

The IP Geolocation API supports hostname lookup for all paid subscriptions. However, this is not included by default. To enable hostname resolution, use the include parameter with one of the following options:

  • hostname : Performs a quick lookup using the internal hostname database. If no match is found, the IP is returned as-is. This is fast but may produce incomplete results.
  • liveHostname : Queries live sources for accurate hostname resolution. This may increase response time.
  • hostnameFallbackLive : Attempts the internal database first, and falls back to live sources if no result is found. This option provides a balance of speed and reliability.

3.Advanced Plan Examples

I.Include DMA, Abuse and Security

import io.ipgeolocation.sdk.api.IPGeolocationAPI;
import io.ipgeolocation.sdk.model.GeolocationResponse;

IPGeolocationAPI api = new IPGeolocationAPI(client);
GeolocationResponse response = api.getIPGeolocation()
        .ip("8.8.8.8")
        .excludes("location.country_flag,location.country_emoji")
        .include("dma,abuse,security")
        .execute();

System.out.println(response);

Sample Response:

Response
1class GeolocationResponse {
2    ip: 8.8.8.8
3    location: class Location {
4        continentCode: NA
5        continentName: North America
6        countryCode2: US
7        countryCode3: USA
8        countryName: United States
9        countryNameOfficial: United States of America
10        countryCapital: Washington, D.C.
11        stateProv: California
12        stateCode: US-CA
13        district: Santa Clara
14        city: Mountain View
15        zipcode: 94043-1351
16        latitude: 37.42240
17        longitude: -122.08421
18        isEu: false
19        countryFlag: null
20        geonameId: 6301403
21        countryEmoji: null
22        accuracyRadius:
23        locality: Mountain View
24        dmaCode: 807
25    }
26    countryMetadata: class CountryMetadata {
27        callingCode: +1
28        tld: .us
29        languages: [en-US, es-US, haw, fr]
30    }
31    network: class Network {
32        asn: class NetworkAsn {
33            asNumber: AS15169
34            organization: Google LLC
35            country: US
36            asnName: GOOGLE
37            type: BUSINESS
38            domain: about.google
39            dateAllocated:
40            allocationStatus: assigned
41            numOfIpv4Routes: 965
42            numOfIpv6Routes: 104
43            rir: ARIN
44        }
45        connectionType:
46        company: class NetworkCompany {
47            name: Google LLC
48            type: Business
49            domain: googlellc.com
50        }
51    }
52    currency: class Currency {
53        code: USD
54        name: US Dollar
55        symbol: $
56    }
57    security: class Security {
58        threatScore: 0
59        isTor: false
60        isProxy: false
61        proxyType:
62        proxyProvider:
63        isAnonymous: false
64        isKnownAttacker: false
65        isSpam: false
66        isBot: false
67        isCloudProvider: false
68        cloudProvider:
69    }
70    abuse: class Abuse {
71        route: 8.8.8.0/24
72        country:
73        handle: ABUSE5250-ARIN
74        name: Abuse
75        organization: Abuse
76        role: abuse
77        kind: group
78        address: 1600 Amphitheatre Parkway
79        Mountain View
80        CA
81        94043
82        United States
83        emails: [network-abuse@google.com]
84        phoneNumbers: [+1-650-253-0000]
85    }
86}

These examples demonstrate typical usage of the IP Geolocation API with different subscription tiers. Use fields to specify exactly which data to receive, include for optional data like security and user agent, and excludes to omit specific keys from the response.

Note

All features available in the Free plan are also included in the Standard and Advanced plans. Similarly, all features of the Standard plan are available in the Advanced plan.


4.Bulk IP Geolocation Example

The SDK also supports bulk IP geolocation requests using the getBulkIpGeolocation() method. All parameters like fields , include , and excludes can also be used in bulk requests.


import io.ipgeolocation.sdk.model.BulkIPRequest;
import io.ipgeolocation.sdk.api.IPGeolocationAPI;
import io.ipgeolocation.sdk.model.BulkGeolocationResponse;

IPGeolocationAPI api = new IPGeolocationAPI(client);

BulkIPRequest bulkRequest = new BulkIPRequest();
bulkRequest.addIp("8.8.8.8");
bulkRequest.addIp("1.1.1.1");

List<BulkGeolocationResponse> response = api.getBulkIPGeolocation()
        .bulkIpRequest(bulkRequest)
        .fields("location.country_name,location.city")
        .include("security,timezone")
        .excludes("location.continent_code")
        .execute();

System.out.println(response);

IP Security Examples

This section provides usage examples of the getIPSecurity() method from the SDK across various subscription tiers. Each example demonstrates different ways to query threat intelligence and risk metadata using parameters like fields, excludes, and optional modules.

For full API specifications, refer to the official IP Security API documentation.


1.Get Security only fields

import io.ipgeolocation.sdk.api.IPSecurityAPI;
import io.ipgeolocation.sdk.model.SecurityAPIResponse;

IPSecurityAPI api = new IPSecurityAPI(client);
SecurityAPIResponse response = api.getIPSecurity()
        .ip("2.56.188.34")
        .execute();

System.out.println(response);

Sample Response

Response
1class SecurityAPIResponse {
2    ip: 2.56.188.34
3    security: class Security {
4        threatScore: 80
5        isTor: false
6        isProxy: true
7        proxyType: VPN
8        proxyProvider: Nord VPN
9        isAnonymous: true
10        isKnownAttacker: true
11        isSpam: false
12        isBot: false
13        isCloudProvider: true
14        cloudProvider: Packethub S.A.
15    }
16}

2.Include Multiple Optional Fields

SecurityAPIResponse response = api.getIPSecurity()
    .ip("2.56.188.34")
    .include("location,network,currency,time_zone,user_agent,country_metadata,hostname")
    .execute();
Note

You can get all the available fields in standard plan in combination with security data, when subscribed to security plan.


3.Request with Field Filtering

SecurityAPIResponse response = api.getIPSecurity()
        .ip("195.154.221.54")
        .fields("security.is_tor,security.is_proxy,security.is_bot,security.is_spam")
        .execute();

System.out.println(response);

Sample Response

Response
1class SecurityAPIResponse {
2    ip: 195.154.221.54
3    security: class Security {
4        isTor: false
5        isProxy: true
6        isSpam: false
7        isBot: false
8    }
9}

4.Bulk IP Security Request

The SDK also supports bulk IP Security requests using the getBulkIPSecurity() method. All parameters like fields , include , and excludes can also be used in bulk requests.

import io.ipgeolocation.sdk.model.BulkSecurityResponse;
import io.ipgeolocation.sdk.model.BulkIPRequest;

BulkIPRequest bulkRequest = new BulkIPRequest();
bulkRequest.addIp("2.56.188.34");
bulkRequest.addIp("2.56.188.35");

List<BulkSecurityResponse> response = api.getBulkIPSecurity(bulkIPRequest)
        .include("location,network")
        .fields("security.threat_score,location.country_name")
        .execute();

System.out.println(response);

ASN API Examples

This section provides usage examples of the getAsnDetails() method from the SDK. These methods allow developers to retrieve detailed ASN-level network data either by ASN number or by IP address.

Note

ASN API is only available in the Advanced Plan.

Refer to the ASN API documentation for a detailed list of supported fields and behaviors.


1.Get ASN Information by IP Address

import io.ipgeolocation.sdk.api.AsnLookupAPI;
import io.ipgeolocation.sdk.api.AsnLookupApi;
import io.ipgeolocation.sdk.model.ASNResponse;

AsnLookupAPI api = new AsnLookupAPI(client);

ASNResponse response = api.getAsnDetails()
        .ip("8.8.8.8")
        .execute();

System.out.println(response);

Sample Response

Response
1class ASNResponse {
2    ip: 8.8.8.8
3    asn: class ASNDetails {
4        asNumber: AS15169
5        organization: Google LLC
6        country: US
7        asnName: GOOGLE
8        type: BUSINESS
9        domain: about.google
10        dateAllocated:
11        allocationStatus: assigned
12        numOfIpv4Routes: 983
13        numOfIpv6Routes: 104
14        rir: ARIN
15    }
16}

2.Get ASN Information by ASN Number

import io.ipgeolocation.sdk.model.ASNResponse;

ASNResponse response = api.getAsnDetails()
        .asn("AS15169")
        .execute();

System.out.println(response);

Sample Response

Response
1class ASNResponse {
2    asn: class ASNDetails {
3        asNumber: AS15169
4        organization: Google LLC
5        country: US
6        asnName: GOOGLE
7        type: BUSINESS
8        domain: about.google
9        dateAllocated:
10        allocationStatus: assigned
11        numOfIpv4Routes: 983
12        numOfIpv6Routes: 104
13        rir: ARIN
14    }
15}

3.Combine All objects using Include

import io.ipgeolocation.sdk.model.ASNResponse;

ASNResponse response = api.getAsnDetails()
        .asn("AS12")
        .include("peers,downstreams,upstreams,routes,whois_response")
        .execute();

System.out.println(response);

Sample Response

Response
1class ASNResponse {
2    ip: null
3    asn: class ASNDetails {
4        asNumber: AS12
5        organization: New York University
6        country: US
7        asnName: NYU-DOMAIN
8        type: EDUCATION
9        domain: nyu.edu
10        dateAllocated:
11        allocationStatus: assigned
12        numOfIpv4Routes: 11
13        numOfIpv6Routes: 1
14        rir: ARIN
15        routes: [192.76.177.0/24, 216.165.96.0/20, 216.165.89.0/24, 216.165.0.0/18, 216.165.112.0/21, 128.122.0.0/16, 2607:f600::/32, 216.165.102.0/24, 216.165.64.0/19, 216.165.120.0/22, 192.86.139.0/24, 216.165.103.0/24]
16        upstreams: [class ASNConnection {
17            asNumber: AS3269
18            description: Telecom Italia S.p.A.
19            country: IT
20        },
21        ...
22        class ASNConnection {
23            asNumber: AS137
24            description: Consortium GARR
25            country: IT
26        }]
27        downstreams: [class ASNConnection {
28            asNumber: AS394666
29            description: NYU Langone Health
30            country: US
31        }, class ASNConnection {
32            asNumber: AS54965
33            description: Polytechnic Institute of NYU
34            country: US
35        }]
36        peers: [class ASNConnection {
37            asNumber: AS3269
38            description: Telecom Italia S.p.A.
39            country: IT
40        },
41        ...
42        class ASNConnection {
43            asNumber: AS54965
44            description: Polytechnic Institute of NYU
45            country: US
46        }]
47        whoisResponse:
48
49        ASNumber:       12
50        ASName:         NYU-DOMAIN
51        ASHandle:       AS12
52        RegDate:        1984-07-05
53        Updated:        2023-05-25
54        Ref:            https://rdap.arin.net/registry/autnum/12
55        ...
56    }
57}

Abuse Contact API Examples

This section demonstrates how to use the getAbuseContactInfo() method of the AbuseContact API. This API helps security teams, hosting providers, and compliance professionals quickly identify the correct abuse reporting contacts for any IPv4 or IPv6 address. You can retrieve data like the responsible organization, role, contact emails, phone numbers, and address to take appropriate mitigation action against abusive or malicious activity.

Note

Abuse Contact API is only available in the Advanced Plan.

Refer to the official Abuse Contact API documentation for details on all available fields.


1.Lookup Abuse Contact by IP

import io.ipgeolocation.sdk.api.AbuseContactAPI;
import io.ipgeolocation.sdk.model.AbuseResponse;

AbuseContactAPI api = new AbuseContactAPI(client);

AbuseResponse response = api.getAbuseContactInfo()
        .ip("1.0.0.0")
        .execute();

System.out.println(response);

Sample Response:

Response
1class AbuseResponse {
2    ip: 1.0.0.0
3    abuse: class Abuse {
4        route: 1.0.0.0/24
5        country: AU
6        handle: IRT-APNICRANDNET-AU
7        name: IRT-APNICRANDNET-AU
8        organization:
9        role: abuse
10        kind: group
11        address: PO Box 3646
12        South Brisbane, QLD 4101
13        Australia
14        emails: [helpdesk@apnic.net]
15        phoneNumbers: [+61 7 3858 3100]
16    }
17}

2.Lookup Abuse Contact with Specific Fields

AbuseResponse response = api.getAbuseContactInfo()
        .ip("1.2.3.4")
        .fields("abuse.role,abuse.emails")
        .execute();

System.out.println(response);

Sample Response:

Response
1class AbuseResponse {
2    ip: 1.2.3.4
3    abuse: class Abuse {
4        role: abuse
5        emails: [helpdesk@apnic.net]
6    }
7}

3.Lookup Abuse Contact while Excluding Fields

AbuseResponse response = api.getAbuseContactInfo()
        .ip("9.9.9.9")
        .excludes("abuse.handle,abuse.emails")
        .execute();

System.out.println(response);

Sample Response:

Response
1class AbuseResponse {
2    ip: 9.9.9.9
3    abuse: class Abuse {
4        route: 9.9.9.0/24
5        country:
6        name: Quad9 Abuse
7        organization: Quad9 Abuse
8        role: abuse
9        kind: group
10        address: 1442 A Walnut Street Ste 501
11        Berkeley
12        CA
13        94709
14        United States
15        phoneNumbers: [+1-415-831-3129]
16    }
17}

Timezone API Examples

This section provides usage examples of the getTimezone() method from the SDK, showcasing how to fetch timezone and time-related data using different query types — IP address, latitude/longitude, and timezone ID.

For full API specifications, refer to the Timezone API documentation.


1.Get Timezone by IP Address

import io.ipgeolocation.sdk.api.TimezoneAPI;
import io.ipgeolocation.sdk.model.TimezoneResponse;

TimezoneAPI api = new TimezoneAPI(client);

TimezoneResponse response = api.getTimezone()
        .ip("8.8.8.8")
        .execute();

System.out.println(response);

Sample Response

Response
1class TimeZoneResponse {
2    ip: 8.8.8.8
3
4    location: class TimezoneLocation {
5        continentCode: NA
6        continentName: North America
7        countryCode2: US
8        countryCode3: USA
9        countryName: United States
10        countryNameOfficial: United States of America
11        isEu: false
12        stateProv: California
13        stateCode: US-CA
14        district: Santa Clara
15        city: Mountain View
16        locality: null
17        zipcode: 94043-1351
18        latitude: 37.42240
19        longitude: -122.08421
20    }
21    timeZone: class TimezoneDetails {
22        name: America/Los_Angeles
23        offset: -8
24        offsetWithDst: -7
25        date: 2025-06-23
26        dateTime: 2025-06-23 02:15:25
27        dateTimeTxt: Monday, June 23, 2025 02:15:25
28        dateTimeWti: Mon, 23 Jun 2025 02:15:25 -0700
29        dateTimeYmd: 2025-06-23T02:15:25-0700
30        dateTimeUnix: 1.750670125437E9
31        time24: 02:15:25
32        time12: 02:15:25 AM
33        week: 26
34        month: 6
35        year: 2025
36        yearAbbr: 25
37        isDst: true
38        dstSavings: 1
39        dstExists: true
40        dstStart: class TimezoneDetailDstStart {
41            utcTime: 2025-03-09 TIME 10
42            duration: +1H
43            gap: true
44            dateTimeAfter: 2025-03-09 TIME 03
45            dateTimeBefore: 2025-03-09 TIME 02
46            overlap: false
47        }
48        dstEnd: class TimezoneDetailDstEnd {
49            utcTime: 2025-11-02 TIME 09
50            duration: -1H
51            gap: false
52            dateTimeAfter: 2025-11-02 TIME 01
53            dateTimeBefore: 2025-11-02 TIME 02
54            overlap: true
55        }
56    }
57}

2.Get Timezone by Timezone Name

import io.ipgeolocation.sdk.model.TimezoneResponse;

TimezoneResponse response = api.getTimezone()
        .tz("Europe/London")
        .execute();

System.out.println(response);

Sample Response

Response
1class TimeZoneResponse {
2    timeZone: class TimezoneDetails {
3        name: Europe/London
4        offset: 0
5        offsetWithDst: 1
6        date: 2025-06-23
7        dateTime: 2025-06-23 10:25:01
8        dateTimeTxt: Monday, June 23, 2025 10:25:01
9        dateTimeWti: Mon, 23 Jun 2025 10:25:01 +0100
10        dateTimeYmd: 2025-06-23T10:25:01+0100
11        dateTimeUnix: 1.750670701706E9
12        time24: 10:25:01
13        time12: 10:25:01 AM
14        week: 26
15        month: 6
16        year: 2025
17        yearAbbr: 25
18        isDst: true
19        dstSavings: 1
20        dstExists: true
21        dstStart: class TimezoneDetailDstStart {
22            utcTime: 2025-03-30 TIME 01
23            duration: +1H
24            gap: true
25            dateTimeAfter: 2025-03-30 TIME 02
26            dateTimeBefore: 2025-03-30 TIME 01
27            overlap: false
28        }
29        dstEnd: class TimezoneDetailDstEnd {
30            utcTime: 2025-10-26 TIME 01
31            duration: -1H
32            gap: false
33            dateTimeAfter: 2025-10-26 TIME 01
34            dateTimeBefore: 2025-10-26 TIME 02
35            overlap: true
36        }
37    }
38}

3.Get Timezone from Any Address

import io.ipgeolocation.sdk.model.TimezoneResponse;

TimezoneResponse response = api.getTimezone()
        .location("Munich, Germany")
        .execute();

System.out.println(response);

Sample Response

Response
1class TimeZoneResponse {
2    location: class TimezoneLocation {
3        locationString: Munich, Germany
4        countryName: Germany
5        stateProv: Bavaria
6        city: Munich
7        locality:
8        latitude: 48.13711
9        longitude: 11.57538
10    }
11    timeZone: class TimezoneDetails {
12        name: Europe/Berlin
13        offset: 1
14        offsetWithDst: 2
15        date: 2025-06-23
16        dateTime: 2025-06-23 11:35:23
17        dateTimeTxt: Monday, June 23, 2025 11:35:23
18        dateTimeWti: Mon, 23 Jun 2025 11:35:23 +0200
19        dateTimeYmd: 2025-06-23T11:35:23+0200
20        dateTimeUnix: 1.750671323755E9
21        time24: 11:35:23
22        time12: 11:35:23 AM
23        week: 26
24        month: 6
25        year: 2025
26        yearAbbr: 25
27        isDst: true
28        dstSavings: 1
29        dstExists: true
30        dstStart: class TimezoneDetailDstStart {
31            utcTime: 2025-03-30 TIME 01
32            duration: +1H
33            gap: true
34            dateTimeAfter: 2025-03-30 TIME 03
35            dateTimeBefore: 2025-03-30 TIME 02
36            overlap: false
37        }
38        dstEnd: class TimezoneDetailDstEnd {
39            utcTime: 2025-10-26 TIME 01
40            duration: -1H
41            gap: false
42            dateTimeAfter: 2025-10-26 TIME 02
43            dateTimeBefore: 2025-10-26 TIME 03
44            overlap: true
45        }
46    }
47}

4.Get Timezone from Location Coordinates

import io.ipgeolocation.sdk.model.TimezoneResponse;

TimezoneResponse response = api.getTimezone()
        .lat(48.8566F)
        ._long(2.3522F)
        .execute();

System.out.println(response);

Sample Response

Response
1class TimeZoneResponse {
2    timeZone: class TimezoneDetails {
3        name: Europe/Paris
4        offset: 1
5        offsetWithDst: 2
6        date: 2025-06-23
7        dateTime: 2025-06-23 11:53:31
8        dateTimeTxt: Monday, June 23, 2025 11:53:31
9        dateTimeWti: Mon, 23 Jun 2025 11:53:31 +0200
10        dateTimeYmd: 2025-06-23T11:53:31+0200
11        dateTimeUnix: 1.750672411295E9
12        time24: 11:53:31
13        time12: 11:53:31 AM
14        week: 26
15        month: 6
16        year: 2025
17        yearAbbr: 25
18        isDst: true
19        dstSavings: 1
20        dstExists: true
21        dstStart: class TimezoneDetailDstStart {
22            utcTime: 2025-03-30 TIME 01
23            duration: +1H
24            gap: true
25            dateTimeAfter: 2025-03-30 TIME 03
26            dateTimeBefore: 2025-03-30 TIME 02
27            overlap: false
28        }
29        dstEnd: class TimezoneDetailDstEnd {
30            utcTime: 2025-10-26 TIME 01
31            duration: -1H
32            gap: false
33            dateTimeAfter: 2025-10-26 TIME 02
34            dateTimeBefore: 2025-10-26 TIME 03
35            overlap: true
36        }
37    }
38}

5.Get Timezone and Airport Details from IATA Code

import io.ipgeolocation.sdk.model.TimezoneResponse;

TimezoneResponse response = api.getTimezone()
        .iataCode("ZRH")
        .execute();

System.out.println(response);

Sample Response

Response
1class TimeZoneResponse {
2    airportDetails: class TimezoneAirport {
3        type: large_airport
4        name: Zurich Airport
5        latitude: 47.45806
6        longitude: 8.54806
7        elevationFt: 1417
8        continentCode: EU
9        countryCode: CH
10        stateCode: CH-ZH
11        city: Zurich
12        iataCode: ZRH
13        icaoCode: LSZH
14        faaCode:
15    }
16    timeZone: class TimezoneDetails {
17        name: Europe/Zurich
18        offset: 1
19        offsetWithDst: 2
20        date: 2025-06-23
21        dateTime: 2025-06-23 12:24:08
22        dateTimeTxt: Monday, June 23, 2025 12:24:08
23        dateTimeWti: Mon, 23 Jun 2025 12:24:08 +0200
24        dateTimeYmd: 2025-06-23T12:24:08+0200
25        dateTimeUnix: 1.750674248242E9
26        time24: 12:24:08
27        time12: 12:24:08 PM
28        week: 26
29        month: 6
30        year: 2025
31        yearAbbr: 25
32        isDst: true
33        dstSavings: 1
34        dstExists: true
35        dstStart: class TimezoneDetailDstStart {
36            utcTime: 2025-03-30 TIME 01
37            duration: +1H
38            gap: true
39            dateTimeAfter: 2025-03-30 TIME 03
40            dateTimeBefore: 2025-03-30 TIME 02
41            overlap: false
42        }
43        dstEnd: class TimezoneDetailDstEnd {
44            utcTime: 2025-10-26 TIME 01
45            duration: -1H
46            gap: false
47            dateTimeAfter: 2025-10-26 TIME 02
48            dateTimeBefore: 2025-10-26 TIME 03
49            overlap: true
50        }
51    }
52}

Similarly, you can fetch Airport Details and Timezone from using any ICAO code as well


6.Get Timezone and City Details from UN/LOCODE

import io.ipgeolocation.sdk.model.TimezoneResponse;

TimezoneResponse response = api.getTimezone()
        .loCode("ESBCN")
        .execute();

System.out.println(response);

Sample Response

Response
1class TimeZoneResponse {
2    loCodeDetails: class TimezoneLocode {
3        loCode: ESBCN
4        city: Barcelona
5        stateCode:
6        countryCode: ES
7        countryName:
8        locationType: Port, Rail Terminal, Road Terminal, Airport, Postal Exchange
9        latitude: 41.38289
10        longitude: 2.17743
11    }
12    timeZone: class TimezoneDetails {
13        name: Europe/Madrid
14        offset: 1
15        offsetWithDst: 2
16        date: 2025-06-23
17        dateTime: 2025-06-23 12:32:55
18        dateTimeTxt: Monday, June 23, 2025 12:32:55
19        dateTimeWti: Mon, 23 Jun 2025 12:32:55 +0200
20        dateTimeYmd: 2025-06-23T12:32:55+0200
21        dateTimeUnix: 1.750674775033E9
22        time24: 12:32:55
23        time12: 12:32:55 PM
24        week: 26
25        month: 6
26        year: 2025
27        yearAbbr: 25
28        isDst: true
29        dstSavings: 1
30        dstExists: true
31        dstStart: class TimezoneDetailDstStart {
32            utcTime: 2025-03-30 TIME 01
33            duration: +1H
34            gap: true
35            dateTimeAfter: 2025-03-30 TIME 03
36            dateTimeBefore: 2025-03-30 TIME 02
37            overlap: false
38        }
39        dstEnd: class TimezoneDetailDstEnd {
40            utcTime: 2025-10-26 TIME 01
41            duration: -1H
42            gap: false
43            dateTimeAfter: 2025-10-26 TIME 02
44            dateTimeBefore: 2025-10-26 TIME 03
45            overlap: true
46        }
47    }
48}

Timezone Converter Examples

This section provides usage examples of the convertTimezone() method from the SDK. The Timezone Converter API allows you to convert a specific time from one timezone to another using timezone identifiers; coordinates; city; IATA/ICAO code or UN/LOCODE and optional date/time inputs.

For more details, refer to official documentation: Timezone Converter API.


1.Convert Current Time from One Timezone to Another

import io.ipgeolocation.sdk.api.TimezoneConversionAPI;
import io.ipgeolocation.sdk.model.TimezoneConversionResponse;

TimezoneConversionAPI api = new TimezoneConversionAPI(client);

TimezoneConversionResponse response = api.convertTimezone()
        .from("America/New_York")
        .to("Asia/Tokyo")
        .execute();

System.out.println(response);

Sample Response

Response
1class TimezoneConversionResponse {
2    originalTime: 2024-12-08 11:00
3    convertedTime: 2024-12-09 01:00:00
4    diffHour: 14.0
5    diffMin: 840
6}

Similarly, you can convert time from any timezone to another timezone using location coordinates (Latitude and Longitude), location addresses, IATA codes, ICAO codes and UN/LUCODE .


User Agent API Examples

This section provides usage examples of the getUserAgent() method from the SDK. The User Agent API extracts and classifies information from user agent strings, including browser, engine, device, OS, and type metadata.

For full explanation, visit the User Agent API documentation.


1.Parse a Basic User Agent String

import io.ipgeolocation.sdk.api.UserAgentAPI;
import io.ipgeolocation.sdk.model.UserAgentResponse;

UserAgentAPI api = new UserAgentAPI(client);

UserAgentResponse response = api.getUserAgent()
        .userAgentString("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36")
        .execute();

System.out.println(response);

Sample Response

Response
1class UserAgentData {
2    userAgentString: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
3    name: Chrome
4    type: Browser
5    version: 125
6    versionMajor: 125
7    device: class UserAgentDataDevice {
8        name: Desktop
9        type: Desktop
10        brand: Unknown
11        cpu: Intel x86_64
12    }
13    engine: class UserAgentDataEngine {
14        name: Blink
15        type: Browser
16        version: 125
17        versionMajor: 125
18    }
19    operatingSystem: class UserAgentDataOperatingSystem {
20        name: Windows NT
21        type: Desktop
22        version: ??
23        versionMajor: ??
24        build: ??
25    }
26}

If you don't pass any userAgentString, the API will return the data of device's user agent.


2.Bulk User Agent Parsing Example

The SDK also supports bulk User Agent parsing using the getBulkUserAgent() method. This allows parsing multiple user agent strings in a single request. All fields available in single-user-agent parsing are returned per entry.

import io.ipgeolocation.sdk.api.UserAgentAPI;
import io.ipgeolocation.sdk.model.UserAgentBulkRequest;
import io.ipgeolocation.sdk.model.UserAgentData;

UserAgentAPI api = new UserAgentAPI(client);

UserAgentBulkRequest bulkRequest = new UserAgentBulkRequest();
bulkRequest.addUaString("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36");
bulkRequest.addUaString("Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1");

List<UserAgentData> response = api.getBulkUserAgent()
        .userAgentBulkRequest(bulkRequest)
        .execute();

System.out.println(response);

Astronomy API Examples

This section provides usage examples of the getAstronomy() method from the SDK, allowing developers to fetch sun and moon timings and position data based on coordinates, IP, or location string.

Refer to the official Astronomy API documentation for more details.


1.Lookup Astronomy by Coordinates

import io.ipgeolocation.sdk.api.AstronomyAPI;
import io.ipgeolocation.sdk.model.AstronomyResponse;

AstronomyAPI api = new AstronomyAPI(client);

AstronomyResponse response = api.getAstronomy()
        .lat("40.7128")
        ._long("-74.0060")
        .execute();

System.out.println(response);

Sample Response

Response
1class AstronomyResponse {
2    location: class AstronomyLocation {
3        countryName:
4        stateProv: New York
5        city: New York
6        locality:
7        latitude: 40.71280
8        longitude: -74.00600
9        elevation: 6.0
10    }
11    astronomy: class Astronomy {
12        date: 2025-07-22
13        currentTime: 05:34:17.046
14        midNight: 01:02
15        nightEnd: 03:48
16        morning: class AstronomyMorning {
17            astronomicalTwilightBegin: 03:48
18            astronomicalTwilightEnd: 04:32
19            nauticalTwilightBegin: 04:32
20            nauticalTwilightEnd: 05:12
21            civilTwilightBegin: 05:12
22            civilTwilightEnd: 05:43
23            blueHourBegin: 04:59
24            blueHourEnd: 05:24
25            goldenHourBegin: 05:24
26            goldenHourEnd: 06:23
27        }
28        sunrise: 05:43
29        sunset: 20:21
30        evening: class AstronomyEvening {
31            goldenHourBegin: 19:41
32            goldenHourEnd: 20:40
33            blueHourBegin: 20:40
34            blueHourEnd: 21:05
35            civilTwilightBegin: 20:21
36            civilTwilightEnd: 20:52
37            nauticalTwilightBegin: 20:52
38            nauticalTwilightEnd: 21:31
39            astronomicalTwilightBegin: 21:31
40            astronomicalTwilightEnd: 22:16
41        }
42        nightBegin: 22:16
43        sunStatus: -
44        solarNoon: 13:02
45        dayLength: 14:37
46        sunAltitude: -2.4240905951150817
47        sunDistance: 152012050.75662628
48        sunAzimuth: 60.53270916713848
49        moonPhase: WANING_CRESCENT
50        moonrise: 02:48
51        moonset: 19:10
52        moonStatus: -
53        moonAltitude: 26.687264834949556
54        moonDistance: 369857.6483476412
55        moonAzimuth: 74.22460131532307
56        moonParallacticAngle: -56.08124322972331
57        moonIlluminationPercentage: -7.41
58        moonAngle: 328.4181377849406
59    }
60}

2.Lookup Astronomy by IP Address

AstronomyResponse response = api.getAstronomy()
        .ip("8.8.8.8")
        .execute();

System.out.println(response);

Sample Response

Response
1class AstronomyResponse {
2    ip: 8.8.8.8
3    location: class AstronomyLocation {
4        continentCode: NA
5        continentName: North America
6        countryCode2: US
7        countryCode3: USA
8        countryName: United States
9        countryNameOfficial: United States of America
10        isEu: false
11        stateProv: California
12        stateCode: US-CA
13        district: Santa Clara
14        city: Mountain View
15        locality: Charleston Terrace
16        zipcode: 94043-1351
17        latitude: 37.42240
18        longitude: -122.08421
19        elevation: 3.0
20    }
21    astronomy: class Astronomy {
22        date: 2025-07-22
23        currentTime: 02:36:01.027
24        midNight: 01:15
25        nightEnd: 04:18
26        morning: class AstronomyMorning {
27            astronomicalTwilightBegin: 04:18
28            astronomicalTwilightEnd: 04:58
29            nauticalTwilightBegin: 04:58
30            nauticalTwilightEnd: 05:35
31            civilTwilightBegin: 05:35
32            civilTwilightEnd: 06:04
33            blueHourBegin: 05:23
34            blueHourEnd: 05:47
35            goldenHourBegin: 05:47
36            goldenHourEnd: 06:42
37        }
38        sunrise: 06:04
39        sunset: 20:24
40        evening: class AstronomyEvening {
41            goldenHourBegin: 19:46
42            goldenHourEnd: 20:42
43            blueHourBegin: 20:42
44            blueHourEnd: 21:05
45            civilTwilightBegin: 20:24
46            civilTwilightEnd: 20:54
47            nauticalTwilightBegin: 20:54
48            nauticalTwilightEnd: 21:30
49            astronomicalTwilightBegin: 21:30
50            astronomicalTwilightEnd: 22:10
51        }
52        nightBegin: 22:10
53        sunStatus: -
54        solarNoon: 13:14
55        dayLength: 14:20
56        sunAltitude: -29.312204242565592
57        sunDistance: 152012050.7566263
58        sunAzimuth: 21.915241201213632
59        moonPhase: WANING_CRESCENT
60        moonrise: 03:23
61        moonset: 19:16
62        moonStatus: -
63        moonAltitude: -6.780866431657464
64        moonDistance: 369859.5847016905
65        moonAzimuth: 45.928379972251605
66        moonParallacticAngle: -40.47546867785306
67        moonIlluminationPercentage: -7.40
68        moonAngle: 328.43423626935555
69    }
70}

3.Lookup Astronomy by Location String

AstronomyResponse response = api.getAstronomy()
    .location("Milan, Italy")
    .execute();

System.out.println(response);

Sample Response

Response
1class AstronomyResponse {
2    location: class AstronomyLocation {
3        locationString: Milan, Italy
4        countryName: Italy
5        stateProv: Lombardy
6        city: Milan
7        locality:
8        latitude: 45.46419
9        longitude: 9.18963
10        elevation: 122.0
11    }
12    astronomy: class Astronomy {
13        date: 2025-07-22
14        currentTime: 11:37:28.787
15        midNight: 01:29
16        nightEnd: 03:39
17        morning: class AstronomyMorning {
18            astronomicalTwilightBegin: 03:39
19            astronomicalTwilightEnd: 04:35
20            nauticalTwilightBegin: 04:35
21            nauticalTwilightEnd: 05:21
22            civilTwilightBegin: 05:21
23            civilTwilightEnd: 05:54
24            blueHourBegin: 05:06
25            blueHourEnd: 05:35
26            goldenHourBegin: 05:35
27            goldenHourEnd: 06:40
28        }
29        sunrise: 05:54
30        sunset: 21:04
31        evening: class AstronomyEvening {
32            goldenHourBegin: 20:19
33            goldenHourEnd: 21:24
34            blueHourBegin: 21:24
35            blueHourEnd: 21:52
36            civilTwilightBegin: 21:04
37            civilTwilightEnd: 21:38
38            nauticalTwilightBegin: 21:38
39            nauticalTwilightEnd: 22:23
40            astronomicalTwilightBegin: 22:23
41            astronomicalTwilightEnd: 23:18
42        }
43        nightBegin: 23:18
44        sunStatus: -
45        solarNoon: 13:29
46        dayLength: 15:10
47        sunAltitude: 55.76507063803926
48        sunDistance: 152012050.7566263
49        sunAzimuth: 128.26574664275847
50        moonPhase: WANING_CRESCENT
51        moonrise: 02:36
52        moonset: 19:49
53        moonStatus: -
54        moonAltitude: 72.39158071193661
55        moonDistance: 369861.22005060845
56        moonAzimuth: 197.31311454833428
57        moonParallacticAngle: 13.735730743087668
58        moonIlluminationPercentage: -7.39
59        moonAngle: 328.44782327106236
60    }
61}

4.Lookup Astronomy for Specific Date

AstronomyResponse response = api.getAstronomy()
        .lat("-27.47")
        ._long("153.02")
        .date("2025-01-01")
        .execute();

System.out.println(response);

Sample Response

Response
1class AstronomyResponse {
2    location: class AstronomyLocation {
3        countryName: Australia
4        stateProv: Queensland
5        city: Brisbane
6        locality: Brisbane
7        latitude: -27.47000
8        longitude: 153.02000
9        elevation:
10    }
11    astronomy: class Astronomy {
12        date: 2025-01-01
13        currentTime: 19:45:17.561
14        midNight: 23:51
15        nightEnd: 03:24
16        morning: class AstronomyMorning {
17            astronomicalTwilightBegin: 03:24
18            astronomicalTwilightEnd: 03:57
19            nauticalTwilightBegin: 03:57
20            nauticalTwilightEnd: 04:29
21            civilTwilightBegin: 04:29
22            civilTwilightEnd: 04:56
23            blueHourBegin: 04:19
24            blueHourEnd: 04:40
25            goldenHourBegin: 04:40
26            goldenHourEnd: 05:30
27        }
28        sunrise: 04:56
29        sunset: 18:46
30        evening: class AstronomyEvening {
31            goldenHourBegin: 18:12
32            goldenHourEnd: 19:02
33            blueHourBegin: 19:02
34            blueHourEnd: 19:23
35            civilTwilightBegin: 18:46
36            civilTwilightEnd: 19:13
37            nauticalTwilightBegin: 19:13
38            nauticalTwilightEnd: 19:45
39            astronomicalTwilightBegin: 19:45
40            astronomicalTwilightEnd: 20:18
41        }
42        nightBegin: 20:18
43        sunStatus: -
44        solarNoon: 11:51
45        dayLength: 13:50
46        sunAltitude: -12.059617608402677
47        sunDistance: 147102938.88036567
48        sunAzimuth: 235.897971324645
49        moonPhase: NEW_MOON
50        moonrise: 05:42
51        moonset: 20:08
52        moonStatus: -
53        moonAltitude: 4.6701693782344345
54        moonDistance: 380596.5823950267
55        moonAzimuth: 244.56945849604378
56        moonParallacticAngle: 118.21976701203934
57        moonIlluminationPercentage: 2.49
58        moonAngle: 18.156495178599695
59    }
60}

5.Lookup Astronomy in Different Language

You can also get Astronomy Data in other languages as well. Only paid subscriptions can access this feature.

AstronomyResponse response = api.getAstronomy()
        .ip("1.1.1.1")
        .lang("fr")
        .execute();

System.out.println(response);

Sample Response

Response
1class AstronomyResponse {
2    ip: 1.1.1.1
3    location: class AstronomyLocation {
4        continentCode: OC
5        continentName: Océanie
6        countryCode2: AU
7        countryCode3: AUS
8        countryName: Australie
9        countryNameOfficial:
10        isEu: false
11        stateProv: Queensland
12        stateCode: AU-QLD
13        district: Brisbane
14        city: Brisbane Sud
15        locality:
16        zipcode: 4101
17        latitude: -27.47306
18        longitude: 153.01421
19        elevation:
20    }
21    astronomy: class Astronomy {
22        date: 2025-07-22
23        currentTime: 19:54:32.920
24        midNight: 23:54
25        nightEnd: 05:13
26        morning: class AstronomyMorning {
27            astronomicalTwilightBegin: 05:13
28            astronomicalTwilightEnd: 05:41
29            nauticalTwilightBegin: 05:41
30            nauticalTwilightEnd: 06:09
31            civilTwilightBegin: 06:09
32            civilTwilightEnd: 06:34
33            blueHourBegin: 06:00
34            blueHourEnd: 06:19
35            goldenHourBegin: 06:19
36            goldenHourEnd: 07:08
37        }
38        sunrise: 06:34
39        sunset: 17:14
40        evening: class AstronomyEvening {
41            goldenHourBegin: 16:40
42            goldenHourEnd: 17:29
43            blueHourBegin: 17:29
44            blueHourEnd: 17:49
45            civilTwilightBegin: 17:14
46            civilTwilightEnd: 17:39
47            nauticalTwilightBegin: 17:39
48            nauticalTwilightEnd: 18:07
49            astronomicalTwilightBegin: 18:07
50            astronomicalTwilightEnd: 18:35
51        }
52        nightBegin: 18:35
53        sunStatus: -
54        solarNoon: 11:54
55        dayLength: 10:39
56        sunAltitude: -35.15165719378359
57        sunDistance: 152012050.75662628
58        sunAzimuth: 276.2757088601843
59        moonPhase: WANING_CRESCENT
60        moonrise: 04:04
61        moonset: 14:19
62        moonStatus: -
63        moonAltitude: -66.8771626746063
64        moonDistance: 369880.37618917384
65        moonAzimuth: 278.66762618741274
66        moonParallacticAngle: 93.79636599869248
67        moonIlluminationPercentage: -7.32
68        moonAngle: 328.6063710418327
69    }
70}

Documentation for Models

Subscribe Our Newsletter

Get the latest in geolocation tech, straight to your inbox.