Reuse a Target Across Scans
A target owns its recon profile, so once a target exists you can scan it again and again without re-describing your application or re-running recon. This is the common case for scheduled or CI scans: the target was set up once — in an earlier run or in the dashboard — and every later scan just fetches it by id.
Use getTarget when you already have a target’s id. Unlike createOrGetTarget, it is
read-only: it never creates a target or runs recon. It throws if no target with that id
exists or the caller cannot access it.
Get the target’s id
There are two ways to obtain the id:
- Read
target.targetId(TypeScript) /target.target_id(Python) from theTargetreturned bycreateOrGetTargetin an earlier run, and store it. - Open the target in the dashboard and copy the id from the URL:
/targets/<targetId>.
Fetch the target and scan it
Fetch the existing target by id, then pass its targetId to createScan. No recon runs
and no handler is needed to acquire the target — the stored profile is reused.
TypeScript
Python
The handler passed to scan.run still drives the attack sessions — reusing a target
only skips recon, not the scan itself.
If the target’s underlying application has changed since it was created, its stored
recon profile may be stale. See
runRecon in the SDK Reference to refresh it
before scanning.