Retrieving the target_id for a specific Target

This guide provides step-by-step instructions on how to retrieve the target_id for a specific target. By following the steps outlined in this guide, you will learn how to leverage the Acunetix API to enable seamless integration of Acunetix functionality into custom applications, scripts, or workflows.

There are two ways to generate the target_id:

  1. Through a GET request
  2. Through the Acunetix UI

How to retrieve the target_id through a GET request

Use the provided command to make a GET request to the Acunetix API and retrieve a list of targets with a filter applied.

Here is a breakdown of the command:

  1. https://127.0.0.1:3443/api/v1/targets?q=localhost: is the URL to which the GET request is sent. It includes the endpoint /api/v1/targets for retrieving targets and a filter q=localhost to filter the results based on target names or descriptions containing "localhost".
  2. -H "Accept: application/json": specifies that the client expects JSON-formatted responses from the server.
  3. -H "X-Auth: [API-Key]": provides authentication to the Acunetix API using an API key. Replace the API-Key with the actual API key.

curl -i -k -X GET https://127.0.0.1:3443/api/v1/targets?q=localhost -H "Accept: application/json" -H "X-Auth: [API-Key]"

  • The provided response includes information about a target, including its target_id. In this example, the target_id is: 1c17ddc4-8592-4744-98be-9d25703c6038. Here's the response with the target_id highlighted:

{
"targets": [
 {
  "address": "http://localhost:5002",
  "agents": null,
  "continuous_mode": false,
  "criticality": 10,
  "default_overrides": null,
  "default_scanning_profile_id": "11111111-1111-1111-1111-111111111111",
  "deleted_at": null,
  "description": "",
  "fqdn": "localhost",
  "fqdn_hash": "77d7e6fbb0a249a2f2c3d5da849834dd",
  "fqdn_status": "in_use",
  "fqdn_tm_hash": "f1fac03175a8439b4510f471e7f94ec9",
  "issue_tracker_id": null,
  "last_scan_date": null,
  "last_scan_id": null,
  "last_scan_session_id": null,
  "last_scan_session_status": null,
  "manual_intervention": false,
  "severity_counts": {
   "critical": 0,
   "high": 0,
   "info": 0,
   "low": 0,
   "medium": 0
  },
 
 "target_id": "1c17ddc4-8592-4744-98be-9d25703c6038",

How to retrieve the target_id through the Acunetix UI

To navigate to the target settings inside the UI and copy the target_id from the URL, follow these steps:

  1. Log in to Acunetix.
  2. Navigate to the Targets section.
  3. Find the target for which you want to obtain the target_id.
  4. Click on the target to open its settings page.
  5. Look at the URL in your browser's address bar. It contains the target_id as a parameter in the URL.
  6. Copy the value of the target_id parameter from the URL.

For example, if the URL in the browser's address bar looks like this:

        

You would copy the value 1c17ddc4-8592-4744-98be-9d25703c6038, which is the target_id.

 

« Back to the Acunetix Support Page