---
title: "Add and verify a DAST target"
description: "Register a web application, prove you own it with a DNS record or a file, and run the first active scan."
---

A target is one web application or API, named by a URL. Adding it takes a
minute and runs a passive check straight away. Proving you own it is what
unlocks an active scan.

## Add the target

<Steps>
  <Step title="Open DAST and choose Add target">
    Enter the URL a scan should start from, for example
    `https://staging.example.com` or `https://staging.example.com/app`.
  </Step>
  <Step title="Read the first result">
    TRUSTIVAN loads that one page, without credentials, and records what the
    response shows. This is a [passive check](/concepts/dynamic-scanning): it
    sends nothing an ordinary visitor would not.
  </Step>
</Steps>

The URL must be `http` or `https`. It may not contain a username or password,
a query string or a fragment, and its host may not be a private, loopback or
link-local address. The **scope** of every scan is the URL's origin: its
scheme, host and port. `https://staging.example.com` and
`https://staging.example.com:8443` are two targets, and so are the `http` and
`https` versions of one host.

With the API:

```bash
curl -sS -X POST https://app.trustivan.com/api/v1/dast/targets \
  -H "Authorization: Bearer $TRUSTIVAN_KEY" -H "Content-Type: application/json" \
  -d '{"url": "https://staging.example.com"}'
```

The response includes `verification`, which holds what to publish next.

## Prove you own it

Each target has its own token. Publish it in **one** of two places.

<Tabs>
  <Tab title="DNS record">
    Create a `TXT` record:

    | | |
    |---|---|
    | Name | `_trustivan-challenge.staging.example.com` |
    | Type | `TXT` |
    | Value | `trustivan-verify=<your token>` |

    The record goes on the **exact host** of the target. A record on
    `example.com` does not verify `staging.example.com`. Use this method when
    you control the DNS zone, or when the application cannot serve a static
    file.
  </Tab>
  <Tab title="File on the site">
    Serve a plain-text file at:

    ```
    https://staging.example.com/.well-known/trustivan-verification.txt
    ```

    containing the line `trustivan-verify=<your token>`. It must be answered by
    the target itself with status `200`. A redirect to another host is not
    followed. A target given as an IP address can only be verified this way.
  </Tab>
</Tabs>

Then choose **Check now** on the target (or
`POST /dast/targets/{id}/verify`). The check answers immediately:

- **Verified**, with the method that worked. The next scan is active.
- **Not verified**, with the reason for each method: the record was not found,
  the file answered `404`, the value did not match. DNS changes can take a few
  minutes to be visible; check again.

<Note>
The token is per target and per organization. If another organization adds the
same host, it is given a different token, and your record does not verify
theirs.
</Note>

## Keep the proof published

Verification is not a one-time step. **Before every active scan**, including
scheduled ones, TRUSTIVAN looks for the token again. If it is gone, that scan
is passive, the target shows as unverified with the reason, and it stays
unverified until you publish the token and choose **Check now**. Leave the
record or the file in place for as long as you want active scans.

If the check gets no answer rather than a no (a DNS timeout, your site down or
answering `5xx`), that one scan is passive and says so in a warning. The target
stays verified and the next scan checks again, so a brief outage does not turn
your scheduled scans passive.

To stop active scans of a target, remove the token.

## Run an active scan

Choose **Scan now** on a verified target, or:

```bash
curl -sS -X POST https://app.trustivan.com/api/v1/dast/targets/$TARGET_ID/scans \
  -H "Authorization: Bearer $TRUSTIVAN_KEY"
```

The scan appears under **Scan history** on the target with its progress and what
it is doing (crawling, testing, collecting findings).
Poll `GET /scans/{id}` for the same thing from a pipeline. One dynamic scan per
organization can be queued or running at a time.

To stop it, choose **Cancel** or `POST /scans/{id}/cancel`. A cancelled scan
records no findings.

## Schedule it

Open **Schedule** on the target and set it to hourly, daily or weekly. This is the same
schedule every asset has (`PUT /assets/{id}/schedule`), and it is subject to
the same plan limits.

## Remove a target

**Remove** deletes the target, its verification and any stored credential. Its
asset, past scans and findings are kept; archive the asset to take those out
of view.

## Permissions

| Action | Permission |
|---|---|
| See targets | `assets:read` |
| Add, change, verify or remove a target | `assets:write` |
| Start or cancel a scan | `scans:create` |

These apply to API keys as well as to people.
