4.1. API Quickstart

4.1.1. Install the package

$ pip install axonius-api-client

See also

Installation for more details.

4.1.2. Setup connection information

$ echo "AX_URL=x" >> .env
$ echo "AX_KEY=x" >> .env
$ echo "AX_SECRET=x" >> .env
$ chmod 600 .env

See also

API Key and Secret to get the values for AX_KEY and AX_SECRET.

Connection Options for more details.

4.1.3. Establish a connection

The axonius_api_client.connect.Connect object will connect to the Axonius instance and give you access to the API objects for devices, users, adapters, and enforcements:

import os

import axonius_api_client as axonapi


AX_URL = os.environ["AX_URL"]
AX_KEY = os.environ["AX_KEY"]
AX_SECRET = os.environ["AX_SECRET"]

ctx = axonapi.Connect(


devices = ctx.devices
users = ctx.users
adapters = ctx.adapters

With the Connect object established, now you can use the API models.

4.1.4. Quick Get Assets Example

Here’s a simple example to get a report of all device assets matching a query that shows all assets seen in the last 3 days. Also include the columns for AWS device type and OS Type:

query = '(specific_data.data.last_seen >= date("NOW - 3d"))'
fields = ["aws:aws_device_type", "os.type"]

assets = devices.get(query=query, fields=fields)