# Send your own matching results

> Send the matching result you already have with each track, and what is checked.

Matching compares each track with other recordings. An account chooses how, under **Matching** in the console:

- **Through WAVBEE's account:** we match each track.
- **Through your own account:** you connect it, and we match each track there.
- **With results you already have:** you send each track's result with the release, and nothing is scanned here.

It is off until you choose. This page is about the third. Where wavbee delivers your releases, only WAVBEE can let you
choose it.

## Send a result with each track

Add `matching_result` to the track on `POST /v1/qc/runs`, at tier 2 or above. It is the file object
ACRCloud File Scanning answers for that file, as it is. The API's whole answer, `{ "data": [ … ] }` with that one file,
is taken too.

```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" },
      "matching_result": {
        "id": "9f2c1b7e",
        "name": "monsoon-letters.wav",
        "duration": 213,
        "state": 1,
        "results": {
          "music": [{
            "offset": 0, "played_duration": 180,
            "result": { "title": "Monsoon Letters", "artists": [{ "name": "Aruvi" }], "score": 92, "external_ids": { "isrc": "INH012600001" } }
          }],
          "cover_songs": [],
          "ai_detection": [{ "stem": "original", "prediction": "human", "ai_probability": 4 }],
          "music_speech": [{ "label": "m", "start": 0, "end": 213 }]
        }
      }
    }]
  }'
```

## What is checked

| A result | Otherwise |
|---|---|
| is finished: its `state` is `1`, or `-1` for nothing found | `422 matching_result_invalid` |
| has its `id`, its `duration` in seconds and its `results` | `422 matching_result_invalid` |
| is at most 2 MB, and all of a request's together at most 20 MB, on at most 200 tracks | `422 matching_result_invalid` |
| has at most 2,000 matches, 5,000 `ai_detection` and 10,000 `music_speech` entries | `422 matching_result_invalid` |
| comes from your server with a secret key, for an account set to send them | `422 matching_result_not_allowed` |
| is of the same audio: its `duration` agrees with the track we measure, to 2 seconds | The matching checks report `not_run`: "The scan sent is for a file of a different length" |

Send the result of exactly the file you send. When the master changes, send the new file's result with the new run: a
result is used only for the run it came with. A track with no result is not matched anywhere else. Its matching checks
report `not_run`, "no result was sent", and the reviewer is told. Send it with a later run of the same release.

Results are taken only on `POST /v1/qc/runs`. A draft cannot hold one, and the release builder and
`POST /v1/qc/validate` do not read one, so that nobody can hide a match from a browser.

## Whose results they are

Every finding read from one says so: `matching_source` is "Sent by" and your account's name. The report and the
`qc.run.completed` webhook list every track under `matching`:

```json
{ "matching": [
  { "track_number": 1, "used": true, "source": "sent", "label": "Sent by Kayal Records" },
  { "track_number": 2, "used": false, "source": "none", "label": "Not scanned: no result was sent", "reason": "not_sent" }
] }
```

`source` is `sent`, `scan` (scanned through us), `simulated` (test keys only) or `none`.
