Skip to main content
GET
/
devices
/
{device_id}
/
ping
Ping Device
curl --request GET \
  --url https://api.example.com/devices/{device_id}/ping
{
  "success": true,
  "message": "<string>",
  "device_time": "<string>",
  "ip": "<string>",
  "error": "<string>"
}
Verifies connectivity to a registered ZKTeco device by establishing a connection and retrieving the device’s current time. This is useful for troubleshooting network connectivity and validating device configuration.

Path Parameters

device_id
string
required
The unique identifier of the device to pingExample: "principal" or "bodega"

Response

success
boolean
required
Indicates whether the connection test was successful
message
string
Status message (present on success)
device_time
string
Current time reported by the device (present on success)
ip
string
required
IP address of the device that was tested
error
string
Error message describing the connection failure (present on error)

Example Request

curl -X GET https://your-server.com/devices/principal/ping

Example Response

Success (200)

{
  "success": true,
  "message": "Conexion exitosa con 'principal'.",
  "device_time": "2026-03-06 15:30:45",
  "ip": "192.168.1.205"
}

Error: Connection Failed (503)

{
  "success": false,
  "error": "[Errno 111] Connection refused",
  "ip": "192.168.1.205"
}

Error: Timeout (503)

{
  "success": false,
  "error": "timeout: timed out",
  "ip": "192.168.1.207"
}

Error: Device Not Found (404)

{
  "success": false,
  "error": "Dispositivo 'nonexistent' no encontrado.",
  "disponibles": ["principal", "bodega"]
}

Error Codes

Status CodeDescription
200Connection successful
404Device with the specified ID does not exist
503Service unavailable (device unreachable or connection failed)

Common Connection Errors

Error MessageCauseSolution
Connection refusedDevice is offline or wrong portVerify device power and network; check port configuration
timed outNetwork issue or incorrect IPCheck network connectivity; verify IP address
No route to hostNetwork routing problemCheck network configuration and firewall rules
Invalid passwordWrong communication passwordUpdate device configuration with correct password

What This Endpoint Tests

  1. Network connectivity to the device IP
  2. TCP connection on the configured port
  3. Protocol compatibility with the ZK library
  4. Authentication using the stored password
  5. Basic device responsiveness by retrieving the current time

Use Cases

  • Initial setup: Verify device configuration after registration
  • Troubleshooting: Diagnose connectivity issues
  • Health monitoring: Periodic checks to ensure devices are online
  • Pre-operation validation: Test connection before performing bulk operations

Notes

  • The connection is automatically closed after the test
  • This endpoint uses a thread lock to prevent concurrent operations on the same device
  • The device’s clock is read but not modified
  • Minimal performance impact on the device (single command operation)

Build docs developers (and LLMs) love