Skip to content
LR Defender
Book a demo

API reference

Every endpoint in our OpenAPI spec, rendered from the spec file itself. Download the file to import it into your API client or generate code from it.

Overview

Download openapi.yamlLR Defender API 1.0.0
Base address
https://api.lrdefender.lightningresearch.ai
Authentication
Your secret key in the X-API-Key header, sent from your server only.

Device fingerprinting and bot detection API for LR Defender.

Authenticate every request with your tenant API key via the X-API-Key header. Keys are issued from the LR Defender dashboard and typically use the sk_ prefix.

Identification

Device fingerprinting and visitor identification.

Identify a device from signal payload

POST/api/device-idSecret key, X-API-Key

Primary device identification endpoint. Accepts browser or server-collected signal payloads and returns a stable deviceId, confidence score, smart signals, and risk analysis.

Set X-Fingerprint-Update: 1 or updateOnly: true to perform a lightweight update without full re-identification. Set X-API-Version: 2 or apiVersion=2 for the unified v2 response envelope.

X-Fingerprint-Update0 | 1 | true | false (header)Optional
When 1 or true, perform update-only persistence.
X-API-Version2 (header)Optional
Request the unified API v2 response envelope.
X-Sealed-Resultstrue | false (header)Optional
When true, return tamper-proof sealed (encrypted) results.
apiVersion2 (query)Optional

Request body: DeviceIdentificationRequest, as JSON.

curl -X POST https://api.lrdefender.lightningresearch.ai/api/device-id \  -H "X-API-Key: $LR_SECRET_KEY" \  -H "Content-Type: application/json" \  -d '{    "platform": "MacIntel",    "timezone": "Europe/Paris",    "language": "en-US",    "screenWidth": 1920,    "screenHeight": 1080,    "devicePixelRatio": 1,    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",    "webglVendor": "Apple Inc.",    "webglRenderer": "Apple GPU",    "privacy": {      "mode": "full",      "consentStatus": "granted",      "version": "1.0"    }  }'
200
MeaningIdentification succeeded
BodyDeviceIdentificationResponse
400
MeaningValidation error
BodyValidationError
401
MeaningMissing or invalid API key
BodyErrorResponse
403
MeaningOne of your rules blocked this identification (status blocked, with the matching rules in ruleResults), or a license or origin restriction
BodyRuleBlockedResponse or ErrorResponse
429
MeaningRate limit exceeded
BodyErrorResponse
500
MeaningInternal server error
BodyErrorResponse

Verify or retrieve an identification result

GET/api/device-id/{requestId}Secret key, X-API-Key

Poll the result of a prior identification request by requestId. Use the requestId that identify() returned in the browser, or one returned from an async or sealed identification flow, or from the API v2 response envelope. Results are kept for 24 hours after the identification.

Returns 404 when the request ID is unknown or has expired.

requestIdstring (path)Required
Identification request identifier (e.g. req_m3k9x2_a1b2c3)
curl https://api.lrdefender.lightningresearch.ai/api/device-id/$REQUEST_ID \  -H "X-API-Key: $LR_SECRET_KEY"
200
MeaningIdentification result found
BodyIdentificationResultResponse
401
MeaningMissing or invalid API key
BodyErrorResponse
404
MeaningRequest ID not found or expired
BodyErrorResponse
429
MeaningRate limit exceeded
BodyErrorResponse

Recall a device by ID

GET/api/device-recall/{deviceId}Secret key, X-API-Key

Look up a previously identified device by its 24-character hexadecimal deviceId. Returns persistence metadata, the match type and confidence, and when the device was first and last seen.

Also available without a path parameter at GET /api/device-recall when using a valid persistence cookie or device token from a prior identification.

deviceIdHexId24 (path)Required
24-character hexadecimal device identifier
curl https://api.lrdefender.lightningresearch.ai/api/device-recall/$DEVICE_ID \  -H "X-API-Key: $LR_SECRET_KEY"
200
MeaningDevice found
BodyDeviceRecallResponse
401
MeaningMissing or invalid API key
BodyErrorResponse
404
MeaningDevice not found
BodyDeviceNotFoundResponse
429
MeaningRate limit exceeded
BodyErrorResponse
500
MeaningInternal server error
BodyErrorResponse

Collector

Server-side collector session issuance.

Create a collector session token

POST/api/collector/sessionSecret key, X-API-Key

Issue a short-lived bearer token for browser-side collector traffic via POST /collect/device. Call this from your server backend only; never expose your API key in client-side code.

Send the origin of the page that will run the check: without it the call returns 400 with the code origin_required. The token works only from that origin. If your account lists allowed origins, the origin must be one of them, or the call returns 403 with the code origin_not_allowed.

Request body: CollectorSessionRequest, as JSON.

curl -X POST https://api.lrdefender.lightningresearch.ai/api/collector/session \  -H "X-API-Key: $LR_SECRET_KEY" \  -H "Content-Type: application/json" \  -d '{    "origin": "https://app.example.com",    "ttlSeconds": 300,    "maxUses": 10  }'
200
MeaningCollector session issued
BodyCollectorSessionResponse
400
MeaningInvalid request (e.g. missing origin)
BodyErrorResponse
401
MeaningMissing or invalid API key
BodyErrorResponse
403
MeaningOrigin not allowed or license invalid
BodyErrorResponse
429
MeaningRate limit exceeded
BodyErrorResponse

Challenge

Behavioral challenge verification.

Verify a behavioral challenge

POST/api/challenge/verifySecret key, X-API-Key

Verify a challenge issued during device identification when status: challenge_required is returned. On success, returns a short-lived passToken to include on subsequent POST /api/device-id requests.

Request body: ChallengeVerifyRequest, as JSON.

curl -X POST https://api.lrdefender.lightningresearch.ai/api/challenge/verify \  -H "X-API-Key: $LR_SECRET_KEY" \  -H "Content-Type: application/json" \  -d '{    "challengeToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",    "solution": 42  }'
200
MeaningChallenge verified; pass token issued
BodyChallengeVerifyResponse
400
MeaningMissing challenge token
BodyErrorResponse
401
MeaningChallenge verification failed
BodyErrorResponse
500
MeaningFailed to issue pass token
BodyErrorResponse

Health

Service health and readiness.

Health check

GET/healthzNo key

Returns service health status including database, Redis, and queue connectivity. No API key is needed.

curl https://api.lrdefender.lightningresearch.ai/healthz
200
MeaningService is healthy or degraded but operational
BodyHealthResponse
503
MeaningService is down (core dependencies unavailable)
BodyHealthResponse

Schemas

The request and response bodies the endpoints above use.

DeviceIdentificationRequest

Browser or server-collected signal payload

updateOnlybooleanOptional
When true, perform update-only without full identification
deviceIdHexId24Optional
See HexId24.
platformstringOptional
timezonestringOptional
languagestringOptional
userAgentstringOptional
screenWidthintegerOptional
screenHeightintegerOptional
devicePixelRationumberOptional
webglVendorstringOptional
webglRendererstringOptional
behavioralobjectOptional
Behavioral biometrics signals
privacyobjectOptional
metadataobjectOptional
clientDetectionobjectOptional

HexId24

24-character lowercase hexadecimal identifier

A value, not an object: see its type where it is used.

DeviceIdentificationResponse

deviceIdHexId24Required
See HexId24.
visitorIdHexId24Optional
See HexId24.
confidencenumberOptional
How closely this visit matched a known device, from 0 to 100. A heuristic, not a probability. identification.confidence.score carries the same value from 0 to 1.
statussuccess | challenge_required | ignoredRequired
matchTypestringOptional
Detection strategy (e.g. new, exact, fuzzy)
identificationobjectOptional
smartSignalsobjectOptional
Bot, VPN, tampering, and other smart signal results
suspectScoreobjectOptional
challengeobjectOptional
Present when behavioral challenge is required or verified
actionRequiredchallengeOptional
experimentsobject[]Optional
metaobjectOptional
ruleActionRuleActionOptional
See RuleAction.
ruleResultsRuleResultsOptional
See RuleResults.

RuleAction

Present when one of your rules matched with block, challenge or flag, the strictest of them (block, then challenge, then flag). Your rules never change risk.recommendation.action; act on the stricter of the two.

A value, not an object: see its type where it is used.

RuleResults

Present when any of your rules matched, the rules that matched.

A value, not an object: see its type where it is used.

ValidationError

errorstringRequired
Human-readable error message
codestringOptional
Machine-readable error code
detailsobject[]Optional

ErrorResponse

errorstringRequired
Human-readable error message
codestringOptional
Machine-readable error code

RuleBlockedResponse

The answer of POST /api/device-id when one of your rules with the action block matched.

statusblockedRequired
actionblockRequired
deviceIdHexId24Optional
See HexId24.
visitorIdHexId24Optional
See HexId24.
confidencenumberOptional
ruleResultsRuleResultsOptional
See RuleResults.
requestIdstringOptional
messagestringOptional
session_idstringOptional
Present while the risk engine or account scoring runs, as on every verdict.

IdentificationResultResponse

Stored or async identification result for a given requestId

requestIdstringRequired
statussuccess | pending | challenge_required | not_foundRequired
deviceIdHexId24Optional
See HexId24.
confidencenumberOptional
productsobjectOptional
API v2 product envelope when available
timestampstringOptional
ruleActionRuleActionOptional
See RuleAction.
ruleResultsRuleResultsOptional
See RuleResults.

DeviceRecallResponse

statusokRequired
deviceIdHexId24Required
See HexId24.
visitorIdHexId24Optional
See HexId24.
strategystringOptional
Persistence resolution strategy
issuedAtstringOptional
confidencenumberOptional
matchTypestringOptional
lastSeenstringOptional
firstSeenstringOptional

DeviceNotFoundResponse

statusnot_foundRequired
deviceIdnullOptional

CollectorSessionRequest

originstringOptional
The origin of the page that runs the check. Required unless the request carries an Origin header.
ttlSecondsintegerOptional
Session lifetime in seconds. Values above 600 are treated as 600.
maxUsesintegerOptional
Maximum number of collector ingest calls per token. Values above 20 are treated as 20.

CollectorSessionResponse

tokenTypestringRequired
sessionTokenstringRequired
Bearer token for POST /collect/device
expiresAtstringRequired
collectPathstringRequired
maxUsesintegerOptional
tenantIdHexId24Optional
See HexId24.

HealthResponse

statusok | degraded | downRequired
degradedbooleanOptional
regionstringOptional
uptimeSecondsintegerOptional
databaseconnected | disconnected | in_memory_fallbackOptional
databaseConnectedbooleanOptional
databaseDurablebooleanOptional
fallbackModebooleanOptional
redisconnected | disconnectedOptional
queueready | degradedOptional
redisConnectedbooleanOptional
queueConnectedbooleanOptional
timestampstringRequired

ChallengeVerifyRequest

challengeTokenstringOptional
Challenge JWT from the identification response
tokenstringOptional
Alias for challengeToken
solutionstring or numberOptional
Challenge solution (e.g. proof-of-work nonce)
proofstring or numberOptional
Alias for solution
responsestring or numberOptional
Alias for solution

ChallengeVerifyResponse

statusverifiedRequired
tenantIdHexId24Optional
See HexId24.
scopestringOptional
passTokenstringRequired
Short-lived token for subsequent identification requests
expiresAtstringRequired

Get a verdict in your own app.

After a demo call, we set up your account and email you a link to set your password. It starts with a 90-day free trial on the Pro plan's limits, with no card.