Install the ipdata CLI

Easily make single and bulk IP lookups from your terminal with ipdata's Command Line Interface.

Installation

Install the latest version of the cli with pip.

python3 -m pip install ipdata

Initialize the cli with your API Key

You need a valid API key from ipdata to use the cli. You can get a free key by Signing up here.

➜ ipdata init <<apiKey>>
 _           _       _
(_)_ __   __| | __ _| |_ __ _
| | '_ \ / _` |/ _` | __/ _` |
| | |_) | (_| | (_| | || (_| |
|_| .__/ \__,_|\__,_|\__\__,_|
  |_|

✨ Successfully initialized.     

You can also pass the --api-key <API Key> parameter to any command to specify a different API Key.

Available commands

➜ ipdata --help
Usage: ipdata [OPTIONS] COMMAND [ARGS]...

  Welcome to the ipdata CLI

Options:
  --api-key TEXT  Your ipdata API Key. Get one for free from
                  https://ipdata.co/sign-up.html
  --help          Show this message and exit.

Commands:
  lookup*   Lookup resources by using the IPData class methods.
  batch     Batch command for doing fast bulk processing.
  init      Initialize the CLI by setting an API key.
  usage     Get today's usage.
  validate  Validates a geofeed file. 

Look up your own IP address

Running the ipdata command without any parameters will look up the IP address of the computer you are running the command on. Alternatively you can explicitly look up your own IP address by running.

ipdata

Use -f to select the fields you want

ipdata -f ip
{
  "ip": "8.8.8.8",
  "status": 200
}

To pretty print the result pass the -p flag

╭─────────╮
│ ip      │
│ 8.8.8.8 │
╰─────────╯

What’s Next

Learn how to use the CLI in more advanced ways including looking up and parsing data on millions of IP addresses.