BASE URL

Command API

POST /api/command.php

Trigger gate actions from external systems. Use this endpoint to open, close, or toggle gates.

Request Body

Parameter Type Description
device_id required string The 6-character device ID of the gate
command required string One of: open, close, toggle

Response

{ "success": true, "device_id": "A1B2C3", "position": "opening", "auto_close_in": 32 }

Code Examples

curl -X POST /api/command.php \ -H "Content-Type: application/json" \ -d '{"device_id": "A1B2C3", "command": "open"}'

Try It

Status API

POST /api/status.php

Query the current status of a gate. Returns position, online status, and configuration.

Request Body

Parameter Type Description
device_id required string The 6-character device ID of the gate

Response

{ "device_id": "A1B2C3", "name": "Main Entrance", "gate_type": "double_leaf", "online": true, "position": "closed", "auto_close_in": null, "auto_close_time": 30, "guard_hut": true, "last_command": "2026-01-29T10:30:00+00:00" }

Position Values

Value Description
closed Gate is fully closed
opening Gate is in the process of opening
open Gate is fully open
closing Gate is in the process of closing

Code Examples

curl -X POST /api/status.php \ -H "Content-Type: application/json" \ -d '{"device_id": "A1B2C3"}'

Try It

Error Responses

All endpoints return errors in the following format:

{ "error": true, "message": "Description of the error" }

Common Error Codes

HTTP Status Description
400 Bad Request - Missing or invalid parameters
404 Not Found - Device ID does not exist
405 Method Not Allowed - Wrong HTTP method
503 Service Unavailable - Gate is offline

Available Gates

These are the currently configured gates in the simulator:

Loading gates...