ProctorAI API Documentation

Comprehensive guide for integrating with the ProctorAI platform

Introduction

The ProctorAI API allows you to integrate our advanced exam proctoring capabilities into your own applications and learning management systems. This documentation provides details on how to use our API endpoints to submit exam data, manage recordings, and verify user identity.

Our API is organized around REST principles. All requests should be made over HTTPS, and all response data is returned as JSON.

Base URL

The ProctorAI API is designed to be integrated with your Learning Management System. The base URL will be configured by you (the client) on your own server infrastructure.

In the examples below, we use {YOUR_API_BASE_URL} as a placeholder. You should replace this with your actual API server URL where you've implemented the ProctorAI API.

Authentication

Since the ProctorAI API is hosted on your own server infrastructure, you will be responsible for implementing and managing authentication for your API endpoints. We recommend using API keys or another secure authentication method of your choice.

Regardless of the authentication method you choose, be sure to keep your credentials secure. Do not share your API keys or other authentication credentials in publicly accessible areas such as GitHub, client-side code, etc.

Authentication Example

// Using Authorization header (example implementation)
  fetch('{YOUR_API_BASE_URL}/exams', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
      // request body
    })
  })

API Endpoints

Exam Sessions

POST/exams

Create a new exam session

Request Parameters

title

string

The title of the exam

duration

integer

Duration in minutes

settings

object

Proctoring settings (webcam, screen recording, etc.)

Example Request

fetch('{YOUR_API_BASE_URL}/exams', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
      "title": "Final Computer Science Exam",
      "duration": 180,
      "settings": {
        "webcam": true,
        "screenRecording": true,
        "audioRecording": true,
        "browserLock": true,
        "aiDetection": {
          "enabled": true,
          "sensitivity": "high"
        }
      }
    })
  })

Example Response

{
    "id": "exam_12345",
    "title": "Final Computer Science Exam",
    "duration": 180,
    "settings": {
      "webcam": true,
      "screenRecording": true,
      "audioRecording": true,
      "browserLock": true,
      "aiDetection": {
        "enabled": true,
        "sensitivity": "high"
      }
    },
    "status": "created",
    "createdAt": "2025-03-26T14:30:00Z",
    "accessUrl": "https://proctor.ai/exam/12345",
    "adminUrl": "https://proctor.ai/admin/exam/12345"
  }
GET/exams/{exam_id}

Retrieve an exam session by ID

Path Parameters

exam_id

string

The unique identifier for the exam

Example Request

fetch('{YOUR_API_BASE_URL}/exams/exam_12345', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  })

Example Response

{
    "id": "exam_12345",
    "title": "Final Computer Science Exam",
    "duration": 180,
    "settings": {
      "webcam": true,
      "screenRecording": true,
      "audioRecording": true,
      "browserLock": true,
      "aiDetection": {
        "enabled": true,
        "sensitivity": "high"
      }
    },
    "status": "in_progress",
    "createdAt": "2025-03-26T14:30:00Z",
    "startedAt": "2025-03-26T15:00:00Z",
    "participants": [
      {
        "id": "user_789",
        "name": "Jane Smith",
        "status": "active",
        "joinedAt": "2025-03-26T15:00:00Z"
      }
    ],
    "warnings": [
      {
        "timestamp": "2025-03-26T15:15:22Z",
        "type": "tab_switch",
        "userId": "user_789",
        "details": "User switched to another tab"
      }
    ]
  }
POST/exams/{exam_id}/submit

Submit exam session data including recordings

Path Parameters

exam_id

string

The unique identifier for the exam

Request Body

stats

object

Session statistics including duration, browser info, etc.

warnings

array

Array of warning events that occurred during the exam

webcam

object/file

Webcam recording (file upload or base64 encoded string)

screen

object/file

Screen recording (file upload or base64 encoded string)

Note

See the Data Formats section for detailed examples of how to structure your request.

User Verification

POST/verify/user

Verify user identity using facial recognition

Request Body

userId

string

The unique identifier for the user

referenceImage

string

Base64 encoded reference image of the user

verificationImage

string

Base64 encoded image to verify against the reference

Example Request

fetch('{YOUR_API_BASE_URL}/verify/user', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
      "userId": "user_789",
      "referenceImage": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEA...",
      "verificationImage": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEA..."
    })
  })

Example Response

{
    "verified": true,
    "confidence": 0.98,
    "matchScore": 0.96,
    "faceDetected": true,
    "warnings": []
  }

Recordings

POST/recordings

Upload exam recordings (webcam and screen)

Request Body

examId

string

The unique identifier for the exam

userId

string

The unique identifier for the user

type

string

Type of recording (webcam or screen)

file

file

The recording file

GET/recordings/{recording_id}

Retrieve a specific recording

Path Parameters

recording_id

string

The unique identifier for the recording

Example Request

fetch('{YOUR_API_BASE_URL}/recordings/rec_67890', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  })

Example Response

{
    "id": "rec_67890",
    "examId": "exam_12345",
    "userId": "user_789",
    "type": "webcam",
    "duration": 3600,
    "size": 256000000,
    "format": "webm",
    "createdAt": "2025-03-26T15:30:00Z",
    "url": "{YOUR_API_BASE_URL}/recordings/rec_67890/download",
    "status": "processed",
    "analysis": {
      "faceDetection": {
        "facePresent": 0.98,
        "multipleFaces": 0.01,
        "noFace": 0.01
      },
      "suspiciousActivity": {
        "phoneUsage": 0.02,
        "lookingAway": 0.05,
        "talking": 0.10
      }
    }
  }

Data Formats

When submitting exam data, you can use either multipart/form-data or JSON format depending on your needs.

Option 1: multipart/form-data

Use this format when you need to upload binary files (webcam and screen recordings) along with JSON data.

POST {YOUR_API_BASE_URL}/exams/{exam_id}/submit
  Content-Type: multipart/form-data
  
  Fields:
  - stats: JSON string (session data)
  - warnings: JSON string (activity logs)
  - webcam: Binary file (WebM/MP4)
  - screen: Binary file (WebM/MP4)
  
  Response: 200 OK (JSON)

Option 2: application/json

Use this format when you prefer to send all data as JSON, including Base64-encoded video files.

POST {YOUR_API_BASE_URL}/exams/{exam_id}/submit
  Content-Type: application/json
  
  {
    "stats": {
      // Session data (recording duration, clicks, etc.)
      "duration": 3600,
      "startTime": "2025-03-26T14:30:00Z",
      "endTime": "2025-03-26T15:30:00Z",
      "browserInfo": {
        "userAgent": "Mozilla/5.0...",
        "platform": "MacOS"
      }
    },
    "warnings": [
      // Array of activity logs
      {
        "timestamp": "2025-03-26T14:35:22Z",
        "type": "tab_switch",
        "details": "User switched to another tab"
      }
    ],
    "webcam": {
      "data": "data:video/webm;base64,..." // Base64 encoded video
      "filename": "webcam-recording-timestamp.webm",
      "mimeType": "video/webm"
    },
    "screen": {
      "data": "data:video/webm;base64,..." // Base64 encoded video
      "filename": "screen-recording-timestamp.webm",
      "mimeType": "video/webm"
    }
  }
  
  Response: 200 OK (JSON)

Error Handling

The ProctorAI API uses conventional HTTP response codes to indicate the success or failure of an API request.

CodeDescription
200 - OKThe request was successful
400 - Bad RequestThe request was invalid or cannot be served
401 - UnauthorizedAuthentication failed or user doesn't have permissions
404 - Not FoundThe requested resource could not be found
429 - Too Many RequestsRate limit exceeded
500 - Server ErrorSomething went wrong on our end

Error Response Format

{
    "error": {
      "code": "invalid_request",
      "message": "The request was invalid",
      "details": [
        {
          "field": "webcam",
          "issue": "File size exceeds the maximum allowed (100MB)"
        }
      ]
    }
  }

Rate Limits

Rate limiting is not currently implemented in the ProctorAI API by default. Since you are hosting the API on your own server infrastructure, you have the flexibility to implement rate limiting according to your specific needs and requirements.

If you wish to implement rate limiting for your ProctorAI API instance, we recommend considering factors such as:

  • The number of concurrent users your system needs to support
  • The computational resources available on your server
  • The expected frequency of API calls during exam sessions
  • Different rate limits for different types of operations (e.g., higher limits for critical exam operations)

Implementation Note

In future releases, we may provide sample code and guidance for implementing rate limiting in various server environments. If you need assistance with implementing rate limiting for your specific use case, please contact our support team.

SDKs & Libraries

Stay tuned for our SDKs and libraries.