🚌 TrackSchool API
Getting Started
Overview Authentication Rate Limits
Core APIs
Buses & Fleet Drivers Routes Students
ERP Integration
Student Sync Attendance Bus Status
Webhooks
Webhook Events
Navigation
← Home Super Admin School Admin

TrackSchool ERP Integration API

The TrackSchool REST API enables your ERP system to integrate student data, sync attendance, monitor bus status, and automate transport operations. All endpoints return JSON and use token-based authentication.

Base URL: https://api.trackschool.io/v1
Demo URL: http://localhost:3000/api
Version: v1.0  |  Format: JSON  |  Auth: Bearer Token

🔐 Authentication

All API requests require a Bearer token in the Authorization header. Obtain your API key from the Tenant Admin panel under Settings → API Keys.

curl -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ https://api.trackschool.io/v1/buses

🚌 Fleet API

GET /api/buses List all buses with live status

Returns all buses with real-time location, speed, fuel, and status information.

?tenantId=t001
GET /api/buses/:id/location Real-time GPS location

Get live GPS coordinates for a specific bus. Call every 5 seconds for real-time tracking.

🔗 ERP Integration Endpoints

GET /api/erp/students/sync Sync student-bus mapping to ERP

Returns complete student-bus-route-stop mapping for ERP synchronization. Use this to keep your student transport records up to date.

GET /api/erp/attendance/today Get today's transport attendance

Returns today's boarding status for all students. Integrate with your school ERP to auto-fill transport attendance.

GET /api/erp/buses/status Live fleet status for ERP dashboard

📡 Webhook Events

Configure webhooks in your Tenant Settings to receive real-time event pushes to your ERP system.

bus.trip.started
Trip started by driver
bus.trip.ended
Trip completed
student.boarded
Student RFID scan on bus
student.dropped
Student RFID scan at drop
bus.sos.triggered
Driver triggered SOS panic
bus.delay.detected
Bus is running late
bus.geofence.entered
Bus entered school zone
bus.speeding
Speed threshold exceeded
// Webhook Payload Example: student.boarded { "event": "student.boarded", "timestamp": "2025-01-15T07:18:00Z", "tenant_id": "t001", "data": { "student_id": "st001", "student_name": "Aarav Sharma", "rfid_tag": "RF001", "bus_id": "b001", "bus_number": "DL-01-AB-1234", "stop_name": "Rohini Sec-7", "lat": 28.7200, "lng": 77.1100 }, "signature": "sha256=abc123..." }

📋 Response Format

// All API responses follow this structure: { "success": true, "data": [ /* response payload */ ], "count": 18, "timestamp": "2025-01-15T08:00:00Z" } // Error response: { "success": false, "error": "Unauthorized", "code": 401 }

🚀 Quick Integration Example (PHP)

// PHP CodeIgniter / Laravel integration $apiKey = 'your_api_key_here'; $baseUrl = 'https://api.trackschool.io/v1'; $ch = curl_init("$baseUrl/erp/attendance/today?tenantId=YOUR_ID"); curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer $apiKey"]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = json_decode(curl_exec($ch), true); // Update your ERP attendance records foreach ($response['data'] as $student) { $this->db->update('attendance', [ 'transport_status' => $student['attendance'] ], ['student_id' => $student['student_id']]); }