# Quickstart

> Verify yourself in sandbox with your own passport or driving licence: the API calls from the command line, the liveness test and the photo with the SDK.

## Before you start

This guide runs an identity verification end to end in [sandbox](environments.md), with you as the person: a liveness test with your camera, then a photo of your own passport or driving licence. Sandbox runs the same checks as live and deletes everything within 24 hours. You need:

- an Aqoonsi application and a **sandbox** API key (`aq_test_…`) with the scopes `people:write`, `consents:write`, `verifications:read`, `verifications:write` and `claims:read`. Create one under **Developers → API tokens** in the [dashboard](https://app.aqoon.si/developers/keys);
- `curl`, `jq` and `uuidgen`, and a page that runs the [SDK](capture.md) with a camera;
- your own passport or driving licence.

Run each block in order and check its response before you continue.

## Set up your shell

Export your key and define a helper that sends the JSON:API headers:

```bash
export AQOONSI_KEY=aq_test_...
BASE=https://api.aqoon.si/v1
MEDIA=application/vnd.api+json

api() {
  curl --silent --show-error --fail-with-body \
    -H "Authorization: Bearer $AQOONSI_KEY" \
    -H "Accept: $MEDIA" -H "Content-Type: $MEDIA" "$@"
}
```

## Create a person

A person holds what the subject told you. Nothing about them is verified yet. Use your own names and date of birth as your document shows them: the document is compared with them.

```bash
PERSON=$(api "$BASE/people" --data '{
  "data": {
    "type": "people",
    "attributes": { "givenName": "Your given name", "familyName": "Your family name", "dateOfBirth": "1990-01-31" }
  }
}') && PERSON_ID=$(printf '%s' "$PERSON" | jq -er '.data.id')
```

The response is `201 Created` with the new `people` resource.

## Record consent

Record consent once the person has agreed, with the version of the notice they saw: `biometricProcessing` for the liveness test and the face comparison. The example uses a sample version.

```bash
for PURPOSE in biometricProcessing; do
  api "$BASE/consents" --data "{
    \"data\": {
      \"type\": \"consents\",
      \"attributes\": { \"purpose\": \"$PURPOSE\", \"version\": \"2026-11\" },
      \"relationships\": {
        \"subject\": { \"data\": { \"type\": \"people\", \"id\": \"$PERSON_ID\" } }
      }
    }
  }"
done
```

## Start the verification

The verification names the person and nothing else. Send an `Idempotency-Key` so a retry never creates a second verification.

```bash
VERIFICATION=$(api "$BASE/verifications" \
  -H "Idempotency-Key: $(uuidgen)" --data "{
    \"data\": {
      \"type\": \"verifications\",
      \"attributes\": { \"kind\": \"identityDocument\" },
      \"relationships\": {
        \"subject\": { \"data\": { \"type\": \"people\", \"id\": \"$PERSON_ID\" } }
      }
    }
  }") && VERIFICATION_ID=$(printf '%s' "$VERIFICATION" | jq -er '.data.id')
```

The response is `201 Created` with `status: pending`, `accepted` listing passports and driving licences, and `number: unavailable`: sandbox asks no national registry.

## Take the liveness test and photograph the document

The person's steps need a camera: sandbox runs the same checks as live. Issue a capture token for the verification:

```bash
TOKEN=$(api "$BASE/verifications/$VERIFICATION_ID/sessions" \
  -H "Idempotency-Key: $(uuidgen)" --data '{
    "data": { "type": "verificationSessions", "attributes": {} }
  }' | jq -er '.meta.secret')
```

Pass `$VERIFICATION_ID` and `$TOKEN` to the SDK's `createDocumentSession` in a page of yours, with the front camera for the liveness test and the rear camera or a file for the document (see [capture](capture.md#running-the-identity-verification)). Take the test in front of the camera, then photograph your passport's data page, or both sides of your driving licence.

## Read the result

Aqoonsi reads the document, compares it with the person and the face from the liveness test with its photo, and decides, in a few seconds. Poll until the status is `verified` or `failed`:

```bash
until api "$BASE/verifications/$VERIFICATION_ID" |
  jq -e '.data.attributes.status | IN("verified", "failed")' >/dev/null; do sleep 1; done

api "$BASE/verifications/$VERIFICATION_ID" | jq '.data.attributes'
api --globoff "$BASE/claims?filter[verification]=$VERIFICATION_ID"
```

The verification reports `status: verified` and `assurance: documentVerified`. The claims list the facts the document showed, each with its source. Sandbox deletes the person, the photos and the verification within 24 hours.

## Next steps

- Try a mismatch: change the person's date of birth and run it again (`documentMismatch`).
- Move the person's steps to their phone or browser with [capture](capture.md).
- Get notified instead of polling with [webhooks](webhooks.md).
