CPI Documentation
API Reference

API Reference

REST API reference for the CPI IoT Dashboard Platform, generated from the OpenAPI specification.

Overview

The CPI REST API is available at https://api.cpi.lovinka.com/api/v1.

Authentication

Most endpoints require JWT authentication via httpOnly cookie (access_token). Authenticate with:

curl -X POST https://api.cpi.lovinka.com/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -c cookies.txt \
  -d '{"email": "your@email.com", "password": "your-password"}'

Base URL

EnvironmentURL
Productionhttps://api.cpi.lovinka.com/api/v1
Local Developmenthttp://localhost:4410/api/v1

Interactive Documentation

The API also provides Swagger UI at:

  • Production: https://api.cpi.lovinka.com/api-docs
  • Local: http://localhost:4410/api-docs

Endpoints

Auth

MethodEndpointDescription
POST/auth/registerRegister a new user
POST/auth/loginLogin, receive JWT cookie
POST/auth/logoutClear JWT cookie
GET/auth/meGet current user profile

Devices

MethodEndpointAuthDescription
GET/devicesAnyList devices (paginated)
POST/devicesOPERATOR+Register a new device
GET/devices/:idAnyGet device details
PATCH/devices/:idOPERATOR+Update device
DELETE/devices/:idADMINDelete device
POST/devices/:id/provisionADMINGenerate provisioning package
POST/devices/:id/mqtt-tokenADMINIssue fresh MQTT JWT
POST/devices/:id/rotate-secretADMINRotate HMAC secret
POST/devices/:id/suspendADMINSuspend device
POST/devices/:id/reactivateADMINReactivate device
POST/devices/:id/revokeADMINDecommission device
POST/devices/:id/commandsOPERATOR+Send command

Telemetry

MethodEndpointDescription
GET/telemetry/:deviceIdGet telemetry data (supports time_bucket aggregation)

Alerts

MethodEndpointDescription
GET/alertsList alerts (paginated)
POST/alertsCreate alert rule
PATCH/alerts/:idUpdate alert
POST/alerts/:id/acknowledgeAcknowledge alert
POST/alerts/:id/resolveResolve alert

Users

MethodEndpointAuthDescription
GET/usersADMINList users
PATCH/users/:idADMINUpdate user role

For detailed request/response schemas, visit the interactive Swagger documentation at /api-docs.

On this page