The Command Line Interface

Several weeks ago we announced our new Python client library. We love to see how our users not only use our API for their internal products and services, but also for their commercial products. This month we introduce the first command line interface (CLI) tool to access our API services. Using the Python Library we currently use for our in-house developments (we are a Python house) we have developed and hosted the source code on Github. Following our strong commitment with the community,  we have released it under the Apache 2.0 license, so feel free to collaborate with us to improve it!

How to install it

Since this library is based on our Python library, we support Python 2 and 3, for versions 2.7+ and 3.4+ respectively. It is recommended that Python 2 users use python 2.7.9+ to take advantage of the SSL Certificate Validation feature that is not included in earlier versions. You can install the Command Line Interface tool with pip:

$ pip install apilityio-cli

Or with easy_install:

$ easy_install apilityio-cli


You can read the Command Line Interface documentation hosted in The user can start using the CLI right away, even without registering in the service! If you have any question you can visit the website at, review the REST API specification at and also read the User Guide at

Verify installation

To verify if the command has been successfully installed, the user can open a terminal in the target Operating System and type the apility command as follows:

$ apility
 usage: apility [-h] [--apikey APIKEY] [--config CONFIG]
                      [--format {XML,CSV,TEXT,JSON}]
                      [--tableonly TABLEONLY] [--rows ROWS] [--page PAGE]
                      [--timestamp TIMESTAMP]
 apility: error: the following arguments are required: command, parameter

If the command is not found in the PATH of the user’s session probably the tool has not been installed correctly. Please contact our support team or check our issue tracker.

Use the CLI without an API KEY (anonymous mode)

If the user does not provide a valid API KEY the CLI tool will work in anonymous mode. In this mode, the API has a limit of 100 hits per day and per IP address, enough for quick testing and sporadic use. If the user needs more hits then he/she has to register in our site and obtain a valid API KEY. The FREE plan allows 250 hits per day. If you need more hits per day you should consider an upgrade to some of our paid plans.

Use the CLI with an API KEY

If the user already has a valid API KEY then he/she has to pass it with the CLI. There are three different ways to do it:

  • Use the –apikey optional parameter in every single command executed.
  • Create an environment variable called APILITYIO_API_KEY and assign the API KEY before executing any command.
  • Write a configuration file readable by the command line tool.

You can learn more about how to configure the tool reading the documentation in

Export Formats

The command line interface tool permits different export formats depending on how you want to manage data:

  • TEXT: Key/value or Tabular text output depending on the number of results and the parameter –tableonly.
  • CSV: Tabular comma-separated output. Strings are inside double quotes and lists of elements are separated by semicolons.
  • JSON: Direct dump of the JSON format used by the REST API.
  • XML: Transformation of the JSON format to XML.

Example 1, Check an IP address and show data in Text format:

Check if an IP address or a list of IP addresses belong to any list of the blacklist databases of It also returns the blacklists where the IP addresses were found. IP addresses are passed as a comma-separated list. For details about all fields returned by the call read

Example single IP address:

$ apility badip
| ! | IP ADDRESS |     BLACKLISTS    |
| ! |   | STOPFORUMSPAM-365 |
|   |            |  STOPFORUMSPAM-90 |
|   |            | STOPFORUMSPAM-180 |

Example multiple IP addresses:

$ apility badip,,,
| ! | IP ADDRESS |     BLACKLISTS    |
| ! |   | STOPFORUMSPAM-365 |
|   |            |  STOPFORUMSPAM-90 |
|   |            | STOPFORUMSPAM-180 |
|   |   |                   |
|   |            |    IANA-BOGONS    |
|   |   |                   |

Example 2, Check a domain and show data in Text format:

Check if a domain or a list of Domain and its MX and NS records belong to any list of the blacklist databases of It returns a list of the scoring and blacklists where the Domains info were found. For details about all fields returned by the call read

$ apility badip baddomain
| KEY                   | VALUE                   |
| SCORE                 | -2                      |
| DOMAIN                |          |
| DOMAIN SCORE          | -2                      |
|                       | DEA                     |
|                       | MARTENSON-DED           |
|                       | IVOLO-DED               |
| MX BLACKLISTS         | LISINGE-DED             |
|                       | IVOLO-DED               |
|                       | MARTENSON-DED           |
|                       | DEA                     |
| MX HOSTS              |     |
|                       |    |
| NS BLACKLISTS         |                         |
| NS HOSTS              | |
|                       | |
| DOMAIN IP             |           |
| DOMAIN IP SCORE       | -1                      |
|                       | IVOLO-DED-IP            |
|                       | MARTENSON-DED-IP        |
| DOMAIN IP QUARANTINED | False                   |
| SOURCE IP             |          |
| SOURCE IP SCORE       | 0                       |
| SOURCE IP BLACKLISTS  |                         |
| SOURCE IP QUARANTINED | False                   |

API Documentation

This CLI has been built around the python library. You can read the Python Library documentation here:

You can also read the original REST API specification here:

What’s next?

So now you can start coding or integrate our library with your application or service! And we would like to know about it! So please don’t hesitate and contact us to tell us about your product or service!