All endpoints on this page are protected. Requests must include a valid JWT and the authenticated user must have the
admin role.Dashboard summary
GET /api/admin/dashboard
Returns a high-level summary of the entire fleet operation, plus a list of upcoming mandatory maintenance items.
Response
Up to 10 mandatory maintenance records ordered by next due date (soonest first), each including the associated vehicle and maintenance type.
Errors
| Status | Description |
|---|---|
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
500 | Internal server error. |
List fleets
GET /api/admin/fleets
Returns all fleets ordered by creation date (newest first), each including its associated vehicles and admin user.
Response
Errors
| Status | Description |
|---|---|
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
500 | Internal server error. |
Create fleet
POST /api/admin/fleets
Creates a new fleet. If adminId is omitted, the authenticated admin’s ID is used.
Request body
Fleet name.
Optional description of the fleet.
ID of the admin user to assign as fleet owner. Defaults to the authenticated user’s ID.
Response
Returns201 Created with the created fleet object.
Errors
| Status | Description |
|---|---|
400 | Validation failed — name is missing or invalid. |
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
500 | Internal server error. |
Get fleet
GET /api/admin/fleets/:id
Returns a single fleet by ID, including its vehicles and admin user.
Path parameters
The fleet ID.
Response
Fleet object with the same shape as described in List fleets.
Errors
| Status | Description |
|---|---|
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
404 | Fleet not found. |
500 | Internal server error. |
Update fleet
PUT /api/admin/fleets/:id
Updates an existing fleet’s properties.
Path parameters
The fleet ID.
Request body
Fleet name.
Fleet description.
ID of the admin user to assign as fleet owner.
Response
Returns200 OK with the updated fleet object.
Updated fleet object.
Errors
| Status | Description |
|---|---|
400 | Validation failed. |
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
404 | Fleet not found. |
500 | Internal server error. |
Delete fleet
DELETE /api/admin/fleets/:id
Permanently deletes a fleet.
Path parameters
The fleet ID.
Response
Returns204 No Content on success with an empty body.
Errors
| Status | Description |
|---|---|
401 | Missing or invalid JWT. |
403 | Authenticated user does not have the admin role. |
404 | Fleet not found. |
500 | Internal server error. |