FleetWorkAPI Docs

API Reference

Tham chiếu đầy đủ tất cả endpoints của hệ thống GPS Tracking dành cho đối tác tích hợp.


Base URLs

GroupBase URL
GPS Trackinghttps://live.fleetwork.vn/api/v1/gps-tracking
Dashboardhttps://live.fleetwork.vn/api/v1/dashboard/gps-manager
Báo cáohttps://live.fleetwork.vn/api/v1/reports

Authentication

Tất cả endpoints xác thực qua request header:

X-API-Key: <your_api_key>

Sai hoặc thiếu key → 401 Unauthorized:

{
  "error": "UNAUTHORIZED",
  "message": "Missing or invalid X-API-Key",
  "code": 401
}

Luồng xác thực Dashboard API

Các endpoint thuộc nhóm Dashboard đi qua Fleetwork.Web gateway:

Client
  → X-API-Key → Fleetwork.Web (live.fleetwork.vn)
      → tự inject X-Account-Id + X-Internal-Token
      → YARP proxy → AnalyticsApi (internal)

Client chỉ cần gửi X-API-Key. Không cần và không nên gửi X-Account-Id hay X-Internal-Token từ phía client.

Quy ước thời gian

Tất cả query params và field liên quan thời gian trong tài liệu này dùng Unix timestamp (milliseconds), bao gồm:

  • timestamp
  • date
  • from
  • to
  • startTime
  • endTime
  • generatedAt
  • lastSeenAt

Quy ước áp dụng:

  • với dữ liệu theo ngày, date là timestamp mốc đầu ngày theo timezone hệ thống
  • với khoảng thời gian lọc, fromto là timestamp Unix ms
  • các field hiển thị như formatted vẫn là chuỗi để phục vụ UI

Mục lục

PHẦN 1 — GPS TRACKING

PHẦN 2 — DASHBOARD

PHẦN 3 — BÁO CÁO


PHẦN 1 — GPS TRACKING

1.1 POST /gps-tracking

Gửi một tọa độ GPS duy nhất từ một thiết bị.

POST https://live.fleetwork.vn/api/v1/gps-tracking
Content-Type: application/json
X-API-Key: <key>

Request Body

FieldRequiredTypeMô tả
latYesDoubleVĩ độ (-90 đến 90).
lngYesDoubleKinh độ (-180 đến 180).
timeNoLongUnix timestamp (ms) lúc ghi nhận vị trí.
speedNoFloatVận tốc (km/h).
headingNoIntegerHướng di chuyển (0–360°).
metaDataNoObjectThông tin bổ sung của thiết bị/app.
dataNoStringBase64. Đặt null cho tracking thông thường.
vehicleIdNo*StringID xe.
userIdNo*StringID nhân viên.
deviceIdNo*StringID thiết bị.

Bắt buộc: phải có ít nhất 1 trong 3: vehicleId, userId, deviceId.

Quy tắc tính statusCode tự động:

speed > 0               → statusCode = 1  (Moving)
speed = 0               → statusCode = 2  (Stopping)
không có GPS > 15 phút  → statusCode = 0  (LostGps)

Ví dụ Request

{
  "lat": 21.0285,
  "lng": 105.8542,
  "time": 1713235100000,
  "speed": 45.2,
  "heading": 90,
  "metaData": { "appVersion": "1.2.0", "battery": 82 },
  "data": null,
  "userId": "user-001",
  "vehicleId": "vehicle-abc"
}

Response 200 OK

{}

Response body trả về rỗng. Không có id, address, createdAt trong response push GPS.


1.2 POST /gps-tracking/bulk

Gửi nhiều tọa độ cùng lúc — dùng khi thiết bị vừa mất mạng và cần đẩy lại dữ liệu.

POST https://live.fleetwork.vn/api/v1/gps-tracking/bulk
Content-Type: application/json
X-API-Key: <key>

Request Body: Array các object, mỗi object cùng cấu trúc WaypointMSG với 1.1.

[
  {
    "lat": 21.0285,
    "lng": 105.8542,
    "time": 1713235000000,
    "speed": 40.0,
    "userId": "user-001"
  },
  {
    "lat": 21.029,
    "lng": 105.855,
    "time": 1713235060000,
    "speed": 45.2,
    "userId": "user-001"
  },
  {
    "lat": 21.0295,
    "lng": 105.856,
    "time": 1713235120000,
    "speed": 50.0,
    "userId": "user-001"
  }
]

1.3 GET /gps-tracking/users

Lấy danh sách tất cả user có GPS kèm lastLocation của từng user.

GET https://live.fleetwork.vn/api/v1/gps-tracking/users
    ?PageNumber=1&PageSize=20
X-API-Key: <key>

Query Parameters

ParameterTypeRequiredDefaultMô tả
StatusIntNo1 (moving) / 2 (stopping) / 0 (signal_lost).
UpdatedFromInt64NoLọc user cập nhật từ mốc này (Unix ms).
UpdatedToInt64NoLọc user cập nhật đến mốc này (Unix ms).
PageNumberInt32No1Trang hiện tại.
PageSizeInt32No20Số bản ghi / trang.
SortDescendingBooleanNotruetrue = mới nhất lên đầu.

Response 200 OK

{
  "users": [
    {
      "userId": "user-001",
      "deviceId": "device-xyz",
      "vehicleId": "vehicle-abc",
      "statusCode": 1,
      "status": "moving",
      "lastLocation": {
        "lat": 21.0285,
        "lng": 105.8542,
        "time": 1713235100000,
        "speed": 45.2,
        "heading": 90,
        "userId": "user-001",
        "vehicleId": "vehicle-abc",
        "deviceId": "device-xyz",
        "data": null,
        "metadata": {}
      }
    }
  ],
  "totalCount": 10,
  "page": 1,
  "pageSize": 20,
  "totalPages": 1
}
FieldTypeMô tả
statusCodeInteger0 = LostGps, 1 = Moving, 2 = Stopping.
statusStringNhãn trạng thái (moving, stopping, signal_lost).
lastLocation.timeLongUnix ms lúc ghi nhận vị trí cuối.
lastLocation.metadataObjectThông tin bổ sung từ thiết bị/app.

1.4 GET /latest/users/{userId}

Lấy vị trí mới nhất của một nhân viên theo ID.

GET https://live.fleetwork.vn/api/v1/gps-tracking/latest/users/{userId}
X-API-Key: <key>

Response: 200 OK — WaypointMSG của user (xem bảng field bên dưới).


1.5 GET /latest/vehicles/{vehicleId}

Lấy vị trí mới nhất của một xe theo ID.

GET https://live.fleetwork.vn/api/v1/gps-tracking/latest/vehicles/{vehicleId}
X-API-Key: <key>

Response: 200 OK hoặc 404 Not Found tuỳ dữ liệu.


1.6 GET /latest/devices/{deviceId}

Lấy vị trí mới nhất của một thiết bị theo ID.

GET https://live.fleetwork.vn/api/v1/gps-tracking/latest/devices/{deviceId}
X-API-Key: <key>

Response: Luôn 200 OK kể cả device không tồn tại (DeterministicGuid cache key).


Response WaypointMSG (1.4 / 1.5 / 1.6)

FieldTypeMô tả
latDoubleVĩ độ.
lngDoubleKinh độ.
timeLongThời điểm ghi nhận (Unix ms).
speedFloatVận tốc (km/h).
headingIntegerHướng di chuyển (0–360).
userIdStringID nhân viên (nếu có).
vehicleIdStringID xe (nếu có).
deviceIdStringID thiết bị (nếu có).
dataStringBase64 dữ liệu thêm (hoặc null).
metadataObjectThông tin bổ sung từ thiết bị.

Các field id, address, altitude, accuracy, createdAt không còn trong response.


1.7 GET /gps-tracking/history

Truy vấn lịch sử tọa độ GPS trong một khoảng thời gian. Kết quả phân trang.

GET https://live.fleetwork.vn/api/v1/gps-tracking/history
    ?UserId=user-001
    &FromTime=1713225600000
    &ToTime=1713311999000
    &PageNumber=1
    &PageSize=100
    &SortDescending=false
X-API-Key: <key>

Query Parameters

ParameterTypeRequiredDefaultMô tả
DeviceIdStringNoLọc theo ID thiết bị.
VehicleIdStringNoLọc theo ID xe.
UserIdStringNoLọc theo ID nhân viên.
FromTimeInt64NoThời gian bắt đầu (Unix ms).
ToTimeInt64NoThời gian kết thúc (Unix ms).
StatusIntNo1 (moving) / 2 (stopping).
PageNumberInt32No1Trang hiện tại.
PageSizeInt32No100Số bản ghi / trang.
SortDescendingBooleanNotruetrue = mới nhất lên đầu.

Response 200 OK

{
  "trackingData": [
    {
      "lat": 21.0285,
      "lng": 105.8542,
      "time": 1713225600000,
      "speed": 40.0,
      "heading": 90,
      "userId": "user-001",
      "vehicleId": "vehicle-abc",
      "deviceId": "device-xyz",
      "statusCode": 1,
      "data": null,
      "metadata": {}
    }
  ],
  "totalCount": 240,
  "page": 1,
  "pageSize": 100,
  "totalPages": 3,
  "hasNextPage": true,
  "hasPreviousPage": false
}
FieldTypeMô tả
trackingData[].timeLongUnix ms lúc ghi nhận vị trí (thay timestamp).
trackingData[].statusCodeInteger0 = LostGps, 1 = Moving, 2 = Stopping (int).

Các field altitude, accuracy, address, createdAt không còn trong response.


PHẦN 2 — DASHBOARD

Base path: https://live.fleetwork.vn/api/v1/dashboard/gps-manager

VùngEndpointMô tả
4 KPI CardsGET /summaryActive nhân viên, km, thời gian, chi phí nhiên liệu
Bảng usersGET /usersPer-user: km, thời gian, nhiên liệu, trạng thái
HeatmapGET /activity-heatmapDay × Hour grid
Biểu đồ nhiên liệuGET /fuel-trackingkm vs lít theo ngày/tuần/tháng
Chi phí thángGET /monthly-costsStacked bar: nhiên liệu, bảo dưỡng, bảo hiểm
All-in-OneGET /Tất cả trong 1 request

2.1 GET /summary — KPI Overview

GET https://live.fleetwork.vn/api/v1/dashboard/gps-manager/summary?date=1713225600000
X-API-Key: <key>

Query Parameters

ParameterTypeRequiredDefaultMô tả
dateInt64NoĐầu ngày hiện tại (Unix ms)Mốc ngày cần lấy KPI.

Response 200 OK

{
  "date": 1713225600000,
  "activeEmployees": { "active": 4, "total": 25 },
  "totalDistance": { "value": 936.9, "unit": "km" },
  "totalTravelTime": { "totalSeconds": 111000, "formatted": "30 giờ 50 phút" },
  "totalFuelCost": {
    "value": 900000,
    "currency": "VND",
    "formatted": "900,000 VND"
  },
  "generatedAt": 1713235200000
}
FieldTypeMô tả
dateInt64Timestamp đầu ngày đang tổng hợp (Unix ms).
activeEmployees.activeIntegerSố nhân viên có GPS point trong 5 phút gần nhất.
activeEmployees.totalIntegerTổng nhân viên trong account.
totalDistance.valueDoubleTổng km đi trong ngày.
totalTravelTime.formattedStringVí dụ: "30 giờ 50 phút".
totalFuelCost.formattedStringVí dụ: "900,000 VND".

2.2 GET /users

GET https://live.fleetwork.vn/api/v1/dashboard/gps-manager/users
  ?date=1713225600000&page=1&pageSize=20
X-API-Key: <key>

Query Parameters

ParameterTypeRequiredDefaultMô tả
dateInt64NoĐầu ngày hiện tại (Unix ms)Mốc ngày cần thống kê.
statusStringNoallmoving / stopped / signal_lost.
pageIntNo1Trang.
pageSizeIntNo20Bản ghi / trang.

Response 200 OK

{
  "date": 1713225600000,
  "summary": { "total": 7, "moving": 4, "stopped": 2, "signalLost": 1 },
  "users": [
    {
      "userId": "user-001",
      "distance": { "value": 165.0, "unit": "km" },
      "travelTime": { "totalSeconds": 30600, "formatted": "8h 30m" },
      "fuel": {
        "consumedLiters": 11.6,
        "costVnd": 266000,
        "costFormatted": "266,000 VND",
        "efficiencyKmPerL": 14.2
      },
      "statusCode": 1,
      "status": "moving",
      "lastLocation": {
        "lat": 21.0285,
        "lng": 105.8542,
        "speed": 45.2,
        "time": 1713235100000
      },
      "lastSeenAt": 1713235100000
    }
  ],
  "pagination": { "page": 1, "pageSize": 20, "totalItems": 7, "totalPages": 1 }
}

Trạng thái user:

statusCodestatusĐiều kiện
1movingspeed > 0lastSeenAt < 15 phút
2stoppingspeed = 0lastSeenAt < 15 phút
0signal_lost(now - lastSeenAt) > 15 phút

2.3 GET /activity-heatmap

GET https://live.fleetwork.vn/api/v1/dashboard/gps-manager/activity-heatmap
  ?from=1712793600000&to=1713484799000&metric=distance
X-API-Key: <key>

Query Parameters

ParameterTypeRequiredDefaultMô tả
fromInt64No14 ngày trước (Unix ms)Thời gian bắt đầu khoảng lọc.
toInt64NoHiện tại / cuối ngày (Unix ms)Thời gian kết thúc khoảng lọc.
metricStringNodistancedistance (km) / points (số GPS points).
userIdStringNoLọc nhân viên cụ thể.

Response 200 OK

{
  "from": 1712793600000,
  "to": 1713484799000,
  "metric": "distance",
  "cells": [
    {
      "dayOfWeek": "Thu",
      "date": 1713312000000,
      "hour": 16,
      "value": 60.0,
      "label": "60 km"
    }
  ],
  "maxValue": 124.5,
  "minValue": 0.0,
  "totalCells": 168
}
FieldTypeMô tả
fromInt64Timestamp bắt đầu range (Unix ms).
toInt64Timestamp kết thúc range (Unix ms).
cells[].dayOfWeekStringTên ngày trong tuần (Mon, Tue, ..., Sun).
cells[].dateInt64Timestamp đầu ngày của ô heatmap (Unix ms).
cells[].hourIntegerGiờ trong ngày (0–23).
cells[].valueDoubleGiá trị km hoặc số GPS points.
cells[].labelStringNhãn hiển thị, ví dụ: "60 km".
maxValueDoubleGiá trị lớn nhất (dùng tính màu gradient).
totalCellsIntegerTổng số ô (số ngày × 24).

2.4 GET /fuel-tracking

GET https://live.fleetwork.vn/api/v1/dashboard/gps-manager/fuel-tracking
    ?from=1704067200000&to=1735689599000&groupBy=week
X-API-Key: <key>

Query Parameters

ParameterTypeRequiredDefaultMô tả
fromInt64NoĐầu kỳ hiện tại (Unix ms)Thời gian bắt đầu khoảng phân tích.
toInt64NoCuối kỳ hiện tại (Unix ms)Thời gian kết thúc khoảng phân tích.
groupByStringNoweekday / week / month.
userIdStringNoLọc nhân viên.

Response 200 OK

{
  "from": 1704067200000,
  "to": 1735689599000,
  "groupBy": "week",
  "fuelEfficiency": { "value": 16.8, "unit": "km/L", "trend": "improving" },
  "series": [
    {
      "period": "2026-W01",
      "label": "T1/W1",
      "distanceKm": 820.5,
      "fuelLiters": 48.8,
      "efficiencyKmPerL": 16.8
    }
  ],
  "totals": {
    "totalDistanceKm": 18420.0,
    "totalFuelLiters": 1096.4,
    "avgEfficiencyKmPerL": 16.8
  }
}
FieldMô tả
fromTimestamp bắt đầu khoảng dữ liệu (Unix ms).
toTimestamp kết thúc khoảng dữ liệu (Unix ms).
fuelEfficiency.trendimproving / declining / stable.
series[].period"2026-W01" (tuần), "2026-01" (tháng), "2026-04-01" (ngày).

2.5 GET /monthly-costs

GET https://live.fleetwork.vn/api/v1/dashboard/gps-manager/monthly-costs
    ?from=1704067200000&to=1735689599000&currency=VND
X-API-Key: <key>

Query Parameters

ParameterTypeRequiredDefaultMô tả
fromInt64NoĐầu năm hiện tại (Unix ms)Thời gian bắt đầu khoảng tổng hợp.
toInt64NoCuối năm hiện tại (Unix ms)Thời gian kết thúc khoảng tổng hợp.
currencyStringNoVNDĐơn vị tiền tệ trả về.

Response 200 OK

{
  "from": 1704067200000,
  "to": 1735689599000,
  "currency": "VND",
  "months": [
    {
      "month": 3,
      "label": "Mar",
      "costs": {
        "fuel": 1200000,
        "maintenance": 7000000,
        "insurance": 3000000,
        "other": 1000000,
        "total": 12200000
      }
    }
  ],
  "totals": {
    "fuel": 14400000,
    "maintenance": 28000000,
    "insurance": 12000000,
    "other": 4000000,
    "grandTotal": 58400000
  },
  "categories": [
    { "key": "fuel", "label": "Nhiên liệu", "color": "#4F8EF7" },
    { "key": "maintenance", "label": "Bảo dưỡng", "color": "#F7C24F" },
    { "key": "insurance", "label": "Bảo hiểm", "color": "#4FF79B" },
    { "key": "other", "label": "Khác", "color": "#F74F4F" }
  ]
}
FieldTypeMô tả
fromInt64Timestamp bắt đầu khoảng tổng hợp (Unix ms).
toInt64Timestamp kết thúc khoảng tổng hợp (Unix ms).
months[].monthIntTháng trong năm (1..12).
months[].labelStringNhãn hiển thị tháng.
months[].costs.totalLongTổng chi phí của tháng.
totals.grandTotalLongTổng chi phí toàn bộ khoảng from..to.

2.6 GET / — All-in-One

Load toàn bộ Dashboard trong 1 request.

GET https://live.fleetwork.vn/api/v1/dashboard/gps-manager?date=1713225600000
X-API-Key: <key>
{
  "summary": { "...": "response của 2.1" },
  "users": {
    "summary": { "total": 7, "moving": 4, "stopped": 2, "signalLost": 1 },
    "topUsers": []
  },
  "heatmap": { "...": "response của 2.3, 14 ngày gần nhất" },
  "fuelTracking": { "...": "response của 2.4, groupBy=week" },
  "monthlyCosts": { "...": "response của 2.5" }
}

PHẦN 3 — BÁO CÁO

Base path: https://live.fleetwork.vn/api/v1/reports

Tất cả báo cáo hỗ trợ xuất file — thêm ?format=excel hoặc ?format=csv.


3.1 GET /reports/trip/summary

Báo cáo hành trình tổng hợp theo nhân viên.

GET https://live.fleetwork.vn/api/v1/reports/trip/summary
  ?from=1711929600000&to=1712793599000&page=1&pageSize=20
X-API-Key: <key>

Query Parameters

ParameterTypeRequiredDefaultMô tả
fromInt64YesThời gian bắt đầu (Unix ms).
toInt64YesThời gian kết thúc (Unix ms).
userIdStringNoLọc nhân viên.
groupIdUUIDNoLọc nhóm.
pageIntNo1Trang.
pageSizeIntNo20 (max 200)Bản ghi / trang.
sortByStringNototalDistancetotalDistance / travelTime / maxSpeed / name.
sortDescBooleanNotrueGiảm dần.
formatStringNoexcel / csv.

Response 200 OK

{
  "reportType": "trip_summary",
  "from": 1711929600000,
  "to": 1712793599000,
  "employees": [
    {
      "userId": "user-001",
      "name": "Nguyễn Văn A",
      "groupName": "Đội A",
      "totalDistanceKm": 1245.8,
      "travelTime": { "totalSeconds": 152100, "formatted": "42 giờ 30 phút" },
      "stopTime": { "totalSeconds": 29700, "formatted": "8 giờ 15 phút" },
      "maxSpeedKmh": 95.0,
      "minSpeedKmh": 15.0,
      "tripDays": 10
    }
  ],
  "pagination": { "page": 1, "pageSize": 20, "totalItems": 4, "totalPages": 1 },
  "generatedAt": 1713235200000
}

3.2 GET /reports/trip/detail

1 hàng = 1 nhân viên × 1 ngày.

GET https://live.fleetwork.vn/api/v1/reports/trip/detail
  ?from=1711929600000&to=1712793599000&page=1&pageSize=50
X-API-Key: <key>

Query parameters tương tự 3.1 (pageSize max 500).

Response 200 OK

{
  "reportType": "trip_detail",
  "trips": [
    {
      "date": 1712707200000,
      "userId": "user-001",
      "name": "Nguyễn Văn A",
      "startTime": 1712734200000,
      "endTime": 1712771100000,
      "distanceKm": 156.8,
      "travelTime": { "totalSeconds": 30600, "formatted": "8 giờ 30 phút" },
      "stopTime": { "totalSeconds": 6300, "formatted": "1 giờ 45 phút" },
      "maxSpeedKmh": 95.0,
      "minSpeedKmh": 15.0,
      "startLocation": {
        "lat": 21.0285,
        "lng": 105.8542,
        "address": "Hà Nội, Hoàn Kiếm"
      },
      "endLocation": {
        "lat": 21.035,
        "lng": 105.8,
        "address": "Hà Nội, Cầu Giấy"
      }
    }
  ],
  "pagination": {
    "page": 1,
    "pageSize": 50,
    "totalItems": 38,
    "totalPages": 1
  },
  "generatedAt": 1713235200000
}

FieldTypeMô tả
trips[].dateInt64Timestamp đầu ngày của bản ghi (Unix ms).
trips[].startTimeInt64Timestamp bắt đầu hành trình (Unix ms).
trips[].endTimeInt64Timestamp kết thúc hành trình (Unix ms).

3.3 GET /reports/fuel/summary

GET https://live.fleetwork.vn/api/v1/reports/fuel/summary
    ?from=1711929600000&to=1712793599000&page=1&pageSize=20
X-API-Key: <key>

Query Parameters

ParameterTypeRequiredDefaultMô tả
fromInt64YesThời gian bắt đầu (Unix ms).
toInt64YesThời gian kết thúc (Unix ms).
userIdStringNoLọc nhân viên.
groupIdUUIDNoLọc nhóm.
pageIntNo1Trang.
pageSizeIntNo20 (max 200)Bản ghi / trang.
sortByStringNodistanceKmdistanceKm / fuelStandardLiters / totalCostVnd / name.
sortDescBooleanNotrueGiảm dần.
formatStringNoexcel / csv.

Response 200 OK

{
  "reportType": "fuel_summary",
  "fuelConfig": { "efficiencyLper100km": 7.0, "pricePerLiterVnd": 23000 },
  "employees": [
    {
      "userId": "user-001",
      "name": "Nguyễn Văn A",
      "groupName": "Đội A",
      "distanceKm": 1245.8,
      "travelTime": { "totalSeconds": 152100, "formatted": "42 giờ 30 phút" },
      "fuelStandardLiters": 87.2,
      "totalCostVnd": 2005600,
      "totalCostFormatted": "2.005.600 VNĐ"
    }
  ],
  "totals": {
    "distanceKm": 4446.2,
    "fuelStandardLiters": 311.2,
    "totalCostVnd": 7157600,
    "totalCostFormatted": "7.157.600 VNĐ"
  },
  "pagination": { "page": 1, "pageSize": 20, "totalItems": 4, "totalPages": 1 },
  "generatedAt": 1713235200000
}

Định mức = distanceKm × efficiencyLper100km / 100 | Chi phí = fuelStandardLiters × pricePerLiterVnd


3.4 GET /reports/fuel/detail

1 hàng = 1 nhân viên × 1 ngày.

GET https://live.fleetwork.vn/api/v1/reports/fuel/detail
  ?from=1711929600000&to=1712793599000&page=1&pageSize=50
X-API-Key: <key>

Query Parameters

ParameterTypeRequiredDefaultMô tả
fromInt64YesThời gian bắt đầu (Unix ms).
toInt64YesThời gian kết thúc (Unix ms).
userIdStringNoLọc nhân viên.
groupIdUUIDNoLọc nhóm.
pageIntNo1Trang.
pageSizeIntNo50 (max 500)Bản ghi / trang.
sortByStringNodatedate / distanceKm / fuelStandardLiters / totalCostVnd.
sortDescBooleanNotrueGiảm dần.
formatStringNoexcel / csv.

Response 200 OK

{
  "reportType": "fuel_detail",
  "trips": [
    {
      "date": 1712707200000,
      "userId": "user-001",
      "name": "Nguyễn Văn A",
      "startTime": 1712734200000,
      "endTime": 1712771100000,
      "distanceKm": 156.8,
      "travelTime": { "totalSeconds": 30600, "formatted": "8 giờ 30 phút" },
      "fuelStandardLiters": 11.0,
      "fuelPricePerLiterVnd": 23000,
      "totalCostVnd": 253000,
      "totalCostFormatted": "253.000 VNĐ"
    }
  ],
  "totals": {
    "distanceKm": 746.5,
    "fuelStandardLiters": 52.3,
    "totalCostVnd": 1202900,
    "totalCostFormatted": "1.202.900 VNĐ"
  },
  "pagination": {
    "page": 1,
    "pageSize": 50,
    "totalItems": 38,
    "totalPages": 1
  },
  "generatedAt": 1713235200000
}
FieldTypeMô tả
trips[].dateInt64Timestamp đầu ngày của bản ghi (Unix ms).
trips[].startTimeInt64Timestamp bắt đầu hành trình (Unix ms).
trips[].endTimeInt64Timestamp kết thúc hành trình (Unix ms).

3.5 GET /reports/activity-time

Mỗi hàng = 1 ngày × 1 giờ, thống kê toàn đội.

GET https://live.fleetwork.vn/api/v1/reports/activity-time
  ?from=1711929600000&to=1712793599000
X-API-Key: <key>

Query Parameters

ParameterTypeRequiredDefault
fromInt64Yes
toInt64Yes
pageIntNo1
pageSizeIntNo50 (max 500)
formatStringNoexcel / csv

Response 200 OK

{
  "reportType": "activity_time",
  "totalEmployees": 20,
  "rows": [
    {
      "date": 1712707200000,
      "hour": 7,
      "activeEmployeeCount": 3,
      "inactiveEmployeeCount": 17,
      "totalDistanceKm": 45.2
    },
    {
      "date": 1712707200000,
      "hour": 8,
      "activeEmployeeCount": 8,
      "inactiveEmployeeCount": 12,
      "totalDistanceKm": 112.8
    }
  ],
  "totals": { "totalDistanceKm": 2461.1 },
  "pagination": {
    "page": 1,
    "pageSize": 50,
    "totalItems": 18,
    "totalPages": 1
  },
  "generatedAt": 1713235200000
}
FieldTypeMô tả
rows[].dateInt64Timestamp đầu ngày của dòng thống kê (Unix ms).
rows[].hourInt32Giờ trong ngày, từ 0 đến 23.

Error Responses

StatusMô tả
400 Bad RequestTham số không hợp lệ.
401 UnauthorizedAPI key thiếu hoặc sai.
403 ForbiddenKhông có quyền truy cập resource.
404 Not FoundResource không tồn tại.
429 Too Many RequestsVượt giới hạn rate limit.
500 Internal Server ErrorLỗi hệ thống — liên hệ Fleetwork support.
{ "error": "BAD_REQUEST", "message": "...", "code": 400 }

On this page