BUILT FOR YOUR NEXT IDEA

Open by design.

A common language between your hardware and your AI. Explore the architecture behind a seamless connection.

Base URL: https://api.omnisense.co.ke · Authenticate every request with your API key from the OmniSense app (Settings → API Keys). IDs in examples are samples.

Authentication

Every request is authenticated with an API key created in the OmniSense app under Settings → API Keys. The key value is shown only once when created — store it securely.

Send it in the X-Authorization header using the ApiKey scheme. Requests without a valid, enabled and unexpired key return 401 Unauthorized.

curl "https://api.omnisense.co.ke/api/device/abb55770-efdb-11f0-9137-176e9da567e3" \
  -H "X-Authorization: ApiKey $YOUR_API_KEY_VALUE"

Get Device Details

GET /api/device/:device_id

Retrieve identity, hardware profile and connectivity state for a provisioned OmniSense device.

The deviceProfileName identifies the hardware family (e.g. ESP32-1R-2G-240V for a GSM relay controller, BT05B-TEMP for a BLE temperature logger) and determines which capabilities — sensors, live channel control, schedules — the device supports.

A device should be treated as online only when active is true AND its rst client attribute is not true (rst=true means the device is resetting or rebooting).

curl "https://api.omnisense.co.ke/api/device/abb55770-efdb-11f0-9137-176e9da567e3" \
  -H "X-Authorization: ApiKey $YOUR_API_KEY_VALUE" \
  -H "Accept: application/json"

// Response:
{
  "id": {
    "entityType": "DEVICE",
    "id": "abb55770-efdb-11f0-9137-176e9da567e3"
  },
  "createdTime": 1768238720615,
  "name": "OmniSense Gateway X1",
  "label": "Cold Room A",
  "type": "default",
  "deviceProfileName": "ESP32-1R-2G-240V",
  "customerId": {
    "entityType": "CUSTOMER",
    "id": "349be010-f061-11f0-9137-176e9da567e3"
  },
  "active": true,
  "additionalInfo": {
    "gateway": false,
    "description": ""
  }
}

Manage Schedules

POST /api/cache/commands

Schedules run autonomously on the device, so they keep working even when connectivity drops. They are not written directly to the device — you queue a command with the OmniSense Command Manager, which delivers it, retries up to the retries budget and tracks its state (created → sent → resolved).

Use cmdType schedule_create with method CRT, schedule_update with method UPT, and schedule_delete with method DEL. time is minutes after midnight (480 = 08:00), duration is in seconds, and days_mask is a 7-bit weekday mask (62 = Monday–Friday, 127 = every day). state 1 enables a schedule and 0 pauses it.

A queued command that has not been delivered yet can be cancelled with DELETE /api/cache/commands/:cmd_id. The device must be online for delete commands to be accepted.

# Create
curl -X POST "https://api.omnisense.co.ke/api/cache/commands" \
  -H "X-Authorization: ApiKey $YOUR_API_KEY_VALUE" \
  -H "Content-Type: application/json" \
  -d '{
  "cmdId": "1769207330211_k3f9a2qd",
  "cmdType": "schedule_create",
  "devId": "abb55770-efdb-11f0-9137-176e9da567e3",
  "retries": 2,
  "payload": {
    "method": "CRT",
    "params": {
      "id": 1,
      "time": 480,
      "duration": 30,
      "gpio_pins": [
        16
      ],
      "days_mask": 62,
      "channel": 1
    }
  },
  "cmdState": "created",
  "response": null
}'

// Response:
{
  "cmdId": "1769207330211_k3f9a2qd",
  "cmdState": "created"
}

# Update (pause schedule 1)
curl -X POST "https://api.omnisense.co.ke/api/cache/commands" \
  -H "X-Authorization: ApiKey $YOUR_API_KEY_VALUE" \
  -H "Content-Type: application/json" \
  -d '{
  "cmdId": "1769207401874_p8w2m1xz",
  "cmdType": "schedule_update",
  "devId": "abb55770-efdb-11f0-9137-176e9da567e3",
  "retries": 2,
  "payload": {
    "method": "UPT",
    "params": {
      "id": 1,
      "time": 480,
      "duration": 30,
      "gpio_pin": 16,
      "days_mask": 62,
      "channel": 1,
      "state": 0
    }
  },
  "cmdState": "created",
  "response": null
}'

# Delete
curl -X POST "https://api.omnisense.co.ke/api/cache/commands" \
  -H "X-Authorization: ApiKey $YOUR_API_KEY_VALUE" \
  -H "Content-Type: application/json" \
  -d '{
  "cmdId": "1769207455020_c7n4v0lb",
  "cmdType": "schedule_delete",
  "devId": "abb55770-efdb-11f0-9137-176e9da567e3",
  "retries": 2,
  "payload": {
    "method": "DEL",
    "params": {
      "ids": [
        1,
        2
      ]
    }
  },
  "cmdState": "created",
  "response": null
}'

# Cancel a pending command
curl -X DELETE "https://api.omnisense.co.ke/api/cache/commands/1769207330211_k3f9a2qd" \
  -H "X-Authorization: ApiKey $YOUR_API_KEY_VALUE"

Get Pending Commands

GET /api/cache/commands?devId=:device_id

List commands queued for a device that the Command Manager has not yet resolved. Use this to show progress in your own tools or to let an AI agent wait for a schedule change to land before reporting success.

cmdState moves from created (queued) to sent (delivered to the device) to resolved (device acknowledged). response holds the device's acknowledgement once available.

curl "https://api.omnisense.co.ke/api/cache/commands?devId=abb55770-efdb-11f0-9137-176e9da567e3" \
  -H "X-Authorization: ApiKey $YOUR_API_KEY_VALUE" \
  -H "Accept: application/json"

// Response:
[
  {
    "cmdId": "1769207330211_k3f9a2qd",
    "cmdType": "schedule_create",
    "devId": "abb55770-efdb-11f0-9137-176e9da567e3",
    "retries": 2,
    "cmdState": "sent",
    "payload": {
      "method": "CRT",
      "params": {
        "id": 1,
        "time": 480,
        "duration": 30,
        "gpio_pins": [
          16
        ],
        "days_mask": 62,
        "channel": 1
      }
    },
    "response": null
  }
]

Factory Reset

POST /api/plugins/rpc/oneway/:device_id

Send a one-way command that restores the device to factory firmware settings. This cannot be undone: stored schedules and network credentials are cleared and the device must be provisioned again through the OmniSense app.

While resetting, the device publishes the rst client attribute as true and should be treated as offline until it reconnects.

curl -X POST "https://api.omnisense.co.ke/api/plugins/rpc/oneway/abb55770-efdb-11f0-9137-176e9da567e3" \
  -H "X-Authorization: ApiKey $YOUR_API_KEY_VALUE" \
  -H "Content-Type: application/json" \
  -d '{
  "method": "rst",
  "params": {
    "rst": true
  }
}'

// Response: 200 OK (empty body)

Toggle Device Channel

POST /api/plugins/rpc/oneway/:device_id

Switch an output port on or off in real time with the TRG method. gpio_pin identifies the port; duration -1 turns it on and -2 turns it off. The device must be online.

To move a device onto a different channel (a named group of outputs shared across devices), send the CHN method with the channel number. The device reports its new state back through client attributes.

# Turn port on GPIO 16 ON (use -2 for OFF)
curl -X POST "https://api.omnisense.co.ke/api/plugins/rpc/oneway/abb55770-efdb-11f0-9137-176e9da567e3" \
  -H "X-Authorization: ApiKey $YOUR_API_KEY_VALUE" \
  -H "Content-Type: application/json" \
  -d '{
  "method": "TRG",
  "params": {
    "gpio_pin": 16,
    "duration": -1
  }
}'

# Change current channel
curl -X POST "https://api.omnisense.co.ke/api/plugins/rpc/oneway/abb55770-efdb-11f0-9137-176e9da567e3" \
  -H "X-Authorization: ApiKey $YOUR_API_KEY_VALUE" \
  -H "Content-Type: application/json" \
  -d '{
  "method": "CHN",
  "params": {
    "channel": 2
  }
}'

Get Telemetry Keys

GET /api/plugins/telemetry/DEVICE/:device_id/keys/timeseries

Discover which measurements a device reports before querying data. A BLE temperature logger typically returns temperature and humidity, while a GPS tracker returns location and battery keys.

Pass the returned keys to the Get Telemetry Data endpoint.

curl "https://api.omnisense.co.ke/api/plugins/telemetry/DEVICE/abb55770-efdb-11f0-9137-176e9da567e3/keys/timeseries" \
  -H "X-Authorization: ApiKey $YOUR_API_KEY_VALUE" \
  -H "Accept: application/json"

// Response:
[
  "temperature",
  "humidity",
  "battery",
  "rssi"
]

Get Telemetry Data

GET /api/plugins/telemetry/DEVICE/:device_id/values/timeseries

Retrieve time-series readings for one or more keys. keys is a comma-separated list; startTs and endTs are Unix epoch milliseconds.

Use limit (up to 10000) and agg=NONE to get raw readings, or an aggregation (AVG, MIN, MAX, SUM) with interval for bucketed data. Values are returned as strings — parse them as numbers in your workflow.

For live streams, subscribe over WebSocket instead of polling.

curl "https://api.omnisense.co.ke/api/plugins/telemetry/DEVICE/abb55770-efdb-11f0-9137-176e9da567e3/values/timeseries?keys=temperature,humidity&startTs=1769164800000&endTs=1769251200000&limit=10000&agg=NONE" \
  -H "X-Authorization: ApiKey $YOUR_API_KEY_VALUE" \
  -H "Accept: application/json"

// Response:
{
  "temperature": [
    {
      "ts": 1769251140000,
      "value": "4.6"
    },
    {
      "ts": 1769251080000,
      "value": "4.8"
    }
  ],
  "humidity": [
    {
      "ts": 1769251140000,
      "value": "71.2"
    }
  ]
}