Teqlogy REST API

Overview

The Teqlogy API lets you control your smart devices, read real-time sensor data, and receive live state updates — from Postman, scripts, or custom integrations.

REST API
Standard HTTP endpoints — JSON request/response.
WebSocket
Real-time relay & energy updates pushed to your client.
Secure
SHA-256 hashed API keys, HTTPS only, rate limited.

Request format

http
Content-Type: application/json
Authorization: Bearer tk_live_<your-key>

Device Types

Teqlogy supports two device families. Each has different fields in API responses and different available endpoints.

PowerMatrix-8
8-channel smart relay controller
  • 8 individually controllable relays
  • Physical button overrides
  • IR remote learning & control
  • Relay automations (weekly / one-shot)
  • Server-side auto-off timers
  • Named relay labels & icons
EnergyMate-3
3-phase smart energy meter
  • Real-time voltage, current, power
  • Energy consumption (kWh)
  • 3 independent meter readings
  • Power factor & frequency
  • Hourly/daily energy history
  • Configurable alert thresholds
The type field in every device response tells you which family it belongs to: "PowerMatrix-8", "PowerMatrix-8-beta", or "EnergyMate-3".

Authentication

Every request must include a Personal API Key in the Authorization header.

http
Authorization: Bearer tk_live_a3f9b2c1d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1
Format
stringtk_live_ prefix + 64 hex chars (72 total)
Storage
hashedSHA-256 hash only stored — plain key shown once at creation
Expiry
dynamicSet by admin — 1 week / 1 month / 6 months / 1 year / lifetime
Scope
enumread-write (default) or read-only — fixed at creation
Max keys
integerUp to 10 active keys per account
Keys are shown exactly once at creation. Store them securely — they cannot be retrieved again.

Get an API Key

01
Request access
Contact Teqlogy support or upgrade your plan. Admin enables API access on your account.
02
Sign in
Log in at teqhome.teqlogy.com with your registered email.
03
Open API Keys
In the left sidebar click API Keys (visible only when access is enabled).
04
Generate
Click Generate Key, enter a label, choose read-write or read-only, confirm.
05
Copy immediately
The key is shown once. Copy it to your password manager — it cannot be retrieved again.
Generate separate keys for each integration so you can revoke one without affecting others.

Rate Limits

ScopeLimitWindow
HTTP endpoints120 requests1 minute
WebSocket messages30 messages10 seconds

Exceeding the limit returns 429 Too Many Requests. Check the Retry-After header.

Endpoints

All endpoints require a valid API key. Endpoints tagged with a device badge only apply to that device family.

List Devices

GET/api/devices/mePowerMatrix-8EnergyMate-3

Returns all devices owned by or shared with your account, sorted by last activity.

bash
curl https://teqhome.teqlogy.com/api/devices/me \
  -H "Authorization: Bearer tk_live_..."

Response

json
{
  "ok": true,
  "devices": [
    {
      "deviceId": "aabbcc112233",
      "name": "Living Room",
      "type": "PowerMatrix-8",
      "status": true,
      "relays": [1, 0, 1, 0, 0, 0, 0, 0],
      "firmware": "1.0.14",
      "lastSeen": "2026-05-31T14:20:00.000Z"
    },
    {
      "deviceId": "ddeeff445566",
      "name": "Main Panel",
      "type": "EnergyMate-3",
      "status": true,
      "voltage": 231.4,
      "current": 4.82,
      "power": 1112.5,
      "energy": 48.32,
      "frequency": 50.01,
      "pf": 0.994,
      "firmware": "2.1.3",
      "lastSeen": "2026-05-31T14:20:05.000Z"
    }
  ]
}

Device State

GET/api/devices/d/:deviceIdPowerMatrix-8EnergyMate-3

Full state of a single device. The response shape differs by device type.

:deviceIdrequired
string12-char hex hardware ID (lowercase MAC without colons)
bash
curl https://teqhome.teqlogy.com/api/devices/d/aabbcc112233 \
  -H "Authorization: Bearer tk_live_..."

PowerMatrix-8 response

PowerMatrix-8
json
{
  "ok": true,
  "device": {
    "deviceId": "aabbcc112233",
    "name": "Living Room",
    "type": "PowerMatrix-8",
    "status": true,
    "relays": [1, 0, 1, 0, 0, 0, 0, 0],
    "firmware": "1.0.14",
    "rssi": -62,
    "lastSeen": "2026-05-31T14:20:00.000Z",
    "config": {
      "relayMeta": [
        { "index": 0, "name": "Main Light", "icon": "light_ceiling" },
        { "index": 1, "name": "Fan",        "icon": "fan" }
      ],
      "automations": [
        {
          "id": "auto_001",
          "name": "Morning Lights",
          "enabled": true,
          "relayIndex": 0,
          "targetState": "ON",
          "kind": "weekly",
          "time": "07:00",
          "days": [1, 2, 3, 4, 5]
        }
      ],
      "irCodes": [
        { "id": "ir_abc123", "relayIndex": 0, "code": "F30CFF00", "name": "TV Remote 1" }
      ],
      "relayTimers": [
        { "relayIndex": 2, "expiresAt": "2026-05-31T15:00:00.000Z" }
      ]
    }
  }
}
relays[] — 8 integers: 1 = ON, 0 = OFF. Index 0 = relay 1.

EnergyMate-3 response

EnergyMate-3
json
{
  "ok": true,
  "device": {
    "deviceId": "ddeeff445566",
    "name": "Main Panel",
    "type": "EnergyMate-3",
    "status": true,
    "voltage":   231.4,
    "current":   4.82,
    "power":     1112.5,
    "energy":    48.32,
    "frequency": 50.01,
    "pf":        0.994,
    "voltMin":   190,
    "voltMax":   240,
    "firmware": "2.1.3",
    "meters": [
      { "index": 0, "voltage": 231.4, "current": 2.10, "power": 486.0,  "energy": 18.3, "pf": 0.998 },
      { "index": 1, "voltage": 230.8, "current": 1.60, "power": 369.3,  "energy": 16.1, "pf": 0.994 },
      { "index": 2, "voltage": 231.9, "current": 1.12, "power": 259.7,  "energy": 13.9, "pf": 0.990 }
    ],
    "config": {
      "alertThresholds": {
        "maxPower":   5000,
        "maxCurrent": 25,
        "maxVoltage": 240,
        "minVoltage": 190
      }
    }
  }
}

Update Preferences

PATCH/api/devices/:deviceId/preferencesPowerMatrix-8EnergyMate-3

Update device name, relay labels/icons, automations, energy bill rate, alert thresholds, or scenes. Send only the fields you want to change — all others are preserved.

This endpoint is blocked for read-only keys.

Body fields

name
stringHuman-readable device name (max 60 chars)
relayMeta
arrayPowerMatrix-8 — relay labels/icons. See relay meta schema below.
automations
arrayPowerMatrix-8 — weekly or one-shot automations. See automation schema.
billRate
numberEnergyMate-3 — cost per kWh in your local currency
alertThresholds
objectEnergyMate-3 — maxPower, maxCurrent, maxVoltage, minVoltage

Relay meta schema

PowerMatrix-8
json
[
  { "index": 0, "name": "Main Light", "icon": "light_ceiling" },
  { "index": 1, "name": "Fan",        "icon": "fan"           }
]

Supported icons: power · plug · fan · fan_ceiling · ac · heater · geyser · light_bulb · light_ceiling · tube_single · tv · speaker · camera · gate · garage · motor · solar · router and more.

Automation schema

PowerMatrix-8
json
// Weekly automation — runs every Mon-Fri at 07:00
{
  "id": "auto_001",
  "name": "Morning Lights",
  "enabled": true,
  "relayIndex": 0,
  "targetState": "ON",
  "kind": "weekly",
  "time": "07:00",
  "days": [1, 2, 3, 4, 5],
  "timezoneOffsetMinutes": 300
}

// One-shot timer — runs once at specific ISO timestamp
{
  "id": "auto_002",
  "name": "Party Mode Off",
  "enabled": true,
  "relayIndex": 3,
  "targetState": "OFF",
  "kind": "timer",
  "runAt": "2026-06-01T23:00:00.000Z",
  "timezoneOffsetMinutes": 300
}
idrequired
stringUnique string ID — generate with uuid or similar
relayIndexrequired
integerRelay to control (0–7)
targetStaterequired
enum"ON" | "OFF" | "IR" (IR fires a stored IR code)
kindrequired
enum"weekly" (recurring) | "timer" (one-shot run at runAt)
time
stringWeekly only — "HH:MM" in 24-hour format
days
number[]Weekly only — 1=Mon, 2=Tue … 7=Sun
runAt
ISO dateTimer only — ISO 8601 datetime string
timezoneOffsetMinutes
integerYour UTC offset in minutes (e.g. PKT = +300)

Alert thresholds schema

EnergyMate-3
json
{
  "alertThresholds": {
    "maxPower":   5000,
    "maxCurrent": 25,
    "maxVoltage": 240,
    "minVoltage": 190
  }
}

Full example — rename + set relay labels

bash
curl -X PATCH https://teqhome.teqlogy.com/api/devices/aabbcc112233/preferences \
  -H "Authorization: Bearer tk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Living Room Lights",
    "relayMeta": [
      { "index": 0, "name": "Ceiling Light", "icon": "light_ceiling" },
      { "index": 1, "name": "Fan",           "icon": "fan"           }
    ]
  }'

Relay Control

POST/api/devices/:deviceId/relayPowerMatrix-8

Turn a relay ON or OFF in real-time. The command is forwarded to the device over WebSocket. Device must be online.

Blocked for read-only keys. Returns 403.
relayrequired
integerRelay index 0–7 (relay 1 = index 0, relay 8 = index 7)
staterequired
booleantrue = ON, false = OFF
bash
curl -X POST https://teqhome.teqlogy.com/api/devices/aabbcc112233/relay \
  -H "Authorization: Bearer tk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "relay": 0, "state": true }'

JavaScript

javascript
await fetch('https://teqhome.teqlogy.com/api/devices/aabbcc112233/relay', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer tk_live_...', 'Content-Type': 'application/json' },
  body: JSON.stringify({ relay: 0, state: true })
})

Python

python
import requests
r = requests.post(
    'https://teqhome.teqlogy.com/api/devices/aabbcc112233/relay',
    headers={'Authorization': 'Bearer tk_live_...'},
    json={'relay': 0, 'state': True}
)
print(r.json())  # {'ok': True}

Relay Timer (Auto-Off)

Set a server-side timer that automatically turns a relay OFF after a specified number of seconds. Useful for "turn on for X minutes" automations. The timer survives app restarts and runs even if your client disconnects.

POST/api/devices/:deviceId/relay-timerPowerMatrix-8
relayIndexrequired
integerRelay index 0–7
secondsrequired
integerAuto-off delay in seconds (1–86400 / max 24 hours)
bash
# Turn relay 2 off automatically after 30 minutes
curl -X POST https://teqhome.teqlogy.com/api/devices/aabbcc112233/relay-timer \
  -H "Authorization: Bearer tk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "relayIndex": 2, "seconds": 1800 }'

Response

json
{ "ok": true, "relayIndex": 2, "expiresAt": "2026-05-31T15:00:00.000Z", "secondsRemaining": 1800 }
DELETE/api/devices/:deviceId/relay-timer/:relayIndexPowerMatrix-8

Cancel a pending auto-off timer for a relay.

bash
curl -X DELETE https://teqhome.teqlogy.com/api/devices/aabbcc112233/relay-timer/2 \
  -H "Authorization: Bearer tk_live_..."

Response

json
{ "ok": true, "relayIndex": 2, "cancelled": true }

IR Remote Codes

PowerMatrix-8 has a built-in IR receiver/transmitter. You can teach it to recognize remote control buttons and use them as relay triggers.

POST/api/devices/:deviceId/ir/learnPowerMatrix-8

Puts the device into IR learn mode for one relay. Point your remote at the device and press the button — the device captures the code and sends it back via WebSocket as an irLearned event.

relayrequired
integerWhich relay this IR code will control (0–7)
bash
curl -X POST https://teqhome.teqlogy.com/api/devices/aabbcc112233/ir/learn \
  -H "Authorization: Bearer tk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "relay": 0 }'

Response

json
{ "ok": true, "waiting": true, "message": "Point your remote at the device and press a button." }
After the device captures the code, it pushes an irLearned WebSocket event to your app with the captured hex code. You then call ir/save to store it.
POST/api/devices/:deviceId/ir/savePowerMatrix-8

Save a captured (or manually entered) IR hex code to the device config. Saved codes are pushed to the device NVS so they work offline.

relayrequired
integerRelay index 0–7
coderequired
stringIR code as hex string (e.g. F30CFF00)
namerequired
stringHuman label for this code (e.g. TV Power)
bash
curl -X POST https://teqhome.teqlogy.com/api/devices/aabbcc112233/ir/save \
  -H "Authorization: Bearer tk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "relay": 0, "code": "F30CFF00", "name": "TV Power" }'
DELETE/api/devices/:deviceId/ir/:irIdPowerMatrix-8

Remove a saved IR code by its ID (returned in the device state response under config.irCodes[].id).

bash
curl -X DELETE https://teqhome.teqlogy.com/api/devices/aabbcc112233/ir/ir_abc123 \
  -H "Authorization: Bearer tk_live_..."

Energy History

GET/api/devices/:deviceId/energy-historyEnergyMate-3

Returns averaged energy snapshots grouped by hour or day for an EnergyMate-3 device. Default window is the last 24 hours.

Query parameters

resolution
enum"hourly" (default) | "daily" — grouping granularity
from
ISO dateStart of window (default: 24 hours ago)
to
ISO dateEnd of window (default: now)
bash
# Last 7 days, grouped by day
curl "https://teqhome.teqlogy.com/api/devices/ddeeff445566/energy-history?resolution=daily&from=2026-05-24T00:00:00Z&to=2026-05-31T23:59:59Z" \
  -H "Authorization: Bearer tk_live_..."

Response

json
{
  "ok": true,
  "resolution": "daily",
  "from": "2026-05-24T00:00:00.000Z",
  "to":   "2026-05-31T23:59:59.000Z",
  "data": [
    {
      "timestamp": "2026-05-24",
      "voltage":   230.8,
      "current":   4.51,
      "power":     1040.3,
      "energy":    24.97,
      "frequency": 50.00,
      "pf":        0.993,
      "count":     144
    }
  ]
}
energy is cumulative kWh at that point in time. count is how many raw snapshots were averaged into this bucket.

Relay Logs

GET/api/relay-logs/:deviceIdPowerMatrix-8

Relay toggle history for a device. Records are auto-deleted after 30 days.

limit
integerRecords to return (default 50, max 200)
relayIndex
integerFilter by relay 0–7 (optional)
bash
curl "https://teqhome.teqlogy.com/api/relay-logs/aabbcc112233?limit=20&relayIndex=0" \
  -H "Authorization: Bearer tk_live_..."

Response

json
[
  { "relayIndex": 0, "state": "ON",  "source": "api",      "createdAt": "2026-05-31T14:20:00.000Z" },
  { "relayIndex": 0, "state": "OFF", "source": "button",   "createdAt": "2026-05-31T14:18:30.000Z" },
  { "relayIndex": 0, "state": "ON",  "source": "automation","createdAt": "2026-05-31T07:00:01.000Z" }
]
source: app · api · button · automation · ir · schedule

WebSocket Ticket

POST/api/ws-ticket

Exchange your API key for a 30-second single-use WebSocket ticket.

bash
curl -X POST https://teqhome.teqlogy.com/api/ws-ticket \
  -H "Authorization: Bearer tk_live_..."

Response

json
{ "ticket": "3f9b2c1d-4e5f-6a7b-8c9d-0e1f2a3b4c5d" }
Tickets expire in 30 seconds and can only be used once. Fetch a new ticket each time you open a connection.

WebSocket

Real-time bidirectional connection. Receive device state changes, relay events, and energy updates without polling.

Connect

javascript
// Step 1 — exchange API key for a ticket
const { ticket } = await fetch(
  'https://teqhome.teqlogy.com/api/ws-ticket',
  { method: 'POST', headers: { 'Authorization': 'Bearer tk_live_...' } }
).then(r => r.json())

// Step 2 — open connection
const ws = new WebSocket(`wss://teqhome.teqlogy.com/ws/app?ticket=${ticket}`)
ws.onmessage = ({ data }) => console.log(JSON.parse(data))

Commands you can send

typeEffect
toggleRelay{ type, deviceId, relay, state }
Turn relay ON/OFF (PowerMatrix-8)
ping{ type: "ping" }
Keep-alive — server ignores, heartbeat maintained

Events you receive

typeDeviceKey fields
deviceOnlinebothdeviceId, device (full state)
deviceOfflinebothdeviceId
telemetryUpdatebothdeviceId, data.relays[] OR data.voltage/power/energy
deviceUpdatedbothdeviceId, device (config changed)
irLearnedPowerMatrix-8deviceId, relay, code
otaResultbothdeviceId, success, version
appNotificationbothnotification.title, .body

Full example — live monitor

javascript
async function connect(apiKey) {
  const { ticket } = await fetch(
    'https://teqhome.teqlogy.com/api/ws-ticket',
    { method: 'POST', headers: { Authorization: `Bearer ${apiKey}` } }
  ).then(r => r.json())

  const ws = new WebSocket(`wss://teqhome.teqlogy.com/ws/app?ticket=${ticket}`)

  ws.onopen  = () => console.log('Connected')
  ws.onclose = () => setTimeout(() => connect(apiKey), 5000)  // auto-reconnect

  ws.onmessage = ({ data }) => {
    const msg = JSON.parse(data)

    if (msg.type === 'telemetryUpdate') {
      if (msg.data?.relays) {
        // PowerMatrix-8 relay states
        console.log(`${msg.deviceId} relays:`, msg.data.relays)
      } else {
        // EnergyMate-3 energy data
        console.log(`${msg.deviceId} power: ${msg.data?.power}W`)
      }
    }

    if (msg.type === 'irLearned') {
      console.log(`IR code captured: relay=${msg.relay} code=${msg.code}`)
      // Now call POST /ir/save to store it
    }
  }
}

Read-Only Keys

Allowed
  • GET /api/devices/me
  • GET /api/devices/d/:id
  • GET /api/devices/:id/energy-history
  • GET /api/relay-logs/:id
  • POST /api/ws-ticket
  • WebSocket — receive all events
Blocked (403)
  • POST /api/devices/:id/relay
  • PATCH /api/devices/:id/preferences
  • POST /api/devices/:id/relay-timer
  • POST /api/devices/:id/ir/learn
  • POST /api/devices/:id/ir/save
  • DELETE /api/devices/:id/ir/:irId
  • WebSocket — toggleRelay
Use read-only keys for monitoring dashboards — they can see all device states and energy history but cannot change anything.

Errors

Every error response includes a stable code, a human-readable message, and a requestId for support tracing.

Error response format

json
{
  "ok":        false,
  "code":      "DEVICE_OFFLINE",
  "message":   "Device is offline — cannot push command",
  "requestId": "req_a1b2c3d4e5f6g7h8"
}
The X-Request-Id HTTP response header contains the same ID — log it on your client. Share it with support for exact log lookup.

HTTP status codes

StatusMeaningWhen
401UnauthorizedMissing, invalid, or expired credential
403ForbiddenAPI disabled / expired / read-only key / banned account
404Not FoundDevice or endpoint does not exist
429Too Many RequestsRate limit exceeded — check Retry-After
503Service Unavail.Device is offline
500Server ErrorUnexpected error — safe to retry

Error codes

Use code for programmatic handling — stable across versions. message may change.

codeHTTPMeaning
AUTH_MISSING401No Authorization header
AUTH_INVALID401JWT or API key invalid / not found
AUTH_EXPIRED401JWT token has expired
AUTH_BANNED403Account suspended
AUTH_DELETED410Account permanently deleted
API_ACCESS_DISABLED403Admin has not enabled API access for this account
API_ACCESS_EXPIRED403API access period has ended
API_KEY_READONLY403Write op with read-only key
API_KEY_LIMIT40010-key limit reached
API_KEY_NOT_FOUND404Key ID not found
DEVICE_NOT_FOUND404Device not found or not yours
DEVICE_OFFLINE503Device WebSocket not connected
DEVICE_ACCESS_DENIED403Not owner and not shared with you
VALIDATION_ERROR400Missing / invalid field
RELAY_INDEX_INVALID400relay must be 0–7
IR_CODE_INVALID400IR code must be valid hex
IR_CODE_LIMIT40032-code limit per device
TIMER_SECONDS_INVALID400seconds must be 1–86400
RATE_LIMITED429Too many requests
NOT_FOUND404Endpoint does not exist
SERVER_ERROR500Unexpected server error

requestId — tracing

javascript
// From response header (every request)
const requestId = response.headers.get('X-Request-Id')
// "req_a1b2c3d4e5f6g7h8"

// Or from error body
const { code, message, requestId } = await response.json()
if (code === 'DEVICE_OFFLINE') {
  console.error('Device is offline, requestId:', requestId)
}

Ready to build?

Sign in, generate an API key, and start controlling your Teqlogy devices in minutes.

© 2026 Teqlogy · API v1.0