API Documentation

Complete guide to integrating with ZktecoApi

Base URL: https://portal.zktecoapi.com/api/v1

GET

Get Attendance Data

Retrieve attendance records for a specific date range.

Endpoint
GET /attendance
Query Parameters
Parameter Type Required Description
api_key string Yes String
start string Yes Start date (YYYY-MM-DD HH:ii:ss)
end string Yes End date (YYYY-MM-DD HH:ii:ss)
Sample Request
[GET] https://portal.zktecoapi.com/api/v1/attendance?api_key=YOUR_API_KEY&start=2025-12-12 00:00:00&end=2025-12-12 23:59:59
Response (Success - 200)
{ "errors": null, "data": [ { "device_id": BAY00001111, "user_id": "1", "device_timestamp": "John Doe" }, { "device_id": BAY00001111, "user_id": "2", "device_timestamp": "Peter Snow" } ], "message": "Data retrive successful", "version": "2.0.0", "timestamp": 1764259080 }

Errors

Response (Error - 400)
{ "message": "Invalid Api Key", "errors": [], "data": null, "version": "2.0.0", "timestamp": 1764259080 }
Message
Invalid Api Key
Subscription expired
No active device found

Integration Examples

cURL Example
curl -X GET "https://portal.zktecoapi.com/api/v1/attendance?api_key=YOUR_API_KEY&start=2025-01-01 00:00:00&end=2025-01-31 23:59:59" \ -H "Content-Type: application/json"
JavaScript Example
fetch('https://portal.zktecoapi.com/api/v1/attendance?api_key=YOUR_API_KEY&start=2025-01-01 00:00:00&end=2025-01-31 23:59:59', { method: 'GET', headers: { 'Content-Type': 'application/json' } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));
Python Example
import requests url = "https://portal.zktecoapi.com/api/v1/attendance" headers = { "Content-Type": "application/json" } params = { "api_key": "YOUR_API_KEY", "start": "2025-01-01 00:00:00", "end": "2025-01-31 23:59:59" } response = requests.get(url, headers=headers, params=params) data = response.json() print(data)
PHP Example
$url = "https://portal.zktecoapi.com/api/v1/attendance?api_key=YOUR_API_KEY&start=2025-01-01 00:00:00&end=2025-01-31 23:59:59"; $headers = [ "Content-Type: application/json" ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true); print_r($data);