Skip to main content
This function allows you to convert a single IP address into its corresponding geolocation data using, see an example below:
You should authenticate/initialize Ip2Geo before using this method.
import { ConvertIP } from '@ip2geo/sdk'

const ipAddress = '8.8.8.8'

const { data, success, message } = await ConvertIP({
    ip: ipAddress
})

Parameters

ip
string
required
The IPv4 or IPv6 address to convert.
convertOnly
boolean
default:"false"
If set to true, doesn’t store conversion data and charges $0.001 per conversion instead of $0.0005. Defaults to false (full data storage).

Response

success
boolean
Whether the request was successful.
message
string
Response message describing the result.
code
number
HTTP status code.
data
Ip | null
The geolocation data for the IP address. See Ip Interface for details. Returns null if the conversion failed, read more about IP Response Interface.
_req
object
Request metadata containing:
  • reqId: Unique request identifier.
  • resTime: Response time in milliseconds.