---
title: "Quickstart"
description: "Scan your first image on the hosted service at app.trustivan.com: issue an API key, request a scan through the API or the CLI, and read the findings."
---

This gets you from an account to a completed scan and its findings, on the
hosted service at `app.trustivan.com`. Every step is an HTTP request you can
copy, so it works the same from a laptop and from a pipeline.

<Note>
Want to look before you sign in? [The live demo](https://demo.trustivan.com/auth/demo)
opens a read-only organization with real scan results, no account needed.
</Note>

## Before you start

You need `curl` and [`jq`](https://jqlang.org), and an account on
`app.trustivan.com`. Signing up is free:
[app.trustivan.com/auth/login?signup=1](https://app.trustivan.com/auth/login?signup=1)
opens an account and a new organization, and you are its owner. If a
colleague already uses TRUSTIVAN, ask them to invite you instead from
**Settings → Members**, so you join their organization; see
[Getting access](/getting-started/signing-in).

## 1. Issue an API key

Everything after this step is what a pipeline would do, so use a machine
credential rather than your session.

1. Sign in at [app.trustivan.com](https://app.trustivan.com).
2. Open **Settings → API keys** and choose **New key**.
3. Name it `quickstart`, select the scopes `scans:create`, `scans:read` and
   `findings:read`, and choose a lifetime. Expiry is mandatory: there is no key
   that lasts forever.
4. Copy the secret. **It is shown exactly once**: no endpoint reads it back. If
   you lose it, revoke the key and issue another.

```bash Terminal
export TRUSTIVAN_URL=https://app.trustivan.com
export TRUSTIVAN_KEY='twk_...'
```

An API key needs no CSRF header, because unlike a browser cookie it is not
attached to requests automatically. To issue keys from a script instead, see
[Rotate an API key](/how-to/rotate-an-api-key).

## 2. Request a scan

<CodeGroup>

```bash curl
scan=$(curl -s -X POST "$TRUSTIVAN_URL/api/v1/scans" \
  -H "Authorization: Bearer $TRUSTIVAN_KEY" \
  -H 'Content-Type: application/json' \
  -H "Idempotency-Key: quickstart-001" \
  -d '{"image": "alpine:3.19"}')
SCAN_ID=$(jq -r '.scan.id' <<<"$scan")
echo "$SCAN_ID"
```

```bash trustivan CLI
# TRUSTIVAN_API_KEY is the variable the CLI reads; --wait polls for you.
export TRUSTIVAN_API_KEY="$TRUSTIVAN_KEY"
trustivan scan --image alpine:3.19 --wait
```

</CodeGroup>

You get `202` with the scan and asset records. That is **work accepted, not work
done**: pulling and unpacking an image takes seconds to minutes. A `200`
instead means an existing scan was returned, so a client can tell a
deduplicated retry from a new scan.

The `Idempotency-Key` is optional but worth the habit: it is reserved before any
work begins, so two concurrent retries cannot both queue a scan.

The [`trustivan` CLI](/cli-reference/trustivan) does the same requests, and
polls with a deadline. Its release builds are provided to customers; `curl`
needs nothing installed.

## 3. Poll for the result

```bash Terminal
while :; do
  scan=$(curl -s "$TRUSTIVAN_URL/api/v1/scans/$SCAN_ID" \
    -H "Authorization: Bearer $TRUSTIVAN_KEY")
  status=$(jq -r '.scan.status' <<<"$scan")
  echo "$status"
  case "$status" in succeeded|failed|canceled) break ;; esac
  sleep 5
done
jq '.scan.database_state' <<<"$scan"
```

`database_state` reports how fresh the advisory data behind the result was. A
scan run against stale data reports "no vulnerabilities" with exactly the same
confidence as a correct one, which is why TRUSTIVAN surfaces the age rather than
hiding it, and why a sufficiently old database [fails the scan
outright](/configuration/vulnerability-database).

## 4. Read the findings

```bash Terminal
curl -s "$TRUSTIVAN_URL/api/v1/findings?order=recent&limit=50" \
  -H "Authorization: Bearer $TRUSTIVAN_KEY"
```

Use `order=recent` for anything that enumerates. It orders by immutable keys, so
the traversal is exhaustive: every finding present when you started and not
deleted is visited exactly once. `order=severity` sorts by a value that changes,
so a re-rated finding can move and be seen twice or missed. Each response reports
`page.stable` so your client can assert this rather than assume it.

The same findings are in the console under **Findings**.

## What you have now

An asset, a scan, and a set of findings that will keep their identity the next
time this image is scanned. From here:

- [Your first scan](/getting-started/first-scan) explains the objects you
  just created.
- [Gate a pipeline on a policy](/tutorials/gate-a-pipeline) turns findings
  into a build decision.
- [Keep an image under watch](/tutorials/schedule-rescans) sets up
  recurring rescans.

## Running TRUSTIVAN yourself

Self-hosting is by agreement: the container images and the source repository
are provided to customers who run TRUSTIVAN on their own infrastructure. If
that is you, start with [Requirements](/installation/requirements) and
[Docker Compose](/installation/docker-compose). The steps above are the same
against your own deployment, with `TRUSTIVAN_URL` set to its address.
