> ## 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.

# Geolocation token schema

> Reference for the signed geolocation token returned by Radar verified location checks: backend validation, envelope, payload fields, failure reasons, expiry, and example payloads.

A verified location check returns a geolocation token. Use this reference to verify how the token is signed, read the decoded payload, and interpret identity, product, and expiry. To validate a token on your backend, start with [Validate a token](#validate-a-token).

> [!WARNING]
>
> Read fields from the payload only after your backend has verified the signature. A decoded token that isn't verified proves nothing about where the token came from.

## Validate a token

Your backend verifies the geolocation token and reads `passed` from it. If `passed` is `false`, your backend rejects the action. The result your app receives is for your UI. A value such as `passed` that arrives outside a verified token isn't proof. Verify the signed token on your backend before a protected action.

Decoding a token isn't validating it. Decoding only reads the payload, and anyone can produce a payload that decodes. Validation means verifying the signature with your secret key and then checking the claims in [Validation steps](#validation-steps).

The signing key is your project's JWT secret key, described in [Envelope](#envelope). The same key signs and verifies, so it belongs only on your backend. Store it in your secret manager and load it from an environment variable. Don't ship it in a mobile app, a web bundle, or a repository.

### Validation steps

Run every step, in this order, for every token. Reject the request at the first step that fails.

| Step | Check | Performed by |
| - | - | - |
| 1 | The token arrived on an authenticated request, so you know which user is asking. | Your code |
| 2 | The algorithm is `HS256`. Pass an explicit allowlist so that a token with `alg` set to `none` or to another algorithm is rejected. | JWT library, when you pass the allowlist |
| 3 | The signature verifies with your JWT secret key. | JWT library |
| 4 | The token hasn't expired: the current time is before `exp`. | JWT library |
| 5 | `user.userId` equals the ID of the authenticated user on this request. | Your code |
| 6 | `product` equals the product the user is trying to use, when your project uses products. | Your code |
| 7 | `transactionId` equals the action the request performs, when you passed one to the check. | Your code |
| 8 | `user.live` is `true` in production, so that a token from the Test environment isn't accepted. | Your code |
| 9 | `passed` is `true`. | Your code |

A JWT library does steps 2 to 4 and nothing else. It knows nothing about your users, products, or actions, so steps 5 to 9 are code you write. A token that passes steps 2 to 4 is authentic. Steps 5 to 8 confirm it belongs to this request, and step 9 reads the result.

Notes on specific steps:

* **Trusted key selection**: Select the key from your own configuration for the project and environment that the request belongs to. Don't select a key based on anything inside the token.
* **Clock skew**: If you allow a tolerance on `exp`, keep it to a few seconds.
* **Product result**: `passed` is the result for the product in `product`. When your project returns a `products` object, it holds one `passed` value per configured product, and you can read `products.<name>.passed` for the product of the action.
* **Replay**: Radar doesn't track whether a token has already been presented. A token stays valid until `exp`. If an action must be performed only once, pass a `transactionId` to the check, and have your backend mark that identifier as used.
* **Unknown fields**: The payload can gain fields. Ignore fields you don't use instead of rejecting the token.

### Example: Node.js

This example uses the [`jose`](https://github.com/panva/jose) library, which verifies the signature, the algorithm allowlist, and `exp`. The function returns the verified payload, and throws when the token is invalid, expired, or doesn't belong to the request.

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

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

/**
 * @param {string} token Geolocation token sent by the client
 * @param {{ userId: string, product?: string, transactionId?: string, requireLive: boolean }} expected
 *   Values from your own session and request, not from the client
 * @returns {Promise<object>} The verified token payload
 */
export async function verifyGeolocationToken(token, expected) {
  // Throws on a bad signature, another algorithm, or a past exp.
  const { payload } = await jwtVerify(token, secret, {
    algorithms: ['HS256'],
    clockTolerance: 5, // seconds
  });

  if (payload.user?.userId !== expected.userId) {
    throw new Error('Token is for a different user');
  }
  if (expected.product && payload.product !== expected.product) {
    throw new Error('Token is for a different product');
  }
  if (expected.transactionId && payload.transactionId !== expected.transactionId) {
    throw new Error('Token is for a different transaction');
  }
  if (expected.requireLive && payload.user.live !== true) {
    throw new Error('Token is from the Test environment');
  }

  return payload;
}
```

Call it from an authenticated route, take the expected values from the session, and read `passed`:

```javascript Node.js theme={null}
app.post('/api/wagers', requireSession, async (req, res) => {
  let payload;
  try {
    payload = await verifyGeolocationToken(req.body.geolocationToken, {
      userId: req.session.userId,
      product: 'sportsbook',
      requireLive: process.env.NODE_ENV === 'production',
    });
  } catch (err) {
    // No valid token for this request. The client runs a new check.
    return res.status(401).json({ error: 'invalid_geolocation_token' });
  }

  if (payload.passed !== true) {
    return res.status(403).json({ passed: false, failureReasons: payload.failureReasons });
  }

  // Place the wager.
});
```

### Example: Python

This example uses [PyJWT](https://pyjwt.readthedocs.io), which verifies the signature, the algorithm allowlist, and `exp`. The function returns the verified payload, and raises `jwt.InvalidTokenError` when the token is invalid, expired, or doesn't belong to the request.

```python Python theme={null}
import os

import jwt  # PyJWT

SECRET = os.environ["RADAR_JWT_SECRET_KEY"]


def verify_geolocation_token(token, user_id, product=None, transaction_id=None, require_live=True):
    # Raises on a bad signature, another algorithm, or a past exp.
    payload = jwt.decode(
        token,
        SECRET,
        algorithms=["HS256"],
        leeway=5,
        options={"require": ["exp", "iat"]},
    )

    user = payload.get("user") or {}

    if user.get("userId") != user_id:
        raise jwt.InvalidTokenError("Token is for a different user")
    if product and payload.get("product") != product:
        raise jwt.InvalidTokenError("Token is for a different product")
    if transaction_id and payload.get("transactionId") != transaction_id:
        raise jwt.InvalidTokenError("Token is for a different transaction")
    if require_live and user.get("live") is not True:
        raise jwt.InvalidTokenError("Token is from the Test environment")

    return payload
```

Read `passed` from the returned payload. If it isn't `True`, reject the action and return `payload["failureReasons"]` so that your app can explain why.

### Act on the validation result

| Situation | What your backend does | What your app does |
| - | - | - |
| The token is valid and `passed` is `true` | Performs the action. | Continues. Runs a new check before the token expires. |
| The token is valid and `passed` is `false` | Rejects the action and returns `failureReasons`. | Shows a message based on `failureReasons`. Lets the user fix the cause and run a new check. |
| `passed` is `true` and `warningReasons` isn't empty | Performs the action. Warnings don't fail a check. Record them if your own policy uses them. | Continues. |
| The token has expired | Rejects the request. | Runs a new check and sends the new token. |
| The signature, algorithm, or format is invalid | Rejects the request and logs the event. | Doesn't resend the same token. |
| `user.userId` doesn't match the session user | Rejects the request. | Calls `Radar.setUserId()` with the signed-in user, then runs a new check. |
| `product` or `transactionId` doesn't match | Rejects the request. | Sets the correct product or transaction, then runs a new check. |
| No token on the request | Rejects the request. | Runs a check and sends the token. |
| The client check returned an error status and no token | Receives nothing to validate, so the action isn't performed. | Handles the error and runs a new check. An error isn't a failed check, and it isn't a pass. |

When your backend can't validate a token, including when your own validation code throws, reject the action.

### Reuse a verified result for a session

You can require a token on every restricted request, or verify a token once and remember its result. If you remember it, store the verified values on the server, keyed by your session:

```json theme={null}
{
  "userId": "user-123",
  "product": "sportsbook",
  "passed": true,
  "expiresAt": "2026-11-17T18:20:00.000Z",
  "locationCheckId": "66f1c2a9e4b0a1b2c3d4e5f6"
}
```

Then, for each restricted request, reject it unless a stored result exists for the session user and the product of the action, `passed` is `true`, and the current time is before `expiresAt`. Take `expiresAt` from the token's `exp` claim, and keep `_id` from the token as `locationCheckId` so that support staff can find the check in the dashboard. Replace the stored result each time your backend verifies a later token for the same session, including one with `passed` set to `false`.

For withdrawals, redemptions, and other single-use actions, require a token on the request itself, tied to the action with `transactionId`.

### Change the secret key

The token header has no key identifier, so your backend can't pick a key per token. If your project's JWT secret key is replaced, tokens signed with the previous key stop verifying once your backend loads the new key. To avoid rejecting tokens during the change, configure both keys for a short overlap, try the current key first, then the previous key, and remove the previous key after the longest token lifetime has elapsed.

### Negative tests

Cover each of these in your backend tests. Sign test tokens with a test-only secret. To build the wrong-user and expired fixtures, see [Fixtures for rejection tests](#fixtures-for-rejection-tests).

| Fixture | Expected result |
| - | - |
| Valid token, `passed` is `true`, matching user and product | Action performed |
| Valid token, `passed` is `false` with `failureReasons` | Rejected, with the failure reasons in the response |
| Valid token, `passed` is `true` with `warningReasons` | Action performed |
| Token signed with a different secret | Rejected |
| Token with `alg` set to `none`, or with the signature removed | Rejected |
| Token with one payload character changed | Rejected |
| Token with `exp` in the past | Rejected |
| Valid token for `user-456` presented in a `user-123` session | Rejected |
| Valid token for `casino` presented for a `sportsbook` action | Rejected |
| Valid token with `user.live` set to `false` presented in production | Rejected |
| No token | Rejected |

## Encrypted responses

> [!NOTE]
>
> Encrypted responses must be enabled for your project. Contact your Radar account team.

By default, `token` is a JWT signed with a secret key that Radar and your backend share. As an alternative, Radar can return `token` as a JSON Web Encryption (JWE) token. Radar signs the response with its own private key, then encrypts it with a public key that you upload, so only your backend can decrypt the response.

Encrypted responses are available for `Radar.trackVerified()` and `Radar.revealRisk()`. With them, Radar returns only `token`, `passed`, `expiresAt`, and `expiresIn` to the client. Everything else, including `user`, `events`, and `failureReasons` for location checks and `risk`, `network`, and `device` for risk assessments, is only in the encrypted token. Send the token to your backend to read it.

### Create and upload a key

Create an EC P-256 key pair, and convert the public key to a JSON Web Key (JWK). The private key must never leave your backend.

```bash theme={null}
openssl ecparam -genkey -name prime256v1 -noout -out private-key.pem
openssl ec -in private-key.pem -pubout -out public-key.pem
node -e "const fs = require('fs'); const crypto = require('crypto'); const key = crypto.createPublicKey(fs.readFileSync('public-key.pem')); console.log(JSON.stringify(key.export({ format: 'jwk' }), null, 2));" > public-key.jwk
```

The public JWK has four fields:

```json theme={null}
{
  "kty": "EC",
  "x": "...",
  "y": "...",
  "crv": "P-256"
}
```

1. Under **Response encryption keys** on the [Settings](https://dashboard.radar.com/settings#response-keys) page of the Radar dashboard, select **Add**.
2. Choose the **Live** or **Test** environment, then upload your public JWK file or paste its contents.
3. After your backend has the private key, open the menu on the key's row and select **Activate**. A new key is disabled until you activate it.

Response encryption keys must be in JWK format, not PEM format. If you paste a PEM file, or a JWK that includes the private `d` field, the dashboard shows the error `Enter a public P-256 JWK without private key material.` Only one key is active for each environment, and Live and Test keys are separate. You need the owner role to add, activate, or delete keys.

### Decrypt and verify a token

On your backend, decrypt the token with your private key, then verify Radar's signature on the decrypted JWT. Radar encrypts with `ECDH-ES` and `A256GCM`, and signs with `ES256`. Radar's public signing keys are published at `https://api.radar.io/.well-known/jwks.json`.

```javascript Node.js theme={null}
import { readFileSync } from 'node:fs';
import { createPrivateKey } from 'node:crypto';
import { compactDecrypt, createRemoteJWKSet, jwtVerify } from 'jose';

const PRIVATE_KEY = createPrivateKey(readFileSync('private-key.pem'));
const RADAR_KEYS = createRemoteJWKSet(new URL('https://api.radar.io/.well-known/jwks.json'));

try {
  const { plaintext } = await compactDecrypt(token, PRIVATE_KEY, {
    keyManagementAlgorithms: ['ECDH-ES'],
    contentEncryptionAlgorithms: ['A256GCM'],
  });
  const { payload } = await jwtVerify(new TextDecoder().decode(plaintext), RADAR_KEYS, {
    algorithms: ['ES256'],
    issuer: 'api-verified',
  });
  const { result, endpoint, live } = payload;
  const { user } = result;
  // token is valid, read result
} catch (err) {
  // token is invalid, reject the request
}
```

The decrypted JWT has these claims:

| Claim | Type | Description |
| - | - | - |
| `result` | object | The response. For location checks, this has the same fields as the default token payload, including `user`, `events`, `passed`, and `failureReasons`. |
| `endpoint` | string | `track` for `Radar.trackVerified()`, or `revealRisk` for `Radar.revealRisk()`. |
| `live` | boolean | `true` if the response is from the Live environment, `false` if it is from the Test environment. |
| `aud` | string | Your Radar project ID. |
| `exp` | number | The time when the token expires. |

After you verify the token, apply the same user, product, and freshness checks as for a default token. See [Validation steps](#validation-steps).

### Rotate a key

Add a new key, deploy its private key to your backend, then activate the new key. Activating a key disables the previous key for that environment. Keep the previous private key until the tokens encrypted with it expire. The `kid` header of each token is the **Key ID** of the key that encrypted it, so your backend can choose the matching private key. You can delete a key after it's disabled.

## Envelope

The token is a JSON Web Token (JWT) in JWS compact serialization. It has three base64url segments separated by periods:

```text theme={null}
<header>.<payload>.<signature>
```

The decoded header is:

```json theme={null}
{
  "alg": "HS256",
  "typ": "JWT"
}
```

| Property | Value |
| - | - |
| Signature algorithm | `HS256` (HMAC with SHA-256) |
| Signing key | Your project's JWT secret key, shown under **Fraud** on the [Settings](https://dashboard.radar.com/settings#fraud-settings) page of the Radar dashboard |
| Key identifier (`kid`) | Not present |
| Encryption | None by default. The payload is signed and readable by anyone who holds the token. To encrypt it, see [Encrypted responses](#encrypted-responses). |

Reject any token whose header `alg` isn't `HS256`. This section describes the default token. An encrypted response is a JWE token instead.

## Registered claims

The JWT library you use reads these claims. Both are in seconds since the Unix epoch.

| Claim | Type | Presence | Description |
| - | - | - | - |
| `iat` | number | Always | When Radar issued the token. |
| `exp` | number | Always | When the token expires. Equal to `iat` plus `expiresIn`. |

## Payload fields

Field names are case-sensitive. The payload can contain fields that aren't listed here, and new fields can be added, so ignore fields you don't use.

### Top-level fields

| Field | Type | Presence | Description |
| - | - | - | - |
| `_id` | string | Always | Radar's ID for the location check. |
| `passed` | boolean | Always for a verified check | Whether the user passed all jurisdiction and fraud checks for the current product. |
| `failureReasons` | array of strings | Always for a verified check | Why the check failed. Empty when `passed` is `true`. See [Failure and warning reasons](#failure-and-warning-reasons). |
| `warningReasons` | array of strings | Always for a verified check | Signals reported without failing the check. See [Failure and warning reasons](#failure-and-warning-reasons). |
| `expiresIn` | number | Always | Token lifetime in seconds, measured from `iat`. |
| `expiresAt` | string | Always for a verified check | Expiry as an ISO 8601 datetime. See [Expiry](#expiry). |
| `product` | string | When set on the client | The product set with `Radar.setProduct()`. |
| `products` | object | Account-specific | One entry per product configured for your project, each with a `passed` boolean. Present only when per-product results are enabled for your project. |
| `reason` | string | When passed to the check | The check reason you supplied. |
| `transactionId` | string | When passed to the check | The transaction ID you supplied. Radar returns it unchanged and doesn't check it for uniqueness. |
| `user` | object | Always | The user and device the check ran for. See [User fields](#user-fields). |
| `events` | array of objects | Always | Events generated by the check, such as geofence entries. Can be empty. |

### User fields

| Field | Type | Presence | Description |
| - | - | - | - |
| `user._id` | string | Always | Radar's ID for the user record. |
| `user.userId` | string | When set on the client | The ID set with `Radar.setUserId()`. Compare it to your authenticated user. |
| `user.deviceId` | string | Always | The device ID. |
| `user.installId` | string | Always | Radar's ID for the app install. |
| `user.sessionId` | string | When available | Radar's ID for the app session. |
| `user.deviceType` | string | When available | The platform of the device: `iOS`, `Android`, or `Web`. |
| `user.xPlatformType` | string | When available | The framework the SDK runs in, such as `Native`, `Capacitor`, or `ReactNative`. |
| `user.deviceOS` | string | When available | The operating system version, for example `15`. |
| `user.deviceMake` | string | When available | The device manufacturer, for example `samsung`. |
| `user.deviceModel` | string | When available | The device model, for example `SM-S916U`. |
| `user.sdkVersion` | string | When available | The Radar SDK version that ran the check, for example `3.21.2`. |
| `user.userAgent` | string | When available | The user agent string of the app or browser. |
| `user.live` | boolean | Always | `true` for the Live environment, `false` for the Test environment. |
| `user.location` | GeoJSON geometry | Always | The location of the check, a `Point` in [GeoJSON](https://geojson.org/) format. `coordinates` is `[longitude, latitude]`. |
| `user.locationAccuracy` | number | Always | Accuracy of the location in meters. |
| `user.updatedAt` | string | Always | When the check ran, as an ISO 8601 datetime. |
| `user.metadata` | object | When set on the client | Metadata set with `Radar.setMetadata()`. |
| `user.passed` | boolean | Always for a verified check | Same value as the top-level `passed`. |
| `user.failureReasons` | array of strings | Always for a verified check | Same values as the top-level `failureReasons`. |
| `user.warningReasons` | array of strings | Always for a verified check | Same values as the top-level `warningReasons`. |
| `user.failureReasonMessages` | object | Account-specific | Keyed by failure reason. Each entry can include a `message` to show the user and a `retry` boolean. Present only when failure reason messages are enabled for your project. |
| `user.fraud` | object | Always for a verified check | See [Fraud fields](#fraud-fields). |
| `user.country` | object | When the location is in a known country | See [Country and state fields](#country-and-state-fields). |
| `user.state` | object | When the location is in a known state or province | See [Country and state fields](#country-and-state-fields). |
| `user.geofences` | array of objects | When inside custom geofences | The custom geofences the location is inside, each with `description`, `tag`, and `externalId`. |
| `user.expectedAddress` | object | Account-specific | Result of an expected address comparison, when you call `Radar.setExpectedAddress()` and address verification is enabled. See [Expected address fields](#expected-address-fields). |

### Fraud fields

| Field | Type | Description |
| - | - | - |
| `user.fraud.passed` | boolean | Whether all fraud checks passed. |
| `user.fraud.verified` | boolean | `true` when the request came from a verified location check. |
| `user.fraud.blocked` | boolean | `true` when a block rule matched. Forces `user.fraud.passed` to `false`. |
| `user.fraud.bypassed` | boolean | `true` when a bypass rule matched. Forces `user.fraud.passed` to `true`. Bypass rules are for internal testing only. |
| `user.fraud.mocked` | boolean | The location is mocked or spoofed. |
| `user.fraud.jumped` | boolean | The location moved too far too fast. |
| `user.fraud.compromised` | boolean | The device or app is compromised, for example rooted or jailbroken. |
| `user.fraud.inaccurate` | boolean | The location accuracy is too low to pass verification. |
| `user.fraud.proxy` | boolean | The IP address is a known proxy or VPN. |
| `user.fraud.sharing` | boolean | Screen sharing or remote control was detected. |
| `user.fraud.risk` | number | Risk score for the user and device. Present when risk scores are enabled for your project. See [Fraud overview](https://docs.radar.com/fraud/overview.md#understand-risk-scores-and-decisions). |
| `user.fraud.usersForThisDevice` | number | Count of user IDs seen on this device. |
| `user.fraud.devicesForThisUser` | number | Count of devices seen for this user ID. |
| `user.fraud.lastMockedAt`, `lastJumpedAt`, `lastCompromisedAt`, `lastInaccurateAt`, `lastProxyAt`, `lastSharingAt` | string | The last time the user failed each fraud check, as an ISO 8601 datetime. Absent when the user hasn't failed that check. |
| `user.fraud.ipAddress` | object | IP geolocation for the request, including `countryCode`, `stateCode`, `city`, and `connectionType`. |
| `user.fraud.privacy` | object | Network privacy flags: `vpn`, `proxy`, `tor`, `relay`, `hosting`, and `service`. |
| `user.fraud.asn` | object | Network operator information: `asn`, `name`, `domain`, `country`, `network`, and `type`. |

Individual flags explain a result. The decision field is `passed`.

### Country and state fields

`user.country` and `user.state` share these fields.

| Field | Type | Description |
| - | - | - |
| `code` | string | Two-letter country code, or state or province code. |
| `name` | string | Display name. |
| `type` | string | `country` or `state`. |
| `allowed` | boolean | Whether this region is allowed in your settings for the current product. |
| `passed` | boolean | Whether all jurisdiction checks for this region passed. |
| `expected` | boolean | Whether the region matches the jurisdiction set with `Radar.setExpectedJurisdiction()`. Can be absent. |

`user.state` also has:

| Field | Type | Description |
| - | - | - |
| `distanceToBorder` | number | Distance to the nearest state or province border in meters. |
| `inBufferZone` | boolean | The location is too close to the border. |
| `inExclusionZone` | boolean | The location is in an exclusion zone, if enabled. |
| `inInclusionZone` | boolean | The location is in a custom inclusion zone, if configured. |

### Expected address fields

| Field | Type | Description |
| - | - | - |
| `expectedAddress` | string | The address you passed to `Radar.setExpectedAddress()`. |
| `formattedAddress` | string | The address as geocoded by Radar. Absent when it could not be geocoded. |
| `latitude`, `longitude` | number | Coordinates of the geocoded address. |
| `atAddress` | boolean | Whether the user is within the distance threshold of the geocoded address. |
| `distance` | number | Distance in meters between the user's location and the geocoded address. |
| `confidence` | string | `high`, `medium`, `low`, or `unknown`. |

## Identity, product, and freshness

Check these four things in the verified payload before you act on `passed`.

* **Identity**: `user.userId` is the value your client set with `Radar.setUserId()`. Radar doesn't authenticate your users, so the token proves which user ID the check ran for, and your backend proves who is making the request. Compare the two on every request.
* **Product**: `passed` applies to the product named in `product`. A token issued for one product doesn't establish eligibility for another. If your project returns `products`, each entry holds the jurisdiction result for that product from the same check.
* **Environment**: `user.live` tells you whether the check ran in the Live or Test environment. In production, accept only tokens with `user.live` set to `true`.
* **Transaction**: `transactionId` is returned exactly as you passed it. Radar doesn't enforce single use. Your backend compares it to the action it is authorizing and records that it has been used.

## Expiry

Each token has its own lifetime. Radar sets it per check based on your product and jurisdiction configuration and the distance to the border, so tokens issued close to a border expire sooner. The default lifetime is 20 minutes, an `expiresIn` of `1200`.

* `exp` is the authoritative expiry for your backend. JWT libraries enforce it.
* `expiresAt` is the expiry as an ISO 8601 datetime, for scheduling and display.
* `expiresIn` is the lifetime in seconds, measured from `iat`. Add it to the time you received the response, not to the current time when you read it later.

Schedule the next check from the returned values. Don't hardcode an interval.

* On the client, start the next check shortly before the expiry so that a valid token is always available.
* When the app returns to the foreground, or a page becomes visible again, compare the current time to `expiresAt` before you reuse a stored token.
* Run a new check when the user changes product, when the signed-in user changes, and before an action you bind with a `transactionId`.

## Read the client result

The client returns a status and, on success, a token object.

| Field | Type | Description |
| - | - | - |
| `token` | string | The signed geolocation token. Send it to your backend. |
| `passed` | boolean | Whether the user passed all jurisdiction and fraud checks. Use it to update your UI. Your backend reads `passed` from the verified token. |
| `failureReasons` | array of strings | Why the check failed, when `passed` is `false`. |
| `expiresAt` | datetime | When the token expires. |
| `expiresIn` | number | Seconds until the token expires. |
| `_id` | string | Radar's ID for the location check. Use it to find the check in the Radar dashboard. |
| `user` | object | The user, with detail in `user.fraud`, `user.country`, and `user.state`. |
| `events` | array | Events generated by the check, if any. |

Send the token to your backend with the protected request. Your backend verifies the token and reads `passed` itself, so a `passed` value changed on the device has no effect.

### Handle a failed check

A failed check is a successful request with `passed` set to `false` and at least one entry in `failureReasons`. It means Radar reached a conclusion about the user or device.

* Show a message that helps the user fix the cause, such as moving to an allowed area or disconnecting a VPN. For each reason, see [Failure and warning reasons](https://docs.radar.com/api/geolocation-tokens.md#failure-and-warning-reasons).
* Let the user run a new check after they change something. Don't loop automatically on a failed check.
* If failure reason messages are enabled for your project, the payload includes `user.failureReasonMessages`, keyed by failure reason, with a `message` to display and a `retry` flag. This is account-specific configuration.

`warningReasons` lists signals that Radar reports without failing the check. A check with warnings can still have `passed` set to `true`. Warnings are in the token payload that your backend reads.

### Handle a technical error

A technical error means the check didn't complete. The client returns a status other than success, and no token. It says nothing about the user's eligibility, so don't treat it as a failed check, and don't treat it as a pass.

| Status | Meaning | What to do |
| - | - | - |
| `ERROR_PERMISSIONS` | Location permission isn't granted. | Explain why location is needed and send the user to grant it. |
| `ERROR_LOCATION` | The device couldn't determine a location. | Ask the user to turn on location services and Wi-Fi, then run a new check. |
| `ERROR_NETWORK` | The request timed out or the host was unreachable. | Ask the user to check their connection, then run a new check. |
| `ERROR_SERVER` | Radar was reachable and returned an internal error. | Run a new check after a short delay. |
| `ERROR_VERIFY_APP` | Web only. The Radar Verify companion app isn't running or isn't installed. | Prompt the user to open or install the app. |
| `ERROR_PLUGIN` | The fraud plugin is missing or incompatible with the Radar SDK. | Fix the installation. See [Fraud plugin setup](https://docs.radar.com/sdk/fraud.md). |
| `ERROR_UNAUTHORIZED` | The publishable key or auth token is invalid. | Fix the credential. This is an integration error. |
| `ERROR_FORBIDDEN` | The request isn't permitted, for example an auth token constraint doesn't match or device attestation is unavailable. | Check the SDK logs. |
| `ERROR_PUBLISHABLE_KEY` | The SDK isn't initialized. | Initialize the SDK before the check. |
| `ERROR_BAD_REQUEST`, `ERROR_RATE_LIMIT` | The request was invalid or rate limited. | Treat as an integration error and investigate before launch. |

Until a new check succeeds and your backend validates its token, keep the protected action blocked.

## Failure and warning reasons

> [!NOTE]
>
> Some sensitive or proprietary failure reasons aren't documented here. Contact your Radar account team for more information. Handle values you don't recognize with a general message.

A check can fail for one or more reasons. When `passed` is `false`, `failureReasons` lists why. Depending on your compliance requirements and fraud preferences, some failure reasons can be downgraded to warning reasons. `warningReasons` lists those signals without failing the check, so a token with warnings can have `passed` set to `true`.

### Jurisdiction reasons

| Reason | Description |
| - | - |
| `country_not_allowed` | The user's location (based on reported device latitude and longitude coordinates) is in a country that is not allowed based on jurisdiction settings. Ask them to try again from an allowed area. |
| `country_not_expected` | The user's location (based on reported device latitude and longitude coordinates) is in a country that is not expected based on jurisdiction settings and the user's session. Ask them to log out, log in, and try again. |
| `state_not_allowed` | The user's location (based on reported device latitude and longitude coordinates) is in a state or province that is not allowed based on jurisdiction settings. Ask them to try again from an allowed area. |
| `state_not_expected` | The user's location (based on reported device latitude and longitude coordinates) is in a state or province that is not expected based on jurisdiction settings and the user's session. Ask them to log out, log in, and try again. |
| `state_in_buffer_zone` | The user's location (based on reported device latitude and longitude coordinates) is too close to the border of a state or province, either based on a jurisdiction-specific threshold or based on the location accuracy reported by the device. Ask them to try again further from the border or with better connectivity. |
| `state_in_exclusion_zone` | The user's location (based on reported device latitude and longitude coordinates) is in a state- or province-specific exclusion zone. Ask them to try again from an allowed area. |

### Fraud reasons

#### Device or app compromise

| Reason | Description |
| - | - |
| `fraud_compromised_jailbroken` | The user's iOS device is jailbroken, which means that they can tamper with apps on their device and spoof their location more easily. Ask them to try again from a different device. |
| `fraud_compromised_rooted` | The user's Android device is rooted, which means that they can tamper with apps on their device and spoof their location more easily. |
| `fraud_compromised_play_integrity_api` | The user's Android device failed to meet Play Integrity API basic integrity checks. This means that the device is possibly rooted, which allows them to tamper with apps on their device and spoof their location more easily. Ask them to try again from a different device. |
| `fraud_compromised_play_integrity_api_failing_app_integrity` | The user's Android app failed to meet Play Integrity API app integrity checks. This means that Google could not verify that the installed app matches an official version distributed through Google Play and signed with the expected certificate. The app may be modified, sideloaded, repackaged, or an unrecognized version, which can make tampering and location spoofing easier. Ask them to uninstall the app and reinstall the latest version from Google Play. |
| `fraud_compromised_play_integrity_api_failing_strong_integrity` | The user's Android device failed to meet Play Integrity API strong integrity checks. This means that Google could not verify the device as a genuine, certified Android device with strong system integrity and, on newer Android versions, recent security updates. The device may be modified, out of date, uncertified, or an emulator, which can make tampering and location spoofing easier. Ask them to install any available system and security updates and try again, or try again from a different device. |
| `fraud_compromised_app_attest` | The user's iOS device failed Apple's App Attest verification checks. This means the app or device may have been modified or tampered with, making it harder to verify the integrity of the location request. Ask them to reinstall the latest official version of the app and try again, or try from a different device. |
| `fraud_compromised_adb` | The user's Android device has an active Android Debug Bridge (ADB) connection, which allows debugging tools to interact with the device and can be used to spoof location data. Ask them to disable USB or wireless debugging, disconnect any debugging tools, and try again. |
| `fraud_compromised_insecure_boot` | The user's Windows device does not have Secure Boot enabled. This security feature helps prevent unauthorized system modifications, including drivers that may be used to spoof location data. Ask them to enable Secure Boot in their device's system settings and try again. |
| `fraud_compromised_emulator_simulator` | The user's device may be running in an emulator or simulator rather than on a physical device. Emulators and simulators can be used to manipulate device behavior or spoof location data. Ask them to try again from a physical device. |
| `fraud_compromised_virtual_machine` | The user's device is running in a virtual machine rather than directly on a physical device. Virtual machines can make it easier to manipulate device information or spoof location data. Ask them to try again from a physical device. |
| `fraud_compromised_suspicious_device_model` | The user's device model matches a model configured as suspicious for the project. This may indicate a device commonly associated with emulation, modification, or fraudulent activity. Ask them to try again from a different device. |
| `fraud_compromised_invalid_request_signature` | The location request failed signature verification. This may indicate that the app or request has been tampered with or that the request was sent through an unofficial client. Ask them to try again using the latest official version of the app. |
| `fraud_compromised_inconsistent_payload` | The user ID included in the fraud data does not match the user ID associated with the location request. This may indicate that the request was modified or that inconsistent information was submitted. Ask them to restart the app, ensure they are using the latest official version, and try again. |
| `fraud_compromised_clock_skew` | The user's device has a time discrepancy that interferes with the verification of encrypted location requests. This can happen when the device's clock is incorrectly configured, preventing Radar from validating the request. Ask them to enable automatic date and time settings on their device and try again. |

#### Location accuracy

| Reason | Description |
| - | - |
| `fraud_inaccurate_exceeded_accuracy_threshold` | The user's location accuracy is too low. Ask them to enable precise location and wi-fi and try again. If that doesn't work, ask them to try again later with better connectivity. |
| `fraud_inaccurate_ip_hotspot` | The user's IP address is associated with a wi-fi hotspot that may return inaccurate location coordinates. Ask them to disconnect from any hotspot connections and try again using a different wi-fi or cellular connection. |
| `fraud_inaccurate_wifi_hotspot` | The user's device is connected to a wi-fi hotspot that may be returning inaccurate location coordinates. Ask them to disconnect from the hotspot and try again using a different wi-fi or cellular connection. |
| `fraud_inaccurate_not_enough_wifi` | The user's device cannot detect enough nearby wi-fi networks to reliably determine its location. This may result in inaccurate coordinates. Ask them to enable wi-fi, move to an area with better connectivity, and try again. |
| `fraud_inaccurate_wifi_not_connected` | The user's device is not connected to a wi-fi network, which may reduce the accuracy of its reported location. Ask them to connect to a reliable wi-fi network, enable precise location services, and try again. |

#### Location jumping

| Reason | Description |
| - | - |
| `fraud_jumped_single_device` | The user's location (based on reported device latitude and longitude coordinates) moved too far too fast. This means that the user may be spoofing their location. However, false positives can sometimes result from iOS and Android location services returning stale or inaccurate coordinates, especially while driving. Ask them to wait a minute or two and try again. If that doesn't work, ask them to disable any location spoofing services or apps they may be using or try again later with better connectivity. |
| `fraud_jumped_multiple_devices` | The device's location (based on reported device latitude and longitude coordinates) is inconsistent with another device's location with the same user ID. Ask them if someone else was logged in with the same user ID from a different location. If appropriate, ask them to wait a few hours (however long it would take for the other device to travel to their location) and try again. |

#### Location mocking or spoofing

| Reason | Description |
| - | - |
| `fraud_mocked_from_mock_provider` | The user's location is mocked or spoofed according to device location services. Ask them to disable any location spoofing services or apps they may be using and try again. |
| `fraud_mocked_known_spoofing_app` | The user's device is running a known location spoofing application. These applications can modify the device's reported location to make it appear somewhere other than its actual location. Ask them to disable or uninstall any location spoofing apps and try again. |
| `fraud_mocked_user_agent_list` | The user's device is an emulator according to the user agent string, which is a small piece of text that a web browser or app sends to identify itself. Ask them to try again from a different (real) device. |
| `fraud_mocked_incognito` | The user's device is reporting location-related indicators associated with incognito or location spoofing tools. This may indicate that the device's location is being manipulated. Ask them to disable any location spoofing services or apps they may be using and try again. |
| `fraud_mocked_suspicious_location_accuracy` | The user's location accuracy is suspicious. This means that the user may be spoofing their location, but false positives can sometimes result. Ask them to disable any location spoofing services or apps they may be using, enable precise location and wi-fi, and try again. If that doesn't work, ask them to try again later with better connectivity. |
| `fraud_mocked_inconsistent_ip_country` | The user's location (based on reported device latitude and longitude coordinates) is in a country inconsistent with their IP geolocation country (based on their IP address). This means that the user may be spoofing their location or using a VPN or proxy service, but false positives can sometimes result from unreliable IP geolocation, especially on cellular connections. Ask them to try again from a different connection, ideally a wi-fi connection, and disconnect from any VPN or proxy services they may be using. If that doesn't work, ask them to disable any location spoofing services or apps they may be using. |
| `fraud_mocked_inconsistent_ip_state` | The user's location (based on reported device latitude and longitude coordinates) is in a state inconsistent with their IP geolocation state. This may indicate location spoofing or VPN usage, but false positives can occur on cellular connections. Ask them to try again from a different connection, ideally wi-fi, and disconnect from any VPN or proxy services. |
| `fraud_mocked_location_services_integrity` | The user's device may be experiencing network tampering that interferes with Apple's wi-fi location services. This may indicate an attempt to manipulate location data through a network-based attack. Ask them to disconnect from any VPN or proxy services and try again using a different network connection. |
| `fraud_mocked_wifi_spoofing` | The wi-fi network information detected by the user's device contains indicators consistent with location spoofing. This may mean that nearby network information is being manipulated to influence the device's reported location. Ask them to disable any location spoofing tools and try again using a different network connection. |
| `fraud_mocked_produced_by_accessory` | The user's location was provided by an external accessory, such as a connected GPS device, rather than the device's built-in location services. External accessories can be used to spoof or manipulate location coordinates. Ask them to disconnect any external GPS accessories and try again. |
| `fraud_mocked_suspicious_locale` | The user's device or browser locale is set to a country configured as suspicious for this project. |
| `fraud_mocked_known_hotspot` | The user's location is inside a known fraud hotspot, an area where many recent locations from multiple users have been flagged as risky. |

#### Proxy or VPN usage

| Reason | Description |
| - | - |
| `fraud_proxy_known_proxy_ip` | The user's IP address is a known VPN, proxy, or hosting provider. However, false positives can sometimes result from wi-fi connections at large or public venues. Ask them to disconnect from any VPN or proxy services they may be using and try again from a different connection. |
| `fraud_proxy_known_residential_proxy_ip` | The user's IP address matched a known residential or mobile proxy service. This may mean that the user is using a residential or mobile proxy service, or it may just mean that a residential or mobile proxy service was recently active on their device or network. Ask them to disconnect from any VPN or proxy services they may be using and try again from a different connection. |
| `fraud_proxy_network_configuration` | The user's network configuration indicates the use of a proxy or VPN. Ask them to remove any proxy or VPN settings from their network configuration and try again. |
| `fraud_proxy_known_proxy_app` | The user's device is running a known VPN or proxy application. These applications can route network traffic through another location and make it harder to verify the user's actual location. Ask them to disable any VPN or proxy applications and try again. |
| `fraud_proxy_disallowed_connection` | A disallowed process attempted to connect to the Radar companion app. This may indicate software that could interfere with location verification. Ask them to close the disallowed process and try again. |
| `fraud_proxy_inconsistent_time_zone` | The time zone reported by the user's device is inconsistent with the time zone associated with its IP address. This may indicate VPN or proxy usage, although legitimate differences can sometimes occur. Ask them to verify that their device's time zone is correct, disconnect from any VPN or proxy services, and try again. |

#### Screen sharing or remote desktop

| Reason | Description |
| - | - |
| `fraud_sharing_known_screen_sharing_app` | The user's macOS or Windows device is running a known screen sharing or remote desktop app. This means that the user could possibly be sharing their screen with remote control to another user in a different jurisdiction. Ask them to disconnect from any screen sharing services or apps, remote desktop services or apps, or external displays they may be using and try again. If that doesn't work, ask them to kill the app and any associated processes using Activity Monitor on macOS or Task Manager on Windows. |
| `fraud_sharing_capturing_screen` | The user's device is actively capturing its screen. This means that the user could possibly be sharing their screen with remote control to another user in a different jurisdiction. Ask them to disconnect from any screen sharing services or apps, remote desktop services or apps, or external displays they may be using and try again. |
| `fraud_sharing_multiple_displays` | The user's Android device has multiple displays. This means that the user could possibly be sharing their screen with remote control to another user in a different jurisdiction. However, false positives can sometimes result from external displays, Android Auto, or other accessories. Ask them to disconnect from any screen sharing services or apps, remote desktop services or apps, external displays, or accessories they may be using and try again. |
| `fraud_sharing_virtual_input_device` | Virtual mouse or screen input was detected on the user's device. This means that the user could possibly be sharing their screen with remote control to another user in a different jurisdiction. However, false positives can sometimes result from external displays or other accessories. Ask them to disconnect from any screen sharing services or apps, remote desktop services or apps, external displays, or accessories they may be using and try again. |

#### Block reasons

| Reason | Description |
| - | - |
| `fraud_blocked_user_id` | The user has been blocked based on user ID. |
| `fraud_blocked_device_id` | The user has been blocked based on device ID. |
| `fraud_blocked_mac_address` | The user has been blocked based on MAC address. |
| `fraud_blocked_ip` | The user has been blocked based on IP address. |
| `fraud_blocked_risk_score_auto_block` | The user or device has been automatically blocked based on a high risk score. |

## Example payloads

These are decoded payloads after signature verification. They are synthetic, and they omit optional fields that your project can return. The envelope around each one is described in [Envelope](#envelope).

### Passed check

The user passed all jurisdiction and fraud checks for the `sportsbook` product.

```json theme={null}
{
  "_id": "665f1c2e8a4b3d0012a1b001",
  "passed": true,
  "failureReasons": [],
  "warningReasons": [],
  "expiresIn": 1200,
  "expiresAt": "2026-01-15T18:20:00.000Z",
  "product": "sportsbook",
  "reason": "login",
  "user": {
    "_id": "665f1c2e8a4b3d0012a1b002",
    "userId": "user-123",
    "deviceId": "device-456",
    "installId": "5f0c2a9e-7b1d-4c3a-9e2f-000000000001",
    "live": true,
    "location": {
      "type": "Point",
      "coordinates": [-74.4057, 40.0583]
    },
    "locationAccuracy": 12,
    "updatedAt": "2026-01-15T18:00:00.000Z",
    "passed": true,
    "failureReasons": [],
    "warningReasons": [],
    "fraud": {
      "passed": true,
      "verified": true,
      "blocked": false,
      "bypassed": false,
      "mocked": false,
      "jumped": false,
      "compromised": false,
      "inaccurate": false,
      "proxy": false,
      "sharing": false
    },
    "country": {
      "type": "country",
      "code": "US",
      "name": "United States",
      "allowed": true,
      "passed": true
    },
    "state": {
      "type": "state",
      "code": "NJ",
      "name": "New Jersey",
      "allowed": true,
      "passed": true,
      "distanceToBorder": 38250.4,
      "inBufferZone": false,
      "inExclusionZone": false,
      "inInclusionZone": false
    }
  },
  "events": [],
  "iat": 1768500000,
  "exp": 1768501200
}
```

### Failed eligibility check

The request succeeded and the token is authentic. The user is in a state that isn't allowed, so `passed` is `false`. No fraud check failed.

```json theme={null}
{
  "_id": "665f1c2e8a4b3d0012a1b011",
  "passed": false,
  "failureReasons": ["state_not_allowed"],
  "warningReasons": [],
  "expiresIn": 300,
  "expiresAt": "2026-01-15T18:05:00.000Z",
  "product": "sportsbook",
  "reason": "wager",
  "user": {
    "_id": "665f1c2e8a4b3d0012a1b002",
    "userId": "user-123",
    "deviceId": "device-456",
    "installId": "5f0c2a9e-7b1d-4c3a-9e2f-000000000001",
    "live": true,
    "location": {
      "type": "Point",
      "coordinates": [-111.891, 40.7608]
    },
    "locationAccuracy": 15,
    "updatedAt": "2026-01-15T18:00:00.000Z",
    "passed": false,
    "failureReasons": ["state_not_allowed"],
    "warningReasons": [],
    "fraud": {
      "passed": true,
      "verified": true,
      "blocked": false,
      "bypassed": false,
      "mocked": false,
      "jumped": false,
      "compromised": false,
      "inaccurate": false,
      "proxy": false,
      "sharing": false
    },
    "country": {
      "type": "country",
      "code": "US",
      "name": "United States",
      "allowed": true,
      "passed": true
    },
    "state": {
      "type": "state",
      "code": "UT",
      "name": "Utah",
      "allowed": false,
      "passed": false,
      "distanceToBorder": 96110.7,
      "inBufferZone": false,
      "inExclusionZone": false,
      "inInclusionZone": false
    }
  },
  "events": [],
  "iat": 1768500000,
  "exp": 1768500300
}
```

### Passed check with a warning

The check passed, and Radar reported that the user isn't at the expected address. `passed` stays `true`. Your application decides what the warning means for the action.

```json theme={null}
{
  "_id": "665f1c2e8a4b3d0012a1b021",
  "passed": true,
  "failureReasons": [],
  "warningReasons": ["address_not_expected"],
  "expiresIn": 1200,
  "expiresAt": "2026-01-15T18:20:00.000Z",
  "reason": "withdrawal",
  "transactionId": "txn-789",
  "user": {
    "_id": "665f1c2e8a4b3d0012a1b002",
    "userId": "user-123",
    "deviceId": "device-456",
    "installId": "5f0c2a9e-7b1d-4c3a-9e2f-000000000001",
    "live": true,
    "location": {
      "type": "Point",
      "coordinates": [-74.4057, 40.0583]
    },
    "locationAccuracy": 10,
    "updatedAt": "2026-01-15T18:00:00.000Z",
    "passed": true,
    "failureReasons": [],
    "warningReasons": ["address_not_expected"],
    "fraud": {
      "passed": true,
      "verified": true,
      "blocked": false,
      "bypassed": false,
      "mocked": false,
      "jumped": false,
      "compromised": false,
      "inaccurate": false,
      "proxy": false,
      "sharing": false
    },
    "country": {
      "type": "country",
      "code": "US",
      "name": "United States",
      "allowed": true,
      "passed": true
    },
    "state": {
      "type": "state",
      "code": "NJ",
      "name": "New Jersey",
      "allowed": true,
      "passed": true,
      "distanceToBorder": 38250.4,
      "inBufferZone": false,
      "inExclusionZone": false,
      "inInclusionZone": false
    },
    "expectedAddress": {
      "expectedAddress": "100 Example Ave, Trenton, NJ 08608",
      "formattedAddress": "100 Example Ave, Trenton, NJ 08608 US",
      "latitude": 40.2206,
      "longitude": -74.7597,
      "atAddress": false,
      "distance": 35120.8,
      "confidence": "high"
    }
  },
  "events": [],
  "iat": 1768500000,
  "exp": 1768501200
}
```

## Fixtures for rejection tests

Two cases that your backend must reject use an authentic token with a passing payload, so they need no separate payload shape:

| Case | How to build the fixture | Expected backend result |
| - | - | - |
| Wrong user | Sign the passed payload and present it in a session for `user-456`. | Deny, because `user.userId` is `user-123`. |
| Expired | Sign the passed payload with `exp` earlier than the current time. | Reject as expired and ask the client for a new check. |

Sign test fixtures with a test-only secret, never with your project's JWT secret key.

## See also

* [Verify location for compliance](https://docs.radar.com/geo-compliance/verify-location.md)
* [Geo-compliance overview and quickstart](https://docs.radar.com/geo-compliance/overview.md)
* [Fraud plugin setup](https://docs.radar.com/sdk/fraud.md)
* [Fraud API](https://docs.radar.com/api/fraud.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.