Skip to content

Kotlin SDK

Maven Central GitHub

The IPWho Kotlin SDK wraps the IP geolocation API in idiomatic Kotlin — data class responses, coroutine support, and a single Maven dependency. One call returns the full payload: geolocation, timezone, currency, connection (ASN/ISP), security flags, and more.

implementation("com.lavrox:ipwho-kotlin:1.0.0")

JDK 17+, Ktor, kotlinx.serialization, coroutines. Apply kotlin("plugin.serialization"). Package: com.ipwho.sdk. Public methods are suspend.

val client = IpWhoClient(System.getenv("IPWHO_API_KEY"))
val resp = client.lookup("8.8.8.8") // GET /ip/{ip}
val me = client.me() // GET /me
val bulk = client.bulk(listOf("8.8.8.8", "1.1.1.1"))
try {
val resp = client.lookup("8.8.8.8")
} catch (e: InvalidIPException) {
// malformed IP address (404)
} catch (e: RateLimitException) {
// plan limit reached (429)
} catch (e: APIResponseException) {
// unexpected response
}
  • lookup(ip: String) — GET /ip/{ip} (suspend)
  • me() — GET /me (suspend)
  • bulk(ips: List<String>) — GET /bulk/{a,b,c} (suspend)