API Documentation

Integrate RestroGuard with your IoT devices

Authentication

All API requests require authentication. You can authenticate using one of two methods:

Method 1: Bearer Token (Recommended)

Include your API token in the Authorization header:

Authorization: Bearer YOUR_API_TOKEN

Method 2: Workspace ID

For device-only endpoints, you can use the Workspace-Id header:

Workspace-Id: YOUR_WORKSPACE_ID
POST /api/v1/alerts

Create a new alert from a device button press

Auth: Bearer or Workspace-Id

Request Body

{
    "serial": "string (device serial)",
    "button_number": "integer (1-8)"
}

Response Example

{
    "success": true,
    "data": {
        "alert_id": 123,
        "alert_type": "not_clean",
        "button_number": 2
    }
}

Try It Out

GET /api/v1/alerts

List all alerts with pagination

Auth: Bearer Token

Query Parameters

{
    "per_page": "integer (1-100)",
    "resolved": "boolean",
    "device_id": "integer"
}

Response Example

{
    "success": true,
    "data": {
        "alerts": [],
        "pagination": []
    }
}

Try It Out

GET /api/v1/alerts/counts

Get today's alert counts for all 8 button types

Auth: Bearer Token

Response Example

{
    "success": true,
    "data": {
        "today_counts": [],
        "total_today": 50,
        "unresolved": 3
    }
}

Try It Out

PATCH /api/v1/alerts/{id}/resolve

Mark an alert as resolved

Auth: Bearer Token

Request Body

{
    "note": "string (optional)"
}

Response Example

{
    "success": true,
    "data": {
        "alert_id": 123,
        "resolved_at": "2024-01-15T10:30:00Z"
    }
}

Try It Out

PATCH /api/v1/devices/{serial}/heartbeat

Update device status (battery, signal)

Auth: Bearer or Workspace-Id

Request Body

{
    "battery_percent": "integer (0-100)",
    "rssi": "integer"
}

Response Example

{
    "success": true,
    "data": {
        "device_id": 1,
        "status": "online"
    }
}

Try It Out

Policy API Public - No Auth Required

Mobile applications can fetch policy content using these public endpoints.

GET /api/v1/policies

Get all policy pages content.

{
  "privacy_policy": "

GET /api/v1/policies/privacy

Get Privacy Policy content only.

{
  "title": "Privacy Policy",
  "content": "

GET /api/v1/policies/terms

Get Terms & Conditions content only.

GET /api/v1/policies/returns

Get Return Policy content only.

Button Reference

1
Clean ✅
2
Not Clean 🔴
3
Toilet Blocked ⛔
4
No Toilet Paper 📄
5
No Paper Towel 🌬️
6
No Soap 💧
7
Trash Full 🗑️
8
Staff Clean 👤