API Reference
Welcome to the Smart City TVMS API Reference. This documentation covers all tRPC procedures available in the API.
API Overview
The Smart City TVMS API provides endpoints for:
- Authentication - User login, registration, and session management
- Sensors - Manage traffic sensors and devices
- Reports - Generate and retrieve traffic reports
- System - System configuration and health checks
- Storage - File upload and management
Base URL
https://api.itms.solutions/trpcRequest Format
All requests use the tRPC protocol with superjson serialization.
Query Requests (GET)
bash
GET /trpc/{procedure}?input={encodedJson}Mutation Requests (POST)
bash
POST /trpc/{procedure}
Content-Type: application/json
{ "json": { ...data } }Batch Requests
Multiple procedures can be called in a single request:
bash
GET /trpc/auth.me,system.getLicense?batch=1&input={}Response Format
Success Response
json
{
"result": {
"data": {
"json": {
// Response data here
}
}
}
}Error Response
json
{
"error": {
"json": {
"message": "Error description",
"code": -32001,
"data": {
"code": "UNAUTHORIZED",
"httpStatus": 401
}
}
}
}Authentication
Most endpoints require a valid JWT token passed in the Authorization header:
bash
Authorization: Bearer <your-jwt-token>See the Authentication section for details on obtaining tokens.
API Categories
Migrated to Cloudflare Workers
These APIs are fully operational on Cloudflare's edge infrastructure:
| API | Description | Status |
|---|---|---|
| Authentication | Login, register, token refresh | ✅ Live |
| Sensors | Sensor CRUD operations | ✅ Live |
| Reports | Traffic reports and analytics | ✅ Live |
| System | License, timezone, health | ✅ Live |
| Storage | File upload to R2 | ✅ Live |
Pending Migration
These APIs are planned for migration:
| API | Description | Status |
|---|---|---|
| Locations | Location/intersection management | ⏳ Pending |
| Traffic Events | Real-time traffic events | ⏳ Pending |
| Incidents | Incident reporting | ⏳ Pending |
| Users | User management | ⏳ Pending |
| Settings | System settings | ⏳ Pending |