Back to Developers

API Reference

Complete documentation for the Onwords Smart Device API

Getting Started

The Onwords Smart Device API allows you to control your connected devices programmatically.

Base URL

https://ostapi.onwords.in
Real-time Control

Instant device control via MQTT

Secure

API key authentication

RESTful

Standard REST endpoints

JSON

Clean JSON responses

Authentication

All API requests require authentication using the x-api-key header.

Get your API key

Email us at [email protected] to get your API key.

Request Headers

x-api-key: YOUR_API_KEY
Content-Type: application/json

Gate Control API

Control your gate modules - open, close, and pause.

Supported Gate Types

3chsg

Sliding Gate

3chag

Arm Gate

3chsgsl

Sliding Gate Advanced

POST/control-device/

Control the gate - open, close, or pause

Request Body

{
  "action": "open",
  "product_id": "3chsg_xxxxx"
}

Response

{
  "status": "success",
  "product_id": "3chsg_xxxxx",
  "gate_type": "Sliding Gate"
}

Available Actions

Gate TypeActions
Sliding Gateopen, close, pause
Arm Gateopen_single_gate, close_single_gate, open_double_gate, close_double_gate
Sliding Gate Advancedopen, close, pause, partial_open

3CH Relay API

Control individual channels on your 3-channel relay module.

POST/control-device/

Control relay channel

Request Body

{
  "action": "on",
  "product_id": "3chrelay_xxxxx",
  "channel": 1
}

Response

{
  "status": "success",
  "product_id": "3chrelay_xxxxx",
  "channel": 1,
  "state": "on"
}

Error Handling

200

Success

Request completed

400

Bad Request

Invalid action or parameters

403

Forbidden

Invalid API key or unauthorized product

404

Not Found

User or gate type not found

Error Response
{
  "detail": "Invalid API key"
}