Skip to content

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/trpc

Request 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:

APIDescriptionStatus
AuthenticationLogin, register, token refresh✅ Live
SensorsSensor CRUD operations✅ Live
ReportsTraffic reports and analytics✅ Live
SystemLicense, timezone, health✅ Live
StorageFile upload to R2✅ Live

Pending Migration ​

These APIs are planned for migration:

APIDescriptionStatus
LocationsLocation/intersection management⏳ Pending
Traffic EventsReal-time traffic events⏳ Pending
IncidentsIncident reporting⏳ Pending
UsersUser management⏳ Pending
SettingsSystem settings⏳ Pending

SCS Smart City - Traffic, Gateway, Camera, and NVR Platform