SDK Documentation

SDK Documentation

Introduction

Welcome to the Think Proctor SDK. This SDK helps you conduct examinations with automated proctoring to prevent users from cheating.

The SDK tracks user activities and the environment using the camera, microphone, and screen, and takes appropriate actions based on recorded violations. A user's credibility score is calculated from recorded violations and can be viewed in the final report.


Installation

Include the SDK using a script tag in your HTML file:

<script src="{{Your End Point}}/ThinkProctor/thinkproc.umd.min.js"></script>
Copy

Initialization & Authentication

ThinkProctor.init() initializes and starts a proctoring session, establishing a connection with the Think Proctor service.

ThinkProctor.init(configurationOptions)
.then(function (session) {
console.log(session.sessionToken);
console.log(session.sessionId);
console.log(session.instanceId);
})
.catch(function(error){
console.log("Initialization Error", error);
});
Copy

Configuration Object Example

let configurationOptions = {
api_key: "YOUR_API_KEY",
sdk_token: "SDK_JWT_TOKEN_HERE",
unique_user_id: "myuser123",
user_name: "My User",
group_code: "mygroup123",
group_name: "My Group 123",
template_code: "think_1723213123",
// Optional parameters
language: "en",
camera: {
camera_drag: 1,
camera_position: 'topLeft',
camera_width: 200,
}
};
Copy

Parameters

ParameterTypeRequiredDescription
api_keyStringYesYour API key from dashboard.
sdk_tokenStringYesJWT created using API secret.
unique_user_idStringYesUnique candidate identifier.
template_codeStringYesProctoring template ID.
languageStringNoUI language (default: en).
registration_id_urlStringNoURL of candidate's ID image.
time_zoneStringNoTimezone (e.g., "UTC+5:30").
camera_widthNumberNoWidth of bubble (pixels).
Important Note on Session Tokens: The session object returned by init() contains sessionTokensessionId, and instanceId. Store the sessionToken if you need to resume a session later.

Creating the sdk_token

The sdk_token is a JWT generated on your server and signed using your Think Proctor API secret. It should include api_keyuuid, and group_code.

const jwt = require('jsonwebtoken');
const api_key = "YOUR_API_KEY";
const apiSecret = "YOUR_API_SECRET";

const tokenPayload = {
api_key: api_key,
uuid: "myuser123",
group_code: "mygroup123"
};

const sdk_token = jwt.sign(tokenPayload, apiSecret, {
algorithm: 'HS256',
expiresIn: '2h'
});
Copy

Error Handling

Error CodeDescription
4301Invalid api_key or token.
4302Invalid sdk_token.
4303Invalid template_code.
4308Session not found in case of resumes.
6001Session already completed.

Tracking Events

Listen to proctoring events using ThinkProctor.on(event, callback).

Event NameDescription
close-applicationUser clicked Close button.
suspend-sessionSession suspended by AI/Proctor.
terminate-sessionSession terminated by AI/Proctor.
camera-revokeCamera access was revoked by user.
network-restoreNetwork connection is stable again.

Check & Verification

Run ThinkProctor.checkCompatibility() to ensure the user's environment meets proctoring requirements.

ThinkProctor.checkCompatibility().then(() => {
// Safe to start the exam
let sessionController = ThinkProctor.start();
});
Copy

Start Monitoring

The ThinkProctor.start() method returns a SessionController instance.

MethodDescription
complete()Ends monitoring and concludes the session.
pause()Temporarily stops monitoring (for breaks).
play()Resumes monitoring after a pause.

Play / Pause / Break

The SDK allows pausing and resuming the proctoring session triggers during exam breaks.

// To pause capturing violations
sessionController.pause();

// To resume capturing
sessionController.play();
Copy
The play/pause functions also trigger their respective events if you have listeners attached.

Example Usage

A simple boilerplate for common integration scenario.

<script src="thinkproc.umd.min.js"></script>
<script>
ThinkProctor.init({
api_key: "YOUR_API_KEY",
sdk_token: "JWT_HERE",
unique_user_id: "userX",
user_name: "Adam G",
template_code: "think_123"
}).then(session => {
ThinkProctor.checkCompatibility().then(() => {
const controller = ThinkProctor.start();
// Use controller.complete() as needed
});
});
</script>
Copy

Language Support

The SDK supports multiple languages. Set during init() via the language parameter.

Englishen
Spanishes
Frenchfr
Germande
Chinesezh
Hindihi
Arabicar

Browser Support

We officially support the latest versions of major browsers:

BrowserStatusVersion
Google ChromeFull Support80+
Microsoft EdgeFull SupportLatest
Mozilla FirefoxFull Support70+
Apple SafariPartial13.1+