Our REST API makes it easy to integrate LearnCube's Virtual Classrooms with other systems.

Contact us to get access to our Virtual Classroom REST API or view our most common Virtual Classroom integrations.


Seamlessly integrate our Virtual Classroom into your existing website or application, use your own logo, colors and domain.


Virtual Classroom API

Virtual Classroom API Documentation

There are 3 steps to initialize a Virtual Classroom:

1) Pass a unique token and a user_id as URL parameters to a custom endpoint on our server

URL HTTPS://{{LEARNCUBE_ENDPONT}}/classv3/

{{LEARNCUBE_ENDPONT}} can be a subdomain on learn-cube.com or a custom domain pointing to our server.
The domain is also used to authenticate the POST
Parameters token: [alphanumeric] Unique token from your system

user_id : [alphanumeric] User ID from your system
Example HTTPS://{{LEARNCUBE_ENDPONT}}/classv3/?token=ABC123&user_id=111

Link the URL up to your existing system. (As a href or button)

2) We respond with a connect_lesson request to your server to validate the token and user_id

Method POST
URL HTTPS://{{YOUR_SERVER}}/
Parameters request: “connect_lesson”

token: [alphanumeric] Same as received in the URL in step 1

user_id: [alphanumeric] Same as received in the user_id in step 1

Example HTTPS://{{YOUR_SERVER}}/virtualclassroom/?request=connect_lesson&token=ABC123&user_id=111


3) Your server responds via JSON verifying if the class should start and returns the users parameters.

Parameters status: [true or false]

is_tutor: [true or false] Used to identify if user is a Tutor, for placement of video and to define classroom functions only the Tutor has access to.

id: [integer] Same as received in the user_id in step 1

full_name: [alphanumeric] User's Name for use in chat and profile

avatar: [alphanumeric] Url of the user's avatar/profile image. i.e https:\/\domain.com\/images\/avatar.png

record: [true or false] Records MP4 of video streams *Beta Feature

message: : If status is false you can send an optional message with the reason the class failed, this can be shown in the Virtual classroom UI
Format JSON
Content-Type: application/json;charset=UTF-8
Successful Response Example:

Request: {"request":"connect_lesson","token":"1235678","user_id":"111"}

Response: {"status":true, "is_tutor":false, "id":111,"full_name":"John Smith", "avatar":"https:\/\domain.com\/images\/avatar.png", "record":false}
Error Response Example:

Request: {"request":"connect_lesson","token":"1235678","user_id":"111"}

Response: {"status":false, "message":"Class not allowed, student has no credit" }

The Virtual Classroom detects teacher and student presence in real-time, the "start_lesson" command is sent only when both the teacher and at least one student have clicked the “Start Class” button. This allows the class time be tracked accurately from when both a teacher and student are present in the class.

learncube-start-class-button
We store tutor start time, student start time and class time (Total duration of both student and teacher a present in the Virtual Classroom), each log can be indexed by the token you provide, it is recommended to use a unique token for each class as reusing the same token is treated as a "resumed class". If a token is used multiple times the class duration is aggregated to give the the total class time per token. This data can be accessed using "Class Log" API function
Method POST
URL HTTPS://{{YOUR_SERVER}}/
Parameters request: "start_lesson"

token: [alphanumeric] Same as received in the URL in step 1
Example HTTPS://{{YOUR_SERVER}}/virtualclassroom/?request=start_lesson&token=ABC123
Format JSON
Content-Type: application/json;charset=UTF-8
Successful Response Example:

Request: {"request":"start_lesson","token":"ABC123"}

Response: {"status":true}

If “status:true” is returned the class is set as “started” and connect the video stream between the student and teachers, once the video streams are connected and the class timer starts.
Error Response Example:

Request: {"request":"start_lesson","token":"ABC123"}

Response: {"status":false, "message":"Class not allowed" }

If “status:false” teacher and student can not see each other and an optional "message" is shown in th UI.

Virtual classes are ended by pressing the "End Class" button this is considered a "clean_end", if the class disconnects for any other reason (Internet drop, browser crash etc) we record this as a "crash_lesson".

learncube-start-class-button

If a "crash_lesson" is sent the student or teacher have 60 seconds to rejoin the class, if they successfully rejoin the class resumes and the class time/counter continues.

If a user resumes a "crash_lesson" and then the class is later ended (by pressing the “End Class” button) the "end_lesson" command will also be sent. (Resulting in 2 or more “time” parameters being sent, these should be added together to give the total class time). In the API Log we aggregate total class time for each token.

The end_lesson call will not be sent unless a start_class was sent prior, so if a student or teacher enter a Virtual Classroom but leave/end the class without pressing the "Start Class" button no end_lesson call will be sent.

Method POST
URL HTTPS://{{YOUR_SERVER}}/
Format JSON
Content-Type: application/json;charset=UTF-8
Parameters request: "end_lesson" or crash_lesson

token: [alphanumeric] Same as received in the URL in step 1

time: [integer] Class duration in seconds, the time from “start_class” call, until "end_lesson" call)
Example HTTPS://{{YOUR_SERVER}}/virtualclassroom/?request=end_lesson&token=ABC123&time=611
Successful Response Example:

Request: {"request":"end_lesson","token":"ABC123", "time":611}

Response: {"status":true}

If “status:true” is returned the class is set as “started” and connect the video stream between the student and teachers, once the video streams are connected and the class timer starts.


Contact us to get access to our Virtual Classroom REST API or view our most common Virtual Classroom integrations.

Virtual Classroom Demo