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

https://new.ecofleet.co.zw/api/v1

Authentication

All API requests require authentication using OAuth 2.0 Bearer tokens.

Authorization: Bearer {your_api_token}

Getting Started

  1. Register an application in your account settings
  2. Generate an API key and secret
  3. Use the authentication endpoint to obtain a bearer token
  4. Include the token in all API requests

API Endpoints

Comprehensive list of available API endpoints.

Authentication

POST /api/v1/auth/login

Authenticate user and receive access token

POST /api/v1/auth/refresh

Refresh access token

POST /api/v1/auth/logout

Revoke the current access token

Devices

GET /api/v1/devices

List all devices

GET /api/v1/devices/{id}

Get a specific device

POST /api/v1/devices

Create a new device

PUT /api/v1/devices/{id}

Update a device

DELETE /api/v1/devices/{id}

Delete a device

Assets

GET /api/v1/assets

List all assets

GET /api/v1/assets/{id}

Get a specific asset

POST /api/v1/assets

Create a new asset

PUT /api/v1/assets/{id}

Update an asset

DELETE /api/v1/assets/{id}

Delete an asset

Automations

GET /api/v1/automations

List all automations

GET /api/v1/automations/{id}

Get a specific automation

POST /api/v1/automations

Create a new automation

PUT /api/v1/automations/{id}

Update an automation

DELETE /api/v1/automations/{id}

Delete an automation

POST /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);
?>