dtect Security API
Status PageDashboard
Status PageDashboard
  1. Frontend SDK
  • Getting Started
    • Introduction
    • Security Features
    • Security Request
    • API Credentials
    • Adding to Survey Platforms
  • 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.
AI Usage Detection can run manually with isAIUsageDetected() or automatically by passing autoFlagAIUsage: true to init(). Use one approach or the other, never both.

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.
Automatic AI Usage Detection (autoFlagAIUsage) follows the same billing rule — it reuses the session token and does not create an extra charge beyond the first billable call.

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()
Flow E: Automatic AI Detection
init({ autoFlagAIUsage: true }) → getSecurityToken()/getSecurityResult() → (AI usage flagged automatically for the rest of the session)
Note: With autoFlagAIUsage enabled, automatic detection begins only after the first getSecurityToken() or getSecurityResult() call in the session. Use either isAIUsageDetected() or autoFlagAIUsage, not both.
👉 Recommended route:
If you plan to use AI Detection, we suggest including at least one open-ended question in your flow. If you're manually calling isAIUsageDetected() make sure you do it after the open-ended question was answered. 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
Adding to Survey Platforms
Next
Quality Questions & AI Detection