> ## Documentation Index
> Fetch the complete documentation index at: https://docs.radar.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Fraud overview and quickstart

> Run a device and network risk assessment, use the result on your backend, and learn how signals, risk scores, rules, and checks fit together.

By the end of this page, your app will call `Radar.revealRisk()`, and your backend will verify the signed result and read the risk level and the signals behind it.

> [!NOTE]
>
> Fraud detection and verified location checks are available on the [Enterprise plan](https://radar.com/pricing).

## Quickstart: assess device and network risk

This is the whole client integration. `sendRiskToken` is the function you write that posts the token to your backend, or posts no token when the assessment didn't complete.

```swift Swift theme={null}
import RadarSDK

// At app launch
Radar.initialize(publishableKey: "prj_test_pk_...")

// At the moment you want to assess, such as a login or the start of a payment
Radar.revealRisk { status, risk in
  guard status == .success, let riskToken = risk?.token else {
    // The assessment didn't complete. Your backend treats the risk as unknown.
    sendRiskToken(nil)
    return
  }

  sendRiskToken(riskToken)
}
```

```kotlin Kotlin theme={null}
import io.radar.sdk.Radar
import io.radar.sdk.RadarInitializeOptions

// In Application.onCreate()
Radar.initialize(
  context = this,
  publishableKey = "prj_test_pk_...",
  options = RadarInitializeOptions(fraud = true)
)

// At the moment you want to assess, such as a login or the start of a payment
Radar.revealRisk { status, risk ->
  val riskToken = risk?.token
  if (status != Radar.RadarStatus.SUCCESS || riskToken == null) {
    // The assessment didn't complete. Your backend treats the risk as unknown.
    sendRiskToken(null)
    return@revealRisk
  }

  sendRiskToken(riskToken)
}
```

```javascript JavaScript theme={null}
import Radar from 'radar-sdk-js';
import { createFraudPlugin } from '@radarlabs/plugin-fraud';

// When the page loads
Radar.registerPlugin(createFraudPlugin());
Radar.initialize('prj_test_pk_...');

// At the moment you want to assess, such as a login or the start of a payment
try {
  const risk = await Radar.fraud.revealRisk();
  await sendRiskToken(risk.token ?? null);
} catch (err) {
  // The assessment didn't complete. Your backend treats the risk as unknown.
  await sendRiskToken(null);
}
```

```javascript React Native theme={null}
import Radar from 'react-native-radar';

// At app launch. The second argument turns on fraud detection.
Radar.initialize('prj_test_pk_...', true);

// At the moment you want to assess, such as a login or the start of a payment
try {
  const result = await Radar.revealRisk();
  await sendRiskToken(result.token?.token ?? null);
} catch (err) {
  // The assessment didn't complete. Your backend treats the risk as unknown.
  await sendRiskToken(null);
}
```

Your backend verifies the token with your project's JWT secret key and reads the result. `requireSession` and `riskAssessments` are your own session middleware and store.

```javascript Node.js theme={null}
import express from 'express';
import { jwtVerify } from 'jose';

const app = express();
app.use(express.json());

const secret = new TextEncoder().encode(process.env.RADAR_JWT_SECRET_KEY);

app.post('/api/risk', requireSession, async (req, res) => {
  let assessment;
  try {
    // Checks the signature and the expiry, and accepts HS256 only.
    ({ payload: assessment } = await jwtVerify(req.body.riskToken ?? '', secret, {
      algorithms: ['HS256'],
    }));
  } catch (err) {
    // Missing, changed, or expired. The risk is unknown, not low.
    return res.status(400).json({ error: 'risk_token_invalid' });
  }

  // The token has no user ID. Tie it to this session, and accept each assessment once.
  const firstUse = await riskAssessments.insertOnce({
    id: assessment.jti,
    userId: req.session.userId,
    level: assessment.risk.level,
    reasons: assessment.risk.reasons,
  });
  if (!firstUse) {
    return res.status(409).json({ error: 'risk_token_reused' });
  }

  res.json({ riskLevel: assessment.risk.level, riskReasons: assessment.risk.reasons });
});
```

### Before you start

* The device and network risk assessment must be enabled for your project. Contact your Radar account team.
* Install the Radar SDK and the fraud plugin. See [Fraud plugin setup](https://docs.radar.com/sdk/fraud.md). `Radar.revealRisk()` requires iOS SDK 3.38.0 or later, Android SDK 3.35.0 or later, `@radarlabs/plugin-fraud` 1.4.0 or later, or React Native SDK 4.36.0 or later.
* Use a Test publishable key in your app. See [Choose the right API key](https://docs.radar.com/fundamentals/authentication-and-access.md#choose-the-right-api-key).
* Store your project's JWT secret key, shown under **Fraud** on the [Settings](https://dashboard.radar.com/settings#fraud-settings) page of the Radar dashboard, in your backend's secret manager.

### Read the result

`Radar.revealRisk()` doesn't request location permission and doesn't need a user ID. It returns the assessment as an object and as a signed `token` that carries the same fields:

```json theme={null}
{
  "_id": "6740a1f2c3d4e5f6a7b8c9d0",
  "risk": {
    "level": "medium",
    "reasons": ["fraud_proxy_known_proxy_ip"]
  },
  "network": {
    "ipAddress": {
      "ip": "203.0.113.24",
      "countryCode": "US"
    },
    "privacy": {
      "vpn": true,
      "proxy": false,
      "tor": false,
      "relay": false,
      "hosting": true,
      "residentialProxy": false
    },
    "asn": {
      "name": "Example Hosting",
      "type": "hosting"
    }
  },
  "device": {
    "deviceId": "device-456",
    "installId": "install-789"
  },
  "expiresIn": 300,
  "expiresAt": "2026-11-17T15:05:00.000Z"
}
```

| Field | Description |
| - | - |
| `risk.level` | One of `none`, `low`, `medium`, or `high`. |
| `risk.reasons` | The signals found, for example `fraud_proxy_known_proxy_ip`. Can be empty. |
| `network` | The IP address and its IP geolocation, the `privacy` flags, and the network operator in `asn`. |
| `device` | Device, operating system, SDK, and app details. |
| `token` | The signed result. Send this to your backend. Optional in the SDK models, so handle its absence. |

The assessment has no `passed` field and no user ID. Your app decides what to do with it.

### Validate the token on your backend

The token is a JSON Web Token signed with `HS256` and your project's JWT secret key, the same key that signs geolocation tokens. Its `jti` claim equals the assessment `_id`. Verify the signature and expiry before you read any field, as the backend example does.

The token says nothing about who is asking. Accept it only on a request you have already tied to a user or a registration attempt, record `jti` once, and treat a missing, invalid, or expired token as unknown risk, not as no risk.

To check your work, run the app with a Test publishable key and confirm that your backend responds with a `riskLevel`. Then change one character of the token and confirm a `400`.

To use the assessment at login, registration, promotion redemption, or a payment, and to require a verified location check when the risk is elevated, see [Assess risk and verify location](https://docs.radar.com/fraud/assess-risk.md).

## Detect location spoofing, VPNs and proxies, screen sharing and remote control, and compromised devices and apps

A risk assessment reports device and network signals in `risk.reasons`. A verified location check, `Radar.trackVerified()`, collects the same signals plus the device's precise location. It needs location permission, carries the `userId`, and reports each family as a flag in `user.fraud` and as reasons in `failureReasons` or `warningReasons`.

| Signal family | Flag | Example reason | Available from | Common innocent cause |
| - | - | - | - | - |
| Location spoofing | `mocked`, `jumped` | `fraud_mocked_from_mock_provider` | Verified location check | Wrong IP geolocation, stale coordinates |
| VPNs and proxies | `proxy` | `fraud_proxy_known_proxy_ip` | Both | A VPN for privacy or work |
| Screen sharing and remote control | `sharing` | `fraud_sharing_known_screen_sharing_app` | Both | External monitors, accessibility tools |
| Compromised devices and apps | `compromised` | `fraud_compromised_jailbroken` | Both | A development device |

For every reason, see [Failure and warning reasons](https://docs.radar.com/api/geolocation-tokens.md#failure-and-warning-reasons). Some reasons aren't published, so handle values you don't recognize without failing. The flags are defined in the [Fraud object](https://docs.radar.com/api/fraud.md#fraud-object).

## Understand risk scores and decisions

Radar reports what it observed, and your backend decides what your product does.

* A risk level isn't a probability of fraud. It ranks cases for attention, and a legitimate user can score high.
* There is no universal threshold. Choose what each level means for each action, and adjust it from recorded outcomes.
* `risk.level` on a risk assessment reflects the device and network signals in that assessment. `user.fraud.risk` on a verified location check is present when risk scores are enabled for your project. See [Fraud fields](https://docs.radar.com/api/geolocation-tokens.md#fraud-fields).
* A new device, several devices for one user, several users on one device, or a shared network is context, not proof. Households share devices, and offices put many people behind one IP address.

## Configure rules and actions

Radar has two kinds of rules, both configured in the dashboard.

* **Block rules**: Match one user ID, device ID, IP address, or MAC address, and fail every check for that value (**Blocked**) or pass every check for it (**Bypassed**). A blocked user fails verified location checks with `user.fraud.blocked` set to `true` and a failure reason such as `fraud_blocked_user_id`. To manage block rules from your backend, see the [Fraud API](https://docs.radar.com/api/fraud.md#block-users-and-devices).
* **Fraud rules**: Match criteria on each location check, such as failure reasons, users for a device, or the check `reason`. A rule can open a case, block the associated users, block the associated devices, or a combination.

Bypass rules are for internal testing only. Never apply them to real users.

An analyst closes a case as fraud or as not fraud, which records that label for each user on the case. To record an outcome decided in your own systems, see the [Labels API](https://docs.radar.com/api/labels.md).

## Inspect a check

The [Locations](https://dashboard.radar.com/geofencing/locations) page lists every location check with its user, device, time, and result. Open a check to see whether it passed, every failure reason, the fraud flags, the risk score with its reasons, and the IP address and network details.

From the check, open the user or device to see the user's other devices, the device's other users, and the location history across checks. One flag on one check is an observation. The same flag across many checks, devices, or linked users is a pattern.

Record what you concluded, including when nothing is wrong, by closing the case as fraud or not fraud. To test how your integration reacts to a blocked user, see [Force a pass or a fail](https://docs.radar.com/fundamentals/testing-and-launch.md#force-a-pass-or-a-fail).

## See also

* [Assess risk and verify location](https://docs.radar.com/fraud/assess-risk.md)
* [Fraud plugin setup](https://docs.radar.com/sdk/fraud.md)
* [Geolocation token schema](https://docs.radar.com/api/geolocation-tokens.md)
* [Fraud API](https://docs.radar.com/api/fraud.md)
* [Labels API](https://docs.radar.com/api/labels.md)
* [Understand geofences, places, regions, beacons, and fraud context](https://docs.radar.com/fundamentals/context-types.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.