⚠️ APIv2 is legacy
APIv2 is considered legacy and is no longer recommended for new integrations.
We strongly encourage you to use APIv4 for all new integrations and to migrate existing integrations where possible.
Please refer to our latest APIv4 documentation for up-to-date information and integration guidelines:
Click here to view the APIv4 example documentation - your own documentation is at https://[your-instance].langlion.com/api/v4/docs
Webhooks
When building LangLion integrations, you might want your applications to receive events as they occur in LangLion, so that your backend systems can execute actions accordingly.
To enable webhook events, you need to register webhook endpoints. After you register them, LangLion can push real-time event data to your application’s webhook endpoint when events happen on the LangLion Platform.
Using webhook events are particularly useful for listening to asynchronous events (eg. a new student has been added, the status of a lesson has changed, a document has been signed).
Event structure
Every event is sent as a JSON POST request with the event name and its payload:
1{
2 "event": "student.created", // type of event, see Supported events
3 "payload": { // data of the event, depends on the event type
4 "schoolId": 4,
5 "student": {
6 "id": 1014,
7 "name": "Anna",
8 "lastName": "Nowak"
9 }
10 }
11}Supported events
- student.created - a student has been added in the panel ("Students" tab), via API (student type "regular") or from online enrollments
- student.activated - a student has been activated via API (student type changed to "regular") or in the panel (CRM and "New students", "Add student" button)
- student.registered - a student has been added via API with type "registered" or from the registration form
- lesson.status.changed - the status of a lesson has changed
- lesson.attendance.changed - a teacher has changed whether attendance for a lesson has been checked
- studentInGroup.assignType.modified - the assignment type of a student in a group has changed
- studentInGroup.attendance.checked - the attendance of a student in a lesson has changed
- document.signed - a document has been signed
Register webhooks for these events through API v4 (POST /api/v4/webhooks). The payload of each event is described in the API v4 documentation (https://[your-instance].langlion.com/api/v4/docs).
Event delivery failure
When webhook callback fails (HTTP status code different than '200'), there will be a few attempts to deliver a given event to your webhook endpoint for up to 3 days with an exponential back off.
Event signature
Every webhook event is signed before sending it to your endpoints by including a signature in each event’s Webhook-Signature header. This allows you to verify that the received event can be trusted. Webhook-Signature header is the JSON object with the timestamp and the signature included.
Example of Webhook-Signature header
1"{"timestamp":1703792536,"signature":"537c90d454bf56647f3d1a822f784f229088aa83ad88e4dcf0ea5bb9265bb04b"}"Event signature verification
It's a good practice to verify event signatures to confirm that received events are sent from LangLion. Signature verification allows to prevent a replay attack when an attacker intercepts a valid payload and its signature, then re-transmits them. To mitigate such attacks, every includes a timestamp in the Webhook-Signature header. Because this timestamp is part of the signed payload, it’s also verified by the signature, so an attacker can’t change the timestamp without invalidating the signature. If the signature is valid but the timestamp is too old, you can have your application reject the payload.
Example of event signature verification in callback (PHP)
1$payload = @file_get_contents('php://input');
2
3$headers = getallheaders();
4$headerSignature = $headers['Webhook-Signature'];
5
6// parts consist of timestamp and signature
7$parts = json_decode($headerSignature, true);
8$receivedTimestamp = $parts['timestamp'];
9$receivedSignature = $parts['signature'];
10
11// prepare event data in a format ready for signage
12$event = sprintf("%s;%s", $receivedTimestamp, $payload);
13$mySignature = hash_hmac('sha256', $event, 'api client secret');
14
15print($mySignature === $receivedSignature ? "valid signature" : "invalid signature");Managing webhooks
Since 2026-11-27 webhooks are registered, listed and deleted only through API v4. Its documentation is in your LangLion system at https://[your-instance].langlion.com/api/v4/docs (section Webhooks):
| Operation | API v4 endpoint |
|---|---|
| Register a webhook | POST /api/v4/webhooks |
| List webhooks | GET /api/v4/webhooks |
| Get a webhook | GET /api/v4/webhooks/{id} |
| Delete a webhook | DELETE /api/v4/webhooks/{id} |
Webhooks that are already registered (also those registered through API v2) keep working: events are still delivered to their callback URLs and signed as described above. The event structure, event delivery and signature verification described on this page apply to them.
Removed API v2 endpoints
The following API v2 endpoints were removed on 2026-11-27. Requests to them return HTTP 404 with the error code notSupported (HTTP 401 without a valid administrator access token).
| Removed endpoint | Use instead |
|---|---|
| POST /api/v4/webhooks | |
| DELETE /api/v4/webhooks/{id} | |
| GET /api/v4/webhooks |