Skip to main content
This function allows you to retrieve multiple conversions by their unique identifiers in a single request, see an example below:
You should authenticate/initialize Ip2Geo before using this method.
import { GetConversions } from '@ip2geo/sdk'

const conversionIds = ['uuid-1', 'uuid-2', 'uuid-3']

const { data, success, message } = await GetConversions({
    conversionIds: conversionIds
})

// Access the conversions
console.log(data.conversions) // Array of conversion objects

With Select Fields

You can specify which fields to return using the select parameter:
import { GetConversions, SELECT } from '@ip2geo/sdk'

const { data, success, message } = await GetConversions({
    conversionIds: ['uuid-1', 'uuid-2'],
    select: [
        SELECT.CONVERSION.UNIQUE_ID,
        SELECT.CONVERSION.STATUS,
        SELECT.CONVERSION.CREATED_AT
    ]
})

With Nested Data Fields

You can select specific nested fields from the data object instead of fetching the entire object:
import { GetConversions, SELECT } from '@ip2geo/sdk'

const { data, success, message } = await GetConversions({
    conversionIds: ['uuid-1', 'uuid-2'],
    select: [
        SELECT.CONVERSION.UNIQUE_ID,
        SELECT.DATA.CONTINENT.COUNTRY.NAME,
        SELECT.DATA.CONTINENT.COUNTRY.CODE,
        SELECT.DATA.ASN.NAME
    ]
})

// Response data structure:
// {
//     conversions: [
//         {
//             uniqueId: 'uuid-1',
//             data: {
//                 continent: {
//                     country: { name: 'United States', code: 'US' }
//                 },
//                 asn: { name: 'Cloudflare' }
//             }
//         },
//         ...
//     ]
// }

Parameters

conversionIds
Array<string>
required
An array of unique identifiers (UUIDs) of the conversions to retrieve. Maximum 100 IDs per request.
select
Array<SelectField>
An array of property names to return. Supports both top-level fields and nested data fields using dot notation. If not specified, all properties are returned.

Response

success
boolean
Whether the request was successful.
message
string
Response message describing the result.
code
number
HTTP status code.
data
object | null
The response data containing:
  • conversions: Array of conversion objects (or partial objects if select was used)
_req
object
Request metadata containing:
  • reqId: Unique request identifier.
  • resTime: Response time in milliseconds.

SELECT Constants

Use the SELECT.CONVERSION object for top-level field selection:
ConstantValue
SELECT.CONVERSION.IDid
SELECT.CONVERSION.UNIQUE_IDuniqueId
SELECT.CONVERSION.DATAdata
SELECT.CONVERSION.STATUSstatus
SELECT.CONVERSION.STARTED_ATstartedAt
SELECT.CONVERSION.COMPLETED_ATcompletedAt
SELECT.CONVERSION.CREATED_ATcreatedAt
SELECT.CONVERSION.CREDITEDcredited
SELECT.CONVERSION.CONVERT_ONLYconvertOnly

SELECT.DATA Constants

Use the SELECT.DATA object for nested data field selection:
ConstantValue
SELECT.DATA.IPdata.ip
SELECT.DATA.TYPEdata.type
SELECT.DATA.IS_EUdata.is_eu
SELECT.DATA.CONTINENT.NAMEdata.continent.name
SELECT.DATA.CONTINENT.CODEdata.continent.code
SELECT.DATA.CONTINENT.GEONAME_IDdata.continent.geoname_id
SELECT.DATA.CONTINENT.COUNTRY.NAMEdata.continent.country.name
SELECT.DATA.CONTINENT.COUNTRY.CODEdata.continent.country.code
SELECT.DATA.CONTINENT.COUNTRY.GEONAME_IDdata.continent.country.geoname_id
SELECT.DATA.CONTINENT.COUNTRY.PHONE_CODEdata.continent.country.phone_code
SELECT.DATA.CONTINENT.COUNTRY.CAPITALdata.continent.country.capital
SELECT.DATA.CONTINENT.COUNTRY.TLDdata.continent.country.tld
SELECT.DATA.CONTINENT.COUNTRY.SUBDIVISION.NAMEdata.continent.country.subdivision.name
SELECT.DATA.CONTINENT.COUNTRY.SUBDIVISION.CODEdata.continent.country.subdivision.code
SELECT.DATA.CONTINENT.COUNTRY.CITY.NAMEdata.continent.country.city.name
SELECT.DATA.CONTINENT.COUNTRY.CITY.GEONAME_IDdata.continent.country.city.geoname_id
SELECT.DATA.CONTINENT.COUNTRY.CITY.LATITUDEdata.continent.country.city.latitude
SELECT.DATA.CONTINENT.COUNTRY.CITY.LONGITUDEdata.continent.country.city.longitude
SELECT.DATA.CONTINENT.COUNTRY.CITY.ACCURACY_RADIUSdata.continent.country.city.accuracy_radius
SELECT.DATA.CONTINENT.COUNTRY.CITY.METRO_CODEdata.continent.country.city.metro_code
SELECT.DATA.CONTINENT.COUNTRY.CITY.POSTAL_CODEdata.continent.country.city.postal_code
SELECT.DATA.CONTINENT.COUNTRY.CITY.TIMEZONE.NAMEdata.continent.country.city.timezone.name
SELECT.DATA.CONTINENT.COUNTRY.CITY.TIMEZONE.TIME_NOWdata.continent.country.city.timezone.time_now
SELECT.DATA.CONTINENT.COUNTRY.FLAG.IMGdata.continent.country.flag.img
SELECT.DATA.CONTINENT.COUNTRY.FLAG.EMOJIdata.continent.country.flag.emoji
SELECT.DATA.CONTINENT.COUNTRY.FLAG.EMOJI_UNICODEdata.continent.country.flag.emoji_unicode
SELECT.DATA.CONTINENT.COUNTRY.CURRENCY.NAMEdata.continent.country.currency.name
SELECT.DATA.CONTINENT.COUNTRY.CURRENCY.CODEdata.continent.country.currency.code
SELECT.DATA.CONTINENT.COUNTRY.CURRENCY.SYMBOLdata.continent.country.currency.symbol
SELECT.DATA.REGISTERED_COUNTRY.NAMEdata.registered_country.name
SELECT.DATA.REGISTERED_COUNTRY.CODEdata.registered_country.code
SELECT.DATA.REGISTERED_COUNTRY.GEONAME_IDdata.registered_country.geoname_id
SELECT.DATA.ASN.NUMBERdata.asn.number
SELECT.DATA.ASN.NAMEdata.asn.name
SELECT.DATA.COMPLETION_TIME.MILISECONDSdata.completion_time.miliseconds
SELECT.DATA.COMPLETION_TIME.SECONDSdata.completion_time.seconds

Error Handling

If any of the provided conversion IDs are invalid (not valid UUIDs), the request will fail and return the list of invalid IDs:
const { data, success, message } = await GetConversions({
    conversionIds: ['valid-uuid', 'invalid-id', 'another-bad-id']
})

// Response:
// {
//     success: false,
//     message: 'conversions.invalid-conversion-ids',
//     data: { invalidIds: ['invalid-id', 'another-bad-id'] }
// }