# Add a vendor score

Add Fingerprint's bot detection to Identify with your own key, read it as vendor_score next to Identify's bot_score, and act on it in your traffic policy.

Add a bot-detection vendor's judgement to every verdict with your own key. Identify reports it as `vendor_score`, labelled with the vendor's name, next to its own rule-based `bot_score` and never merged with it. Provenance adds no markup to your vendor plan.

**Before you begin:** a Fingerprint account with Bot Detection, its secret Server API key, and its JavaScript agent on your pages sending each visit's `requestId` to your server in the `x-fingerprint-request-id` header.

| Vendor | Where it runs | Key |
| --- | --- | --- |
| Fingerprint | The hosted check, the Node and Python middleware, the edge templates | Yours |
| Cloudflare Bot Management | The Cloudflare Worker template | None; read from the request |

## 1. Store your key for the hosted check

**curl**

```bash
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5

curl -s -X PATCH $PROVENANCE_API/v1/identify/vendors/fingerprint \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "api_key": "fp_live_secret_example_0001", "region": "us" }'
```

**Node**

```ts
await fetch(`${process.env.PROVENANCE_API}/v1/identify/vendors/fingerprint`, {
  method: "PATCH",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ api_key: process.env.FINGERPRINT_SECRET_KEY, region: "us" }),
});
```

**Python**

```python
import os, httpx

httpx.patch(f"{os.environ['PROVENANCE_API']}/v1/identify/vendors/fingerprint",
          headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"},
          json={"api_key": os.environ["FINGERPRINT_SECRET_KEY"], "region": "us"})
```

```json
{ "id": "fingerprint", "object": "identify_vendor", "configured": true, "region": "us", "key_last4": "0001" }
```

The key is encrypted at rest and never returned.

## 2. Or pass it to the middleware

The middleware calls Fingerprint from your own servers, so the key stays in your environment:

```ts
import { Identify } from "@provenanceauth/identify";
import { fingerprintProvider } from "@provenanceauth/identify/vendors";

const fp = fingerprintProvider({ apiKey: process.env.FINGERPRINT_SECRET_KEY!, region: "us" });
const identify = new Identify({ apiKey: process.env.PROVENANCE_KEY, vendorScore: (req) => fp.score(req) });
```

## 3. Read vendor_score

| `status` | Meaning |
| --- | --- |
| `ok` | `score` is 1 for Fingerprint's `bad` or `good` (a known bot) and 0 for `notDetected`; `label` is Fingerprint's answer. |
| `absent` | The request carried no Fingerprint `requestId`. |
| `not_configured` | No key is set. |
| `error` | Fingerprint answered with an error; `message` says what. |
| `quota_exhausted` | Your Fingerprint plan's limit was reached. |

Nothing is ever scored in a vendor's place. A signed agent stays `signed_agent` whatever its vendor score.

## 4. Act on it in your policy

```json
{ "id": "block-vendor-bad", "when": [{ "fact": "agent.class", "op": "ne", "value": "signed_agent" }, { "fact": "vendor_score", "op": "gte", "value": 1 }], "then": { "action": "challenge" } }
```

## 5. Remove the key

Remove the key to stop scoring; verdicts then report `not_configured`.

**curl**

```bash
curl -s -X DELETE $PROVENANCE_API/v1/identify/vendors/fingerprint \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
await fetch(`${process.env.PROVENANCE_API}/v1/identify/vendors/fingerprint`, {
  method: "DELETE",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}` },
});
```

**Python**

```python
httpx.delete(f"{os.environ['PROVENANCE_API']}/v1/identify/vendors/fingerprint",
             headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"})
```

```json
{ "id": "fingerprint", "object": "identify_vendor", "deleted": true }
```

## Errors you might see

| Symptom | Cause | Fix |
| --- | --- | --- |
| `503` [`identify_vendor_not_configured`](https://provenanceauth.com/docs/platform/errors.md#identify_vendor_not_configured) on the key test | No key is stored | Store it (step 1). |
| `502` [`identify_vendor_error`](https://provenanceauth.com/docs/platform/errors.md#identify_vendor_error) on the key test | Fingerprint refused the key or the request id | Check the key and the region in Fingerprint's dashboard. |
| `vendor_score.status` is always `absent` | Your pages don't send the `requestId` | Forward it in `x-fingerprint-request-id`. |

## See also

- [Run Identify at the edge](https://provenanceauth.com/docs/identify/guides/run-at-the-edge.md): Cloudflare's score
- [Write a traffic policy](https://provenanceauth.com/docs/identify/guides/traffic-policy.md)
- [Signals and categories](https://provenanceauth.com/docs/identify/reference/signals.md)
