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

Import the HAR file

  1. Go to the folder that holds astra-cli, astra.env and your HAR file.

  2. Run the parser.

    On Mac and Linux:

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

    On Windows:

    ./astra-cli.exe parser -t har -f yourHarFile.har -e astra.env
  3. Check that the traces were sent:

    ./astra-cli collector logs --since=15m
  4. Open 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.env file is incomplete or wrong.

What to do:

  1. Check that SENSOR_ID, ALLOWED_HOSTS, COLLECTOR_ID, CLIENT_ID and CLIENT_SECRET are set in astra.env.

  2. Run ./astra-cli validate -e astra.env.

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