Get Conversion

This function allows you to retrieve a single conversion by its unique identifier. Conversions are kept for twelve months after the month they were made, then deleted, so older ones are no longer returned. See an example below:

You should authenticate/initialize Ip2Geo before using this method.

import { GetConversion } from '@ip2geo/sdk'

const conversionId = 'your-conversion-uuid'

const { data, success, message } = await GetConversion({
    conversionId: conversionId
})

With Select Fields

You can select specific fields from the conversion data object using the select parameter:

import { GetConversion, SELECT } from '@ip2geo/sdk'

const { data, success, message } = await GetConversion({
    conversionId: 'your-conversion-uuid',
    select: [
        SELECT.COUNTRY_NAME,
        SELECT.COUNTRY_CODE,
        SELECT.ASN_NAME
    ]
})

// Response data structure (uniqueId always comes along):
// {
//     uniqueId: '01a12452-07a0-7a3b-8c41-d2e5f6a7b8c9',
//     data: {
//         continent: {
//             country: {
//                 name: 'United States',
//                 code: 'us'
//             }
//         },
//         asn: {
//             name: 'Cloudflare'
//         }
//     }
// }

Parameters

conversionIdstringrequired

The unique identifier (UUID) of the conversion to retrieve.

selectArray<SelectField>

Select the fields to return. Geolocation fields, the SELECT Constants, are read under data, and the stored fields (id, uniqueId, status, startedAt, completedAt, createdAt) can be named as they are. uniqueId always comes along, so every row can be matched to its conversion. If not specified, every field is returned.

Response

successboolean

Whether the request was successful.

messagestring

Response message describing the result.

codenumber

HTTP status code.

dataConversion | Partial<Conversion> | null

The conversion data. If select was specified, only the selected fields are returned. Returns null if the conversion was not found.

_reqobject

Request metadata containing:

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

For all available SELECT constants and their values, see the SELECT Constants reference.

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.