API Documentation
API Overview
The Ezytrack API provides programmatic access to device management, asset tracking, and automation features. Use this API to integrate Ezytrack with your existing systems or build custom applications.
Base URL
Authentication
All API requests require authentication using OAuth 2.0 Bearer tokens.
Getting Started
- Register an application in your account settings
- Generate an API key and secret
- Use the authentication endpoint to obtain a bearer token
- Include the token in all API requests
API Endpoints
Comprehensive list of available API endpoints.
Authentication
/api/v1/auth/login
Authenticate user and receive access token
Request Body
{
"email": "user@example.com",
"password": "your_password"
}
Response
{
"token_type": "Bearer",
"expires_in": 3600,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...",
"refresh_token": "def50200641f31a6c7e99..."
}
/api/v1/auth/refresh
Refresh access token
/api/v1/auth/logout
Revoke the current access token
Devices
/api/v1/devices
List all devices
/api/v1/devices/{id}
Get a specific device
/api/v1/devices
Create a new device
/api/v1/devices/{id}
Update a device
/api/v1/devices/{id}
Delete a device
Assets
/api/v1/assets
List all assets
/api/v1/assets/{id}
Get a specific asset
/api/v1/assets
Create a new asset
/api/v1/assets/{id}
Update an asset
/api/v1/assets/{id}
Delete an asset
Automations
/api/v1/automations
List all automations
/api/v1/automations/{id}
Get a specific automation
/api/v1/automations
Create a new automation
/api/v1/automations/{id}
Update an automation
/api/v1/automations/{id}
Delete an automation
/api/v1/automations/{id}/execute
Manually execute an automation
Code Examples
cURL
curl -X POST \
https://new.ecofleet.co.zw/api/v1/auth/login \
-H 'Content-Type: application/json' \
-d '{
"email": "user@example.com",
"password": "your_password"
}'
JavaScript
fetch('https://new.ecofleet.co.zw/api/v1/devices', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://new.ecofleet.co.zw/api/v1/devices');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer YOUR_ACCESS_TOKEN',
'Content-Type: application/json'
));
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
print_r($data);
?>