The ipgeolocation CLI lets you interact with the ipgeolocation.io API directly from your terminal. It supports looking up IP information (single or bulk), configuring API keys, and formatting output in multiple styles.
To install ipgeolocation using go install, run:
go install github.com/IPGeolocation/cli/cmd/ipgeolocation@latestMake sure $GOBIN or $GOPATH/bin is in your PATH, then run:
ipgeolocation --helpgit clone https://github.com/IPGeolocation/cli.git
cd cli
go build -o ipgeolocation ./cmd/ipgeolocation
./ipgeolocation --helpThese are prebuilt binaries for the IPGeolocation CLI tool, version 1.0.0. Users can download these files directly from GitHub Releases without needing to build from source.
The CLI provides geolocation information, timezone, user-agent parsing, bulk IP lookups, and more.
| Platform | Architecture | File Name |
|---|---|---|
| Linux | amd64 | ipgeolocation-1.0.0-linux-amd64.tar.gz |
| Linux | arm64 | ipgeolocation-1.0.0-linux-arm64.tar.gz |
| macOS | amd64 | ipgeolocation-1.0.0-darwin-amd64.tar.gz |
| macOS | arm64 | ipgeolocation-1.0.0-darwin-arm64.tar.gz |
| Windows | amd64 | ipgeolocation-1.0.0-windows-amd64.zip |
- Download the
.tar.gzfile for your architecture. - Extract it to a folder in your PATH, e.g.,
/usr/local/bin:
tar -xzf ipgeolocation-1.0.0-linux-amd64.tar.gz -C /usr/local/bin- Rename the binary for simplicity:
mv /usr/local/bin/ipgeolocation-1.0.0-linux-amd64 /usr/local/bin/ipgeolocation- Make the binary executable:
chmod +x /usr/local/bin/ipgeolocation- Verify installation:
ipgeolocation --help- Download the
.tar.gzfile for your architecture (amd64 or arm64). - Extract to a folder in your PATH, e.g.,
/usr/local/bin:
tar -xzf ipgeolocation-1.0.0-darwin-amd64.tar.gz -C /usr/local/bin- Rename the binary:
mv /usr/local/bin/ipgeolocation-1.0.0-darwin-amd64 /usr/local/bin/ipgeolocation- Make executable:
chmod +x /usr/local/bin/ipgeolocation- Verify installation:
ipgeolocation --help- Download the
.zipfile. - Extract the
ipgeolocation-1.0.0-windows-amd64.exeto a folder included in your systemPATH. - Rename the binary to
ipgeolocation.exefor convenience. - Open Command Prompt and verify:
ipgeolocation --help- Ensure execution permissions on Linux/macOS.
- Recommended folder for binaries:
/usr/local/binor any folder in your PATH. - Prebuilt binaries include version 1.0.0 in their filename. Rename them after extraction for easier usage.
- For updates, check GitHub Releases.
- Users can also install via Go if Go environment is set up:
go install github.com/IPGeolocation/cli/cmd/ipgeolocation@v1.0.0- Command not found: Ensure the binary is in a folder included in your PATH.
- Execution permission error: Run
chmod +x <binary>on Linux/macOS. - Wrong architecture: Download the binary matching your OS and CPU architecture.
- Go install issues: Use
GOPROXY=directif Go module proxy caching creates issues.
These flags are available for all commands:
| Flag | Description |
|---|---|
-h, --help |
Show help for the command. |
You can also check the version for ipgeolocation using the --version flag:
ipgeolocation --versionConfigure your API key for ipgeolocation.io.
ipgeolocation config --apikey=<your-key>| Flag | Type | Description |
|---|---|---|
--apikey |
string | Your API key from ipgeolocation.io. |
Lookup geolocation information for a single IP address or domain using the ipgeolocation.io API.
ipgeolocation ipgeo [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--ip |
string | "" |
IPv4, IPv6, or domain name (e.g. 8.8.8.8, google.com). |
--include |
string[] | [] |
Include extra fields (e.g. security,timezone,currency). |
--excludes |
string[] | [] |
Exclude fields from output. |
--fields |
string[] | [] |
Return only specific fields (e.g. ip,organization). |
--lang |
string | "" |
Response language. |
--output |
string | pretty |
Output format: pretty, raw, table, yaml. |
Get info about your current IP:
ipgeolocation ipgeoLookup a specific IP:
ipgeolocation ipgeo --ip 8.8.8.8Lookup a domain with extra fields:
ipgeolocation ipgeo --ip google.com --include security,timezone,currencyGet only specific fields in YAML:
ipgeolocation ipgeo --ip 1.1.1.1 --fields location --output yamlExclude unnecessary fields:
ipgeolocation ipgeo --ip 8.8.8.8 --excludes currency,time_zoneLookup geolocation information for multiple IPs in one request.
ipgeolocation bulk-ip-geo [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--ips |
string[] | [] |
Comma-separated list of IPs. Example: --ips 8.8.8.8,1.1.1.1 |
--file |
string | "" |
Path to a text file containing IPs (one per line). |
--include |
string[] | [] |
Include extra fields (e.g. location,time_zone). |
--exclude |
string[] | [] |
Exclude fields (e.g. currency). |
--fields |
string[] | [] |
Return only specific fields (e.g. location). |
--lang |
string | "" |
Response language (if supported). |
--output |
string | pretty |
Output format: pretty, raw, table, yaml. |
--output-file |
string | "" |
Save output to JSON file. Example: --output-file results.json |
For further information, please visit IP Geolocation API Documentation.
Lookup 3 IP addresses:
ipgeolocation bulk-ip-geo --ips 8.8.8.8,1.1.1.1,192.30.253.112Lookup from a file:
ipgeolocation bulk-ip-geo --file=ips.txtInclude location and timezone:
ipgeolocation bulk-ip-geo --file=ips.txt --include=location,time_zoneOutput as YAML:
ipgeolocation bulk-ip-geo --ips=8.8.8.8 --output=yamlSave results to JSON file:
ipgeolocation bulk-ip-geo --ips=8.8.8.8,1.1.1.1 --output-file=output.json- pretty (default): Human-readable formatted JSON.
- raw: Raw API response.
- table: Tabular display of common fields.
- yaml: YAML-formatted output.
- json file: If
--output-fileis provided, results are saved to a.jsonfile.
Lookup IP security information using the ipgeolocation.io API.
ipgeolocation ip-security [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--ip |
string | "" |
IPv4 or IPv6 address. |
--include |
string[] | [] |
Include extra fields in output. |
--exclude |
string[] | [] |
Exclude fields from output. |
--fields |
string[] | [] |
Return only specific fields (e.g. ip,organization). |
--lang |
string | "" |
Response language. |
--output |
string | pretty |
Output format: pretty, raw, table, yaml. |
Get info about your current IP:
ipgeolocation ip-securityLookup a specific IP:
ipgeolocation ip-security --ip 8.8.8.8Lookup security information for a specific IP with including additional fields:
ipgeolocation ip-security --ip 8.8.8.8 --include=location,time_zoneOutput as YAML:
ipgeolocation ip-security --ip 8.8.8.8 --output=yamlFor further information, please visit IP Security API Documentation.
Lookup IP security information for multiple IPs in one request.
ipgeolocation bulk-ip-security [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--ips |
string[] | [] |
Comma-separated list of IPs. Example: --ips 8.8.8.8,1.1.1.1 |
--file |
string | "" |
Path to a text file containing IPs (one per line). |
--include |
string[] | [] |
Include extra fields (e.g. location,time_zone). |
--exclude |
string[] | [] |
Exclude fields (e.g. currency). |
--fields |
string[] | [] |
Return only specific fields (e.g. location). |
--lang |
string | "" |
Response language (if supported). |
--output |
string | pretty |
Output format: pretty, raw, table, yaml. |
--output-file |
string | "" |
Save output to JSON file. Example: --output-file results.json |
Lookup 3 IP addresses:
ipgeolocation bulk-ip-security --ips 8.8.8.8,1.1.1.1,192.30.253.112Lookup from a file:
ipgeolocation bulk-ip-security --file=ips.txtInclude location and timezone:
ipgeolocation bulk-ip-security --file=ips.txt --include=location,time_zoneOutput as YAML:
ipgeolocation bulk-ip-security --ips=8.8.8.8 --output=yamlSave results to JSON file:
ipgeolocation bulk-ip-security --ips=8.8.8.8,1.1.1.1 --output-file=output.jsonFor further information, please visit Bulk IP Security API Documentation.
Lookup ASN (Autonomous System Number) information using the ipgeolocation.io API.
ipgeolocation asn [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--ip |
string | "" |
IPv4 or IPv6 address. |
--include |
string[] | [] |
Include extra fields in output. |
--exclude |
string[] | [] |
Exclude fields from output. |
--fields |
string[] | [] |
Return only specific fields (e.g. ip,organization). |
--output |
string | pretty |
Output format: pretty, raw, table, yaml. |
Get ASN info about your current IP:
ipgeolocation asnLookup a specific ASN:
ipgeolocation asn --asn 12345Lookup a specific IP with including additional fields:
ipgeolocation asn --ip 8.8.8.8 --include routes,peers,upstreams,downstreams,whois_responseExclude unnecessary fields:
ipgeolocation asn --ip 8.8.8.8 --exclude asn.date_allocated,asn.allocation_statusGet only specific fields in table format:
ipgeolocation asn --ip 8.8.8.8 --fields asn.organization,asn.country,asn.downstreams --output tableOutput as YAML:
ipgeolocation asn --ip 8.8.8.8 --output=yamlFor further information, please visit ASN API Documentation.
Lookup abuse information using the ipgeolocation.io API.
ipgeolocation abuse [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--ip |
string | "" |
IPv4 or IPv6 address. |
--exclude |
string[] | [] |
Exclude fields from output. |
--fields |
string[] | [] |
Return only specific fields (e.g. ip,organization). |
--output |
string | pretty |
Output format: pretty, raw, table, yaml. |
Get abuse info about your current IP:
ipgeolocation abuseLookup a specific IP:
ipgeolocation abuse --ip 8.8.8.8Exclude unnecessary fields:
ipgeolocation abuse --ip 8.8.8.8 --exclude abuse.handle,abuse.emailsGet only specific fields in table format:
ipgeolocation abuse --ip 8.8.8.8 --fields abuse.role,abuse.emails --output tableOutput as YAML:
ipgeolocation abuse --ip 8.8.8.8 --output=yamlFor further information, please visit Abuse API Documentation.
Lookup timezone information using the ipgeolocation.io API.
ipgeolocation timezone [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--ip |
string | "" |
IPv4 or IPv6 address. |
--tz |
string | "" |
Timezone. |
--location |
string | "" |
Location name (e.g. New York) |
--latitude |
float64 | 0 |
Latitude (e.g. 37.7749). |
--longitude |
float64 | 0 |
Longitude (e.g. -122.4194). |
--lang |
string | "" |
Response language (if supported). |
--iata |
string | "" |
IATA code (e.g. DXB). |
--icao |
string | "" |
ICAO code (e.g. KATL). |
--lo |
string | "" |
LO code (e.g. DEBER). |
--output |
string | pretty |
Output format: pretty, raw, table, yaml. |
Get timezone info about your current IP:
ipgeolocation timezoneLookup a specific IP:
ipgeolocation timezone --ip 8.8.8.8Lookup a specific timezone:
ipgeolocation timezone --tz America/New_YorkLookup a specific location:
ipgeolocation timezone --location New YorkLookup a specific latitude and longitude:
ipgeolocation timezone --latitude 37.7749 --longitude -122.4194Lookup a specific IATA code:
ipgeolocation timezone --iata DXBLookup a specific ICAO code:
ipgeolocation timezone --icao KATLLookup a specific LO code:
ipgeolocation timezone --lo DEBEROutput as YAML:
ipgeolocation timezone --ip 8.8.8.8 --output=yamlFor further information, please visit Timezone API Documentation.
Convert between timezones using the ipgeolocation.io API.
ipgeolocation time-conversion [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--tz_from |
string | "" |
Timezone to convert from. |
--tz_to |
string | "" |
Timezone to convert to. |
--location_from |
string | "" |
Location to convert from. |
--location_to |
string | "" |
Location to convert to. |
--lat_from |
float64 | 0 |
Latitude to convert from. |
--long_from |
float64 | 0 |
Longitude to convert from. |
--lat_to |
float64 | 0 |
Latitude to convert to. |
--long_to |
float64 | 0 |
Longitude to convert to. |
--iata_from |
string | "" |
IATA code to convert from. |
--iata_to |
string | "" |
IATA code to convert to. |
--icao_from |
string | "" |
ICAO code to convert from. |
--icao_to |
string | "" |
ICAO code to convert to. |
--lo_from |
string | "" |
LO code to convert from. |
--lo_to |
string | "" |
LO code to convert to. |
--time |
string | "" |
Time to convert. |
--output |
string | pretty |
Output format: pretty, raw, table, yaml. |
Convert from one timezone to another:
ipgeolocation time-conversion --tz_from America/New_York --tz_to Europe/LondonConvert from one location to another:
ipgeolocation time-conversion --location_from New York --location_to LondonConvert from one latitude and longitude to another:
ipgeolocation time-conversion --lat_from 37.7749 --long_from -122.4194 --lat_to 51.509865 --long_to -0.118092Convert from one IATA code to another:
ipgeolocation time-conversion --iata_from DXB --iata_to JFKConvert from one ICAO code to another:
ipgeolocation time-conversion --icao_from KATL --icao_to EWRConvert from one LO code to another:
ipgeolocation time-conversion --lo_from DEBER --lo_to JFKOutput as YAML:
ipgeolocation time-conversion --tz_from America/New_York --tz_to Europe/London --output=yamlFor further information, please visit Time Conversion API Documentation.
The astronomy command uses the ipgeolocation.io Astronomy API
to fetch astronomy-related data such as:
- Sunrise and sunset
- Solar noon
- Moonrise and moonset
- Moon phase
- Day length
- Timezone-based or coordinate-based location support
You can specify the location using IP, city name, coordinates, or timezone.
API Reference: https://ipgeolocation.io/astronomy-api.html
ipgeolocation astronomy [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--ip |
string | "" |
IPv4 or IPv6 address. |
--location |
string | "" |
City name. |
--latitude |
float64 | 0 |
Latitude. |
--longitude |
float64 | 0 |
Longitude. |
--lang |
string | "" |
Response language (if supported). |
--tz |
string | "" |
Timezone. |
--elevation |
float64 | 0 |
Elevation. |
--output |
string | pretty |
Output format: pretty, raw, table, yaml. |
Get astronomy info about your current IP:
ipgeolocation astronomyGet astronomy info about a specific location:
ipgeolocation astronomy --location "New York"Get astronomy info about a specific timezone:
ipgeolocation astronomy --tz "America/New_York"Get astronomy info about a specific latitude and longitude:
ipgeolocation astronomy --latitude 37.7749 --longitude -122.4194Output as raw:
ipgeolocation astronomy --ip 8.8.8.8 --output=rawFor further information, please visit Astronomy API Documentation.
The astronomy-timeseries command uses the ipgeolocation.io Astronomy API
to fetch astronomy-related data such as:
- Sunrise and sunset
- Solar noon
- Moonrise and moonset
- Moon phase
- Day length
- Timezone-based or coordinate-based location support
ipgeolocation astronomy-timeseries [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--ip |
string | "" |
IPv4 or IPv6 address. |
--location |
string | "" |
City name. |
--latitude |
float64 | 0 |
Latitude. |
--longitude |
float64 | 0 |
Longitude. |
--lang |
string | "" |
Response language (if supported). |
--start-date |
string | "" |
Start date (e.g. 2023-01-01) Only YYYY-MM-DD. |
--end-date |
string | "" |
End date (e.g. 2023-12-31) Only YYYY-MM-DD |
--output |
string | pretty |
Output format: pretty, raw, table, yaml. |
- The
start-dateandend-dateflags are required. - The
start-dateandend-dateshould be in YYYY-MM-DD format. - The
start-dateandend-dateshould be less than 90 days.
Get astronomy info about your current IP:
ipgeolocation astronomy-timeseries --start-date 2023-01-01 --end-date 2023-01-02Get astronomy info about a specific location:
ipgeolocation astronomy-timeseries --location "New York" --start-date 2023-01-01 --end-date 2023-01-02Get astronomy info about a specific latitude and longitude:
ipgeolocation astronomy-timeseries --latitude 37.7749 --longitude -122.4194 --start-date 2023-01-01 --end-date 2023-01-02Output as raw:
ipgeolocation astronomy-timeseries --ip 8.8.8.8 --start-date 2023-01-01 --end-date 2023-01-02 --output=rawFor further information, please visit Astronomy Timeseries API Documentation.
The parse-user-agent command uses the ipgeolocation.io User Agent Parser API
to parse user agent strings and extract relevant information such as:
- Device type
- Operating system
- Browser
- Browser version
- Device vendor
- Device model
ipgeolocation parse-user-agent [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--user-agent |
string | "" |
User agent string. |
--output |
string | pretty |
Output format: pretty, raw, table, yaml. |
Parse a user agent string:
ipgeolocation parse-user-agent --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"Output as raw:
ipgeolocation parse-user-agent --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" --output=rawFor further information, please visit User Agent Parser API Documentation.
The parse-bulk-user-agents command uses the ipgeolocation.io Bulk User-Agent Parser API
to parse multiple user agent strings and extract relevant information such as:
- Device type
- Operating system
- Browser
- Browser version
- Device vendor
- Device model
ipgeolocation parse-bulk-user-agents [flags]| Flag | Type | Default | Description |
|---|---|---|---|
--user-agents |
string[] | [] |
User agent strings. |
--output |
string | pretty |
Output format: pretty, raw, table, yaml. |
- The
user-agentsflag is required. - The
user-agentsflag should be an array of user agent strings.
Parse multiple user agent strings:
ipgeolocation parse-bulk-user-agents --user-agents "Mozilla/5.0 (Windows NT 10.0; Win64; x64)","curl/7.64.1"Output as raw:
ipgeolocation parse-bulk-user-agents --user-agents "Mozilla/5.0 (Windows NT 10.0; Win64; x64)","curl/7.64.1" --output=rawFor further information, please visit Bulk User Agent Parser API Documentation.
This project is released under the MIT License.