Skip to main content
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

summary
object
upcomingMandatory
object[]
Up to 10 mandatory maintenance records ordered by next due date (soonest first), each including the associated vehicle and maintenance type.

Errors

StatusDescription
401Missing or invalid JWT.
403Authenticated user does not have the admin role.
500Internal server error.
curl --request GET \
  --url https://your-api.example.com/api/admin/dashboard \
  --header 'Authorization: Bearer <token>'

List fleets


GET /api/admin/fleets Returns all fleets ordered by creation date (newest first), each including its associated vehicles and admin user.

Response

fleets
object[]

Errors

StatusDescription
401Missing or invalid JWT.
403Authenticated user does not have the admin role.
500Internal server error.
curl --request GET \
  --url https://your-api.example.com/api/admin/fleets \
  --header 'Authorization: Bearer <token>'

Create fleet


POST /api/admin/fleets Creates a new fleet. If adminId is omitted, the authenticated admin’s ID is used.

Request body

name
string
required
Fleet name.
description
string
Optional description of the fleet.
adminId
number
ID of the admin user to assign as fleet owner. Defaults to the authenticated user’s ID.

Response

Returns 201 Created with the created fleet object.
fleet
object

Errors

StatusDescription
400Validation failed — name is missing or invalid.
401Missing or invalid JWT.
403Authenticated user does not have the admin role.
500Internal server error.
curl --request POST \
  --url https://your-api.example.com/api/admin/fleets \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "Northern Region",
    "description": "Vehicles assigned to northern operations"
  }'

Get fleet


GET /api/admin/fleets/:id Returns a single fleet by ID, including its vehicles and admin user.

Path parameters

id
number
required
The fleet ID.

Response

fleet
object
Fleet object with the same shape as described in List fleets.

Errors

StatusDescription
401Missing or invalid JWT.
403Authenticated user does not have the admin role.
404Fleet not found.
500Internal server error.

Update fleet


PUT /api/admin/fleets/:id Updates an existing fleet’s properties.

Path parameters

id
number
required
The fleet ID.

Request body

name
string
required
Fleet name.
description
string
Fleet description.
adminId
number
ID of the admin user to assign as fleet owner.

Response

Returns 200 OK with the updated fleet object.
fleet
object
Updated fleet object.

Errors

StatusDescription
400Validation failed.
401Missing or invalid JWT.
403Authenticated user does not have the admin role.
404Fleet not found.
500Internal server error.

Delete fleet


DELETE /api/admin/fleets/:id Permanently deletes a fleet.

Path parameters

id
number
required
The fleet ID.

Response

Returns 204 No Content on success with an empty body.

Errors

StatusDescription
401Missing or invalid JWT.
403Authenticated user does not have the admin role.
404Fleet not found.
500Internal server error.
curl --request DELETE \
  --url https://your-api.example.com/api/admin/fleets/1 \
  --header 'Authorization: Bearer <token>'

Build docs developers (and LLMs) love