Retrieve target ID
This document explains how to retrieve the target_id for a specific target in the Invicti Platform. The target_id is required when integrating Invicti functionality into your custom applications, scripts, or workflows using the Invicti API.
You can obtain the target_id in two ways:
- Through the Invicti Platform UI
- By sending a GET request to the Invicti API
Through the Invicti Platform UI
To navigate to the target settings inside the UI and copy the target_id from the URL, follow these steps:
- Select Inventory > Targets from the left-side menu.
- Find the target for which you want to obtain the target_id.
- Click on the target to open its drawer.
- The target ID is listed in the Details section.
By sending a GET request to the Invicti API
Use the provided command to make a GET request to the Invicti Platform API and retrieve a list of targets with a filter applied.
Here is a breakdown of the command:
- https://platform.invicti.com/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".
- -H "Accept: application/json": specifies that the client expects JSON-formatted responses from the server.
- -H "X-Auth: [API-Key]": provides authentication to the Invicti Platform API using an API key. Replace the API-Key with the actual API key.
curl -i -k -X GET https://platform.invicti.com/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. Here is the response with the target_id highlighted: