# Account trust

> Send the uploading account; its trust decides whether a clean release goes out at once or to a person.

Some uploaders hide a cover or a sample: they shift its pitch or tempo, or layer other sounds over it, so audio
fingerprinting finds no match. The release passes every check and causes trouble at the stores later. So every release
can name the account that uploaded it, and that account's **trust score** decides whether a clean release goes out at
once or is checked by a person first.

## 1. Send the account

Add `account` to the release, on `POST /v1/qc/runs` and `POST /v1/qc/validate`:

```bash
curl -s -X POST "$ACTIVQC_BASE_URL/v1/qc/runs" \
  -H "Authorization: Bearer $ACTIVQC_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "tier": 3,
    "release": { "title": "Monsoon Letters", "artists": [{ "role": "primary", "name": "Aruvi" }] },
    "tracks": [{ "track_number": 1, "title": "Monsoon Letters", "audio": { "url": "https://cdn.example.com/monsoon-letters.wav" } }],
    "account": { "id": "artist-8812", "trust_score": 35, "name": "Aruvi" }
  }'
```

| Field | What it is |
|---|---|
| `id` | Your own id for the uploading account, 1 to 128 characters. Required. |
| `trust_score` | Optional. Your own score for this release, a whole number from 0 to 100. |
| `name` | Optional. A label for your console, at most 255 characters. |

Anything else in `account`, or a value out of range, is a `422` with `field` naming it (`account.trust_score`), and
nothing is run.

With the [Draft API](https://activqc.wavbee.com/docs/draft-api.md), send `account` when you create or update the draft. When a draft names no
account, its `end_user_ref` is used as the account id, and so is the session's `end_user_ref` in the
[embedded builder](https://activqc.wavbee.com/docs/embed-builder.md). The artist's browser can never set the account or its score.

A release with no account at all is checked as before: TR1 passes and nothing changes.

## 2. The three bands

| Band | Score | What happens |
|---|---|---|
| Low | below 40 | Every release goes to `manual_review`, even a clean one. |
| Medium | 40 to 89 | A clean release goes out. A weak signal sends it to `manual_review`. |
| High | 90 and up | A clean release goes out. |

A **weak signal** is a match too faint to ask the artist about, an AI likelihood from 20% up to where the AI questions
start, or any other warning from the match and AI checks (CM1 to CM3, AI1, AI2).

A new account has no history and starts at **50**, medium. Only a proven account (90 and up) skips the review of a
release with a weak signal by default.

You can move both scores yourself: in the console, open **Accounts** and change **Release without review at**
(`trust.high_at`) and **Review every release below** (`trust.low_below`). It needs the "Change the QC rules"
permission. WAVBEE staff can set them for you too. Leave a box empty to go back to the standard. The review score must
not be higher than the release score. The new scores apply to releases checked from then on, never to releases
already decided. The AI bar (`trust.ai_low_bar`) is set in [your own rules](https://activqc.wavbee.com/docs/qa-config.md).

## 3. Which score is used

1. A score or band that WAVBEE staff have pinned for the account.
2. Your `trust_score` on this release.
3. The score you saved for the account from your own records, until it expires.
4. The score activQC works out from the account's history.

Your `trust_score` counts only for the release it is sent with. To keep a score of your own for an account without
sending it every time, save it once with `PUT /v1/accounts/{id}`, or up to 500 at a time with `POST /v1/accounts/batch`.
[Set up your own trust score](https://activqc.wavbee.com/docs/trust-score-setup.md) explains what to base it on and how to keep it in step with your
database.

## 4. What moves the score

Every account starts at 50. The score stays between 0 and 100.

| History | Points |
|---|---|
| Each release accepted | +2, at most +20 |
| 90 days or older with 5 or more releases | +5 |
| Each release rejected | -15, at most -45 |
| Each time a reviewer confirmed a problem | -25, no limit |
| Each review that found nothing wrong | +3, at most +15 |
| Each match or AI warning | -3, at most -15 |

A reviewer "confirmed a problem" when they rejected the release, or asked for changes for a rights reason. The
history is recounted from the releases themselves each time, so nothing is ever counted twice.

## 5. What you and the artist see

The run's `trust` tells your server what the release was decided with:

```json
{
  "id": 42,
  "verdict": "manual_review",
  "trust": {
    "account_id": "artist-8812",
    "score": 35,
    "band": "low",
    "source": "tenant",
    "reasons": ["the trust_score sent with this release", "3 releases accepted (+6)"]
  }
}
```

`source` is `override` (pinned by WAVBEE staff), `tenant` (your `trust_score` on this release), `saved` (the score you
saved for the account) or `computed`. The
`qc.run.completed` webhook carries the same `trust`. The finding in the report is `TR1`.

**The artist never sees it.** They read only that a member of the team will check the release within 24 hours. The
embedded builder and its run pages leave the score, the band and the reasons out.

## 6. Read an account

```bash
curl -s "$ACTIVQC_BASE_URL/v1/accounts/artist-8812" -H "Authorization: Bearer $ACTIVQC_KEY"
```

```json
{
  "object": "account",
  "id": "artist-8812",
  "score": 56,
  "band": "medium",
  "source": "computed",
  "computed_score": 56,
  "tenant_score": 35,
  "saved_score": null,
  "saved_score_active": false,
  "override_active": false,
  "reasons": ["3 releases accepted (+6)"],
  "bands": { "low_below": 40, "high_at": 90 },
  "counts": { "runs": 3, "accepted": 3, "rejected": 0, "manual_reviews": 0, "reviews_upheld": 0,
              "reviews_cleared": 0, "match_warnings": 0, "ai_warnings": 0 }
}
```

`score` is what a release sent now without a `trust_score` would be decided with. `tenant_score` is the last score you
sent on a release, for reference. `saved_score` is the score you saved, and `saved_score_active` says it is in use
(set and not expired). `override_active` says WAVBEE staff have pinned the account; why they did stays with them. URL-encode
an id that holds `/` or other special characters. A test key reads test accounts, a live key live ones; another
account's id is a `404`.

Your console lists the accounts under **Accounts**, with each one's score and band.
