Skip to content

Base URL & Request Format

Production Environment

ServiceURL
API Endpointhttps://api.itms.solutions
Web Applicationhttps://itms.solutions
tRPC Basehttps://api.itms.solutions/trpc

Request Headers

Required Headers

http
Content-Type: application/json

Authentication Header

For protected endpoints:

http
Authorization: Bearer <jwt-token>

Optional Headers

http
x-trpc-source: web

tRPC Request Format

Query (Read Operations)

Queries use HTTP GET with URL-encoded input:

bash
# Simple query without input
GET /trpc/auth.me

# Query with input parameters
GET /trpc/sensors.getSensorById?input={"json":{"id":"sensor-001"}}

Mutation (Write Operations)

Mutations use HTTP POST with JSON body:

bash
POST /trpc/auth.login
Content-Type: application/json

{
  "json": {
    "email": "user@example.com",
    "password": "password123"
  }
}

Batch Requests

Multiple procedures can be batched into a single HTTP request:

bash
# Batch query
GET /trpc/system.getLicense,system.timezone.getTimezoneSettings?batch=1&input={}

# Response contains array of results
{
  "0": { "result": { "data": { "json": { ... } } } },
  "1": { "result": { "data": { "json": { ... } } } }
}

superjson Serialization

The API uses superjson for serialization, which supports:

  • Date objects (serialized as ISO strings with metadata)
  • BigInt values
  • Map and Set collections
  • undefined values
  • Regular expressions

Example Date Handling

json
// Request with Date
{
  "json": {
    "startDate": "2024-01-01T00:00:00.000Z"
  },
  "meta": {
    "values": {
      "startDate": ["Date"]
    }
  }
}

CORS Configuration

The API supports cross-origin requests from:

  • https://itms.solutions
  • https://www.itms.solutions
  • https://*.pages.dev (Cloudflare Pages previews)
  • http://localhost:3000 (development)

Allowed Methods

GET, POST, PUT, DELETE, OPTIONS

Allowed Headers

Content-Type, Authorization, x-trpc-source

Rate Limiting

Currently, no rate limiting is applied. This may change in future versions.

Timeouts

  • Request timeout: 30 seconds
  • Keep-alive: Enabled
  • Maximum request body: 10MB

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