dtect Security API
Status PageDashboard
Status PageDashboard
  1. Frontend SDK
  • Getting Started
    • Introduction
    • Security Features
    • Security Request
    • API Credentials
  • Frontend SDK
    • Introduction
    • Quality Questions & AI Detection
    • React
    • JavaScript
    • Error List
  • Security Token
    • Introduction
    • Retrieve Security Result using Security Token
      GET
  1. Frontend SDK

Introduction

The Frontend SDK is responsible for collecting data about the visitor's browser and behavior, sending that data to our API, and returning either a Security Token or a Security Result.

How the SDK Works#

1.
Initialize the SDK with your Public API credentials.
2.
The SDK collects device and behavioral data from the visitor’s browser.
3.
You request either:
Security Token (getSecurityToken) to later retrieve results securely on your backend, or
Security Result (getSecurityResult) directly in your frontend.
4.
Optionally, you can run Quality Questions or AI Usage Detection checks for additional protection.

Billing & Token Reuse#

Only the first billable call in a session creates a charge.
Billable methods: getSecurityToken, getSecurityResult, isAIUsageDetected, checkQualityQuestions.
Non-billable: getQualityQuestions.
After the first billable call, later billable methods in the same session reuse the token and return results without extra cost.
Retrieving the full Security Result from your backend using a token is always free.
Refreshing the page creates a new session, which means the next billable call will trigger a new charge.

Available Methods#

MethodPurposeBillable*Returns
getSecurityToken()Generates a token (recommended: backend retrieves result)✅{ token }
getSecurityResult()Retrieves Security Result directly in frontend✅{ token, result }
isAIUsageDetected()Detects AI tools or behaviors during the session✅{ token } (or { token, result } if includeResults=true)
checkQualityQuestions()Validates answers to quality questions✅{ token } (or { token, result } if includeResults=true)
getQualityQuestions()Retrieves 4 randomized validation questions (3 multiple-choice, 1 open-ended)❌Question[]
*Billable = may trigger a charge only if it is the first billable call in the session.
These optional checks (isAIUsageDetected, checkQualityQuestions) rely on the includeResults setting to control whether their results are visible on the frontend.
For detailed parameters and field reference, see Security Request.

Example Flows#

All flows start with init(). The API allows you to call methods in any order, and you can invoke them multiple times within the same session.
Flow A: With Quality Questions + AI Detection → Results
init() → getQualityQuestions() → checkQualityQuestions() → isAIUsageDetected() → getSecurityToken()/getSecurityResult()
Flow B: With Results → AI Detection
init() → getSecurityToken()/getSecurityResult() → isAIUsageDetected()
Flow C: Result only
init() → getSecurityToken()/getSecurityResult()
Flow D: Quality Questions + AI Detection only**
init() → getQualityQuestions() → checkQualityQuestions() → isAIUsageDetected()
👉 Recommended route:
If you plan to use AI Detection, we suggest including at least one open-ended question in your flow, then calling isAIUsageDetected() afterwards. This maximizes the effectiveness of AI Detection while still giving you flexibility to call it again later in the session if needed.

Next Steps#

Learn about parameters in Security Request.
Learn about available checks in Security Features.
Explore optional methods in detail: Quality Questions & AI Detection.
Choose your preferred SDK: React or JavaScript.
Previous
API Credentials
Next
Quality Questions & AI Detection