Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ip2geo.dev/llms.txt

Use this file to discover all available pages before exploring further.

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 select specific fields from the conversion data object using the select parameter:
import { GetConversions, SELECT } from '@ip2geo/sdk'

const { data, success, message } = await GetConversions({
    conversionIds: ['uuid-1', 'uuid-2'],
    select: [
        SELECT.COUNTRY_NAME,
        SELECT.COUNTRY_CODE,
        SELECT.ASN_NAME
    ]
})

// Response data structure:
// {
//     conversions: [
//         {
//             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>
Select specific data fields to return. If not specified, all data fields are returned. See SELECT Constants for all available fields.

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.
For all available SELECT constants and their values, see the SELECT Constants reference.

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'] }
// }