Convert IP

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

ipstringrequired

The IPv4 or IPv6 address to convert.

Response

successboolean

Whether the request was successful.

messagestring

Response message describing the result.

codenumber

HTTP status code.

dataIp | null

The geolocation data for the IP address. See Ip Interface for details. It is null when the address has no geolocation data, with code 404 (private, reserved and unassigned addresses have none), or when the conversion failed. Either way the address counts toward your quota. Read more about IP Response Interface.

_reqobject

Request metadata containing:

  • reqId: Unique request identifier.
  • resTime: Response time in milliseconds.
Get Started

Convert IPs into accurate location data in milliseconds.

Sign up today and get 1,000 free monthly conversions, and discover why developers trust us for fast, reliable, and affordable IP conversions.