How to import API Inventory from HAR file using Astra-cli
Last updated: November 20, 2026
If you have a HAR file, you can feed it to Astra with astra-cli, which turns the recorded requests into traces and sends them to your Astra dashboard to build your API inventory. This works without running a proxy.
You can also upload a HAR file straight to the target in the dashboard, which needs no CLI and no Docker. Read 📄 How to generate a HAR file and 📄 How to import your API endpoints.
If you are using a HAR file because some URLs are missing from your scan results, read Why certain URLs may not appear in the scan sitemap.
Before you start
An API target in Astra. Importing through
astra-clibuilds the inventory of an API target.Astra Traffic Collector running on your machine. It receives the traces from
astra-cliand sends them to Astra. Set it up first with 📄 How to set up Astra Proxy Service integration using astra-cli.A valid
astra.envfile from that setup.A HAR file. Read 📄 How to generate a HAR file.
Import the HAR file
Go to the folder that holds
astra-cli,astra.envand your HAR file.Run the parser.
On Mac and Linux:
chmod +x astra-cli ./astra-cli parser -t har -f yourHarFile.har -e astra.envOn Windows:
./astra-cli.exe parser -t har -f yourHarFile.har -e astra.envCheck that the traces were sent:
./astra-cli collector logs --since=15mOpen API Security, then API Endpoints in the dashboard. The endpoints from your HAR file appear after a short delay.
The collector logs show trace lines for the requests from your HAR file. If they are empty, read the troubleshooting section below.
Troubleshooting
Traces aren't created, or don't reach Astra
What you see: The endpoints aren't in your inventory. One of these is the cause:
The requests in the HAR file return something other than a 2xx or 3xx response. Astra CLI creates traces only for those responses.
The host of the requests isn't in
ALLOWED_HOSTS.The
astra.envfile is incomplete or wrong.
What to do:
Check that
SENSOR_ID,ALLOWED_HOSTS,COLLECTOR_ID,CLIENT_IDandCLIENT_SECRETare set inastra.env.Run
./astra-cli validate -e astra.env.Read the collector logs. Read 📄 How to inspect logs using astra-cli.
The target is a web target, not an API target
Why: The traffic connector integrations this import needs are set up for API targets.
What to do: Upload the HAR file in the target's Definition Files instead. Read 📄 How to import your API endpoints.