How to import API Inventory from HAR file using Astra-cli

Last updated: August 18, 2025

Overview

This guide explains how to populate API inventory from HAR files using Astra-Cli.


Prerequisites

You need to have Astra Traffic Collector running with astra-cli

📄 How to Setup Astra Proxy Service Integration using astra-cli


How to use Astra-cli to populate API Inventory from HAR file

Now the Astra Traffic Collector is running in your laptop, it's time to run Astra-cli with HAR files and populate the API Inventory

1. How to capture HAR files in web browser

Follow this simple guide to understand how to save HAR file for different browser.

2. How to run Astra-cli with HAR file

For Mac & Linux:

chmod +x astra-cli
./astra-cli parser -t har -f yourHarFile.har -e astra.env

For Windows:

./astra-cli.exe parser -t har -f yourHarFile.har -e astra.env

3. That's it!!! You will now be able to see API endpoints present in your HAR file in Astra dashboard

Run the following command and confirm the whether tracing was done successfully.

./astra-cli collector logs --since=15m

Troubleshooting

I can't see API endpoint in my dashboard

Symptoms

  • I have configured the astra-traffic-collector. I don't see any API endpoint entry in my inventory even after successfully running the astra-cli with HAR file.

Causes

  • Requests in HAR file have status code other than 2XX or 3XX.

Solution

  • Astra Cli generates the trace only for the 2XX and 3XX response code.

  • Domain is not registered under ALLOWED_HOSTS

  • Misconfigured astra.env file

  • Kindly ensure that SENSOR_ID, ALLOWED_HOSTS, COLLECTOR_ID, CLIENT_ID, CLIENT_SECRET are set in astra.env file. You can run following command to validate the astra.env file

./astra-cli validate -e astra.env

FAQ

1. How to inspect logs of Astra Traffic Collector

📄 How to inspect logs using astra-cli