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

Last updated: June 12, 2026

Introduction

This guide explains how to import an existing HAR file into Astra using astra-cli to populate your API inventory. This is useful when you want to discover and register API endpoints captured from browser traffic — without needing a live proxy setup.

Prerequisites

Before you begin, make sure the following is already running on your system:

  • Astra Traffic Collector — receives parsed traffic from astra-cli and sends it to your Astra dashboard

  • Set up via astra-cli

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

Instructions

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. 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

How to inspect logs of Astra Traffic Collector

📄 How to inspect logs using astra-cli