Skip to main content
All assignment endpoints are protected. Requests must include a valid JWT and the authenticated user must have the admin role.

Business rules

Only one active assignment is permitted per vehicle and per technician at a time. Attempting to create a second active assignment for either party returns 409 Conflict.
  • A vehicle may not have more than one active assignment simultaneously.
  • A technician may not have more than one active assignment simultaneously.
  • Use the return endpoint to mark an assignment as returned before creating a new one.

List assignments


GET /api/admin/assignments Returns all assignments ordered by assigned date (newest first), each including the assigned vehicle and technician.

Query parameters

status
string
Filter by assignment status. One of active or returned. If omitted, all assignments are returned.

Response

assignments
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/assignments \
  --header 'Authorization: Bearer <token>'

Create assignment


POST /api/admin/assignments Assigns a vehicle to a technician. Both must be free of any existing active assignment.

Request body

vehicleId
number
required
ID of the vehicle to assign.
technicianId
number
required
ID of the technician to assign.

Response

Returns 201 Created with the new assignment object.
assignment
object

Errors

StatusDescription
400Validation failed — vehicleId or technicianId missing.
401Missing or invalid JWT.
403Authenticated user does not have the admin role.
409The vehicle or technician already has an active assignment.
500Internal server error.
curl --request POST \
  --url https://your-api.example.com/api/admin/assignments \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "vehicleId": 42,
    "technicianId": 5
  }'

Return assignment


PATCH /api/admin/assignments/:id/return Marks an assignment as returned, releasing both the vehicle and technician for new assignments.

Path parameters

id
number
required
The assignment ID.

Response

Returns 200 OK with the updated assignment object.
assignment
object
Updated assignment with status set to returned.

Errors

StatusDescription
401Missing or invalid JWT.
403Authenticated user does not have the admin role.
404Assignment not found.
409Assignment is already returned.
500Internal server error.
curl --request PATCH \
  --url https://your-api.example.com/api/admin/assignments/7/return \
  --header 'Authorization: Bearer <token>'

Build docs developers (and LLMs) love