# FraudLens API reference (agent brief)

> Secret key on server. Higher score = cleaner. Pass merchant `user_id` or every assess is deep.

Source: https://fraudlens.io/docs/api/  
OpenAPI: https://fraudlens.io/api/openapi.json  
Schema: https://fraudlens.io/v1/schema  
Updated: 2026-12-04

## Auth
| Key | Prefix | Use |
|-----|--------|-----|
| Publishable | `fk_pk_` | Browser create/collect only |
| Secret | `fk_sk_` | Assess, email, account, billing |

Header: `X-Api-Key: fk_sk_…` (also `?api_key=`).  
Never call `/v1/assess` from the browser.  
Origins: `PUT /v1/account/origins` — empty → `403 origin_allowlist_required`.

## POST /v1/assess
Merge email + live network + dossier → `score`, `action`, reasons.

```
POST https://fraudlens.io/v1/assess
X-Api-Key: fk_sk_…
Idempotency-Key: <uuid>
{
  "email": "user@shop.com",
  "session_id": "ses_…",
  "user_id": "usr_123",
  "watch_mode": "new_only",
  "policy": "balanced",
  "context": { "flow": "signup" }
}
```

### Important fields
- `user_id` — **your** shop end-user id (required for dossier / light reuse)
- `watch_mode` — `new_only` (First-sync) · `continuous` (Always-on)
- `force_deep` — bill 1 even on trusted revisit (payouts)
- `expand` — `slim` (default) · `full`

### Core response
`score`, `action`, `raw_action`, `reasons[]`, `email`, `network`, `billing.check_kind`, `support`, optional `dossier` / `timeline` / `profile`.

## Network (all plans)
- `POST /v1/network/sessions` (alias `/v1/x`) → nonce
- `POST /v1/network/sessions/{id}/collect` (alias `/v1/x/{id}/c`)
- Browser SDK: `/c.js` → `FX.auto({ publishableKey, hang: "page", form: "#signup" })` (recommended)
- Merchant maps `action` → UX: https://fraudlens.io/docs/decisions/

## Email
`GET /v1/email/{email}` — mailbox reputation (secret key).

## Account
Origins, webhook, shadow, decision-policy, keys rotate, stats, profiles.

## Billing
`GET /v1/billing/summary` — credits, `credits_refresh_at`, `open_trial`.  
Crypto = NOWPayments. Card = Telegram interest (not Stripe).

## Credits
| Kind | Credits |
|------|---------|
| first_sync_deep / always_on_deep / forced_deep | 1 |
| always_on_light / new_only_trusted | 0 |
| session create / collect | 0 |

IP-only same ASN → not deep. Rolling 30-day buckets. Exhausted → `429`.

## Errors
401 unauthorized · 402 plan_upgrade_required · 403 origin_* / publishable_key_forbidden · 429 rate_limited
