1

Get IP address insights from IPinfo - geolocation, privacy detection, company and more

by
Published Jun 21, 2023

Get geolocation, privacy/VPN detection, ASN, company, carrier and other IP address data from the IPinfo.io API.

Script ipinfo Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 6 days ago
1
//native
2

3
type Ipinfo = {
4
    token: string
5
}
6

7
export async function main(ipinfo?: Ipinfo, ip?:string) {
8
    /**
9
     * Makes an API call to IPinfo to get IP address geolocation data and other IP data.
10
     * @param {string} token - Your IPinfo.io access token. This param is optional.
11
     * @param {string} ip - The IP address to lookup. This param is optional if you want to lookup your current IP.
12
     * @returns {object} - An object with the status and the payload.
13
     */
14
    const ipAddressInformation = await fetch(`https://ipinfo.io${ip ? '/' + ip : '' }/json?token=${ipinfo?.token || ""}`)
15

16
    return {
17
        status: ipAddressInformation.status,
18
        payload: await ipAddressInformation.json(),
19
    };
20
}
Other submissions
  • Submitted by devrel.ipinfo250 Deno
    Created 398 days ago
    1
    // import * as wmill from 'https://deno.land/x/windmill/index.ts'
    2
    
    
    3
    type Ipinfo {
    4
        token: string
    5
    }
    6
    
    
    7
    export async function main(ipinfo?: Ipinfo, ip?:string) {
    8
        /**
    9
         * Makes an API call to IPinfo to get IP address geolocation data and other IP data.
    10
         * @param {string} token - Your IPinfo.io access token. This param is optional.
    11
         * @param {string} ip - The IP address to lookup. This param is optional if you want to lookup your current IP.
    12
         * @returns {object} - An object with the status and the payload.
    13
         */
    14
        const ipAddressInformation = await fetch(`https://ipinfo.io${ip ? '/' + ip : '' }/json?token=${ipinfo?.token || ""}`)
    15
    
    
    16
        return {
    17
            status: ipAddressInformation.status,
    18
            payload: await ipAddressInformation.json(),
    19
        };
    20
    }
  • Submitted by pascal405 Deno
    Created 995 days ago
    1
    // import * as wmill from 'https://deno.land/x/windmill/index.ts'
    2
    
    
    3
    export async function main(x: string) {
    4
        return x
    5
    }