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

JavaScript

The dtect Security API provides a JavaScript SDK to simplify integration with our API. We recommend reading the general Frontend SDK Introduction to understand the core concepts before proceeding with the JavaScript SDK installation.

Installing the JavaScript SDK#

Now that you're familiar with the fundamentals of our Frontend SDKs, you can add the JavaScript SDK using your preferred method:
1.
Package manager.
2.
Adding a <script> tag.
<script> tag
Package Manager
1
Import and init our package
Include the following <script> tag in your webpage's <head> or <body> to import the dtect Security API SDK with your Public API Credentials.
2
Get data about your visitors
You can retrieve visitor data using the getSecurityToken() or getSecurityResult() methods.
getSecurityToken — Recommended
getSecurityResult
Learn more about how getSecurityResult and getSecurityToken work by checking our Frontend SDK Introduction.
3
Optional: Quality Questions & AI Detection
These methods are optional add-ons. For full details (respondent types, languages, responses), see Quality Questions & AI Detection. Below are quick-start snippets:
getQualityQuestions
checkQualityQuestions
isAIUsageDetected
Set includeResults: true at init if you want checkQualityQuestions and isAIUsageDetected to return their result object directly to the frontend; otherwise they return { token } and you can retrieve the result on your backend using Retrieve a Security Result using a Security Token.
4
Optional: Combined flow
A compact end-to-end example using the same session (only the first billable call creates a charge).

Error Handling#

We export an enum that provides access to all of our error codes. You can use this enum to add error handling in your integration.
<script> tag
Package Manager
Please refer to our Error List to view possible errors that may occur during implementation.
Previous
React
Next
Error List