Civilian API

Manage characters, vehicles, licenses, 911 calls, banking, missing persons, and stolen vehicles.

Authentication: All endpoints require a valid JWT bearer token via the Authorization: Bearer <token> header unless otherwise noted. FiveM endpoints use the x-api-key header instead.
Community Scoping: Most endpoints require a communityId parameter. All data is scoped to a community — civilians, vehicles, licenses, and banking records are isolated per community.

Characters (Civilians)

Civilians are the core identity objects in CDE CAD. Each user can create multiple civilian characters within a community. Creating a civilian automatically provisions a bank account with a starting balance of $5,000.

POST /api/civilian Auth Required

Create a new civilian character. A bank account with a $5,000 balance is automatically created.

Request Body

FieldTypeRequiredDescription
firstNamestringYesCharacter's first name
lastNamestringYesCharacter's last name
dateOfBirthstringYesDate of birth (e.g. "1990-05-15")
communityIdstringYesID of the community this civilian belongs to
middleNamestringNoCharacter's middle name
genderstringNoOne of: male, female, other
racestringNoCharacter's race/ethnicity
hairColorstringNoOne of: black, brown, blonde, red, gray, white, bald
eyeColorstringNoOne of: brown, blue, green, hazel, gray, amber
heightstringNoCharacter's height (e.g. "5'11\"")
weightstringNoCharacter's weight (e.g. "180 lbs")
addressstringNoResidential address
phonestringNoPhone number
occupationstringNoCurrent occupation
bloodTypestringNoOne of: A+, A-, B+, B-, AB+, AB-, O+, O-
allergiesstringNoKnown allergies
medicationsstringNoCurrent medications
mugshotUrlstringNoURL to mugshot/photo image
nationalitystringNoNationality
placeOfBirthstringNoPlace of birth
ssnstringNoSocial Security Number. Auto-generated if left empty.

Example Request

POST /api/civilian
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

{
  "firstName": "John",
  "lastName": "Doe",
  "dateOfBirth": "1990-05-15",
  "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
  "middleName": "Michael",
  "gender": "male",
  "race": "White",
  "hairColor": "brown",
  "eyeColor": "blue",
  "height": "5'11\"",
  "weight": "180 lbs",
  "address": "123 Main St, Los Santos",
  "phone": "555-0123",
  "occupation": "Mechanic",
  "bloodType": "O+",
  "nationality": "American",
  "placeOfBirth": "Los Santos"
}

Example Response 201 Created

{
  "_id": "65a1b2c3d4e5f6a7b8c9d0e1",
  "userId": "64e0f1a2b3c4d5e6f7a8b9c0",
  "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
  "firstName": "John",
  "middleName": "Michael",
  "lastName": "Doe",
  "dateOfBirth": "1990-05-15T00:00:00.000Z",
  "gender": "male",
  "race": "White",
  "hairColor": "brown",
  "eyeColor": "blue",
  "height": "5'11\"",
  "weight": "180 lbs",
  "address": "123 Main St, Los Santos",
  "phone": "555-0123",
  "occupation": "Mechanic",
  "bloodType": "O+",
  "nationality": "American",
  "placeOfBirth": "Los Santos",
  "ssn": "483-29-1847",
  "licenses": [],
  "vehicles": [],
  "missingPerson": false,
  "createdAt": "2025-01-15T12:00:00.000Z",
  "updatedAt": "2025-01-15T12:00:00.000Z"
}
GET /api/civilian/me Auth Required

Retrieve all civilians belonging to the authenticated user. Optionally filter by community.

Query Parameters

ParameterTypeRequiredDescription
communityIdstringNoFilter civilians to a specific community

Example Request

GET /api/civilian/me?communityId=64f1a2b3c4d5e6f7a8b9c0d1
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Example Response 200 OK

[
  {
    "_id": "65a1b2c3d4e5f6a7b8c9d0e1",
    "firstName": "John",
    "middleName": "Michael",
    "lastName": "Doe",
    "dateOfBirth": "1990-05-15T00:00:00.000Z",
    "gender": "male",
    "ssn": "483-29-1847",
    "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
    "occupation": "Mechanic",
    "address": "123 Main St, Los Santos",
    "phone": "555-0123",
    "licenses": [],
    "missingPerson": false,
    "createdAt": "2025-01-15T12:00:00.000Z"
  },
  {
    "_id": "65a1b2c3d4e5f6a7b8c9d0e2",
    "firstName": "Jane",
    "lastName": "Smith",
    "dateOfBirth": "1995-08-22T00:00:00.000Z",
    "gender": "female",
    "ssn": "712-55-3901",
    "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
    "occupation": "Lawyer",
    "address": "456 Oak Ave, Los Santos",
    "phone": "555-0456",
    "licenses": [],
    "missingPerson": false,
    "createdAt": "2025-01-16T09:30:00.000Z"
  }
]
GET /api/civilian/:id Auth Required

Retrieve a single civilian by ID. The civilian must belong to the authenticated user.

Path Parameters

ParameterTypeDescription
idstringThe civilian's unique ID

Example Request

GET /api/civilian/65a1b2c3d4e5f6a7b8c9d0e1
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Example Response 200 OK

{
  "_id": "65a1b2c3d4e5f6a7b8c9d0e1",
  "userId": "64e0f1a2b3c4d5e6f7a8b9c0",
  "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
  "firstName": "John",
  "middleName": "Michael",
  "lastName": "Doe",
  "dateOfBirth": "1990-05-15T00:00:00.000Z",
  "gender": "male",
  "race": "White",
  "hairColor": "brown",
  "eyeColor": "blue",
  "height": "5'11\"",
  "weight": "180 lbs",
  "address": "123 Main St, Los Santos",
  "phone": "555-0123",
  "occupation": "Mechanic",
  "bloodType": "O+",
  "allergies": "",
  "medications": "",
  "nationality": "American",
  "placeOfBirth": "Los Santos",
  "ssn": "483-29-1847",
  "licenses": [
    {
      "licenseType": "drivers",
      "status": "Valid",
      "expirationDate": "2026-01-15T12:00:00.000Z"
    }
  ],
  "vehicles": [
    {
      "_id": "65b2c3d4e5f6a7b8c9d0e1f2",
      "plate": "ABC1234",
      "make": "Toyota",
      "model": "Camry",
      "year": 2022,
      "color": "Silver",
      "stolen": false
    }
  ],
  "missingPerson": false,
  "mugshotUrl": "",
  "createdAt": "2025-01-15T12:00:00.000Z",
  "updatedAt": "2025-01-15T12:00:00.000Z"
}
PUT /api/civilian/:id Auth Required

Update a civilian's editable fields. Protected fields (firstName, lastName, dateOfBirth, ssn) cannot be modified.

Protected Fields: The fields firstName, lastName, dateOfBirth, and ssn cannot be changed after creation. Any values sent for these fields will be ignored.

Editable Fields

FieldTypeDescription
occupationstringCurrent occupation
heightstringCharacter's height
weightstringCharacter's weight
eyeColorstringOne of: brown, blue, green, hazel, gray, amber
hairColorstringOne of: black, brown, blonde, red, gray, white, bald
addressstringResidential address
phonestringPhone number
emergencyContactstringEmergency contact name
emergencyContactPhonestringEmergency contact phone number
bloodTypestringOne of: A+, A-, B+, B-, AB+, AB-, O+, O-
allergiesstringKnown allergies
medicationsstringCurrent medications
nationalitystringNationality
placeOfBirthstringPlace of birth
mugshotUrlstringURL to mugshot/photo image

Example Request

PUT /api/civilian/65a1b2c3d4e5f6a7b8c9d0e1
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

{
  "occupation": "Taxi Driver",
  "address": "789 Pine Rd, Los Santos",
  "phone": "555-9876",
  "emergencyContact": "Jane Doe",
  "emergencyContactPhone": "555-1111",
  "hairColor": "black",
  "weight": "185 lbs"
}

Example Response 200 OK

{
  "_id": "65a1b2c3d4e5f6a7b8c9d0e1",
  "firstName": "John",
  "middleName": "Michael",
  "lastName": "Doe",
  "dateOfBirth": "1990-05-15T00:00:00.000Z",
  "gender": "male",
  "hairColor": "black",
  "eyeColor": "blue",
  "height": "5'11\"",
  "weight": "185 lbs",
  "address": "789 Pine Rd, Los Santos",
  "phone": "555-9876",
  "occupation": "Taxi Driver",
  "emergencyContact": "Jane Doe",
  "emergencyContactPhone": "555-1111",
  "bloodType": "O+",
  "nationality": "American",
  "placeOfBirth": "Los Santos",
  "ssn": "483-29-1847",
  "updatedAt": "2025-02-01T14:30:00.000Z"
}
DELETE /api/civilian/:id Auth Required

Delete a civilian and all associated vehicles. This action is permanent and cannot be undone.

Cascading Delete: Deleting a civilian will also permanently remove all vehicles registered to that civilian.

Path Parameters

ParameterTypeDescription
idstringThe civilian's unique ID

Example Request

DELETE /api/civilian/65a1b2c3d4e5f6a7b8c9d0e1
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Example Response 200 OK

{
  "success": true,
  "msg": "Civilian and associated vehicles deleted successfully"
}
GET /api/civilian/community/:communityId Admin / LEO Only

Retrieve all civilians in a community. Restricted to users with admin or LEO roles.

Path Parameters

ParameterTypeDescription
communityIdstringThe community's unique ID

Example Request

GET /api/civilian/community/64f1a2b3c4d5e6f7a8b9c0d1
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Example Response 200 OK

[
  {
    "_id": "65a1b2c3d4e5f6a7b8c9d0e1",
    "firstName": "John",
    "lastName": "Doe",
    "dateOfBirth": "1990-05-15T00:00:00.000Z",
    "gender": "male",
    "ssn": "483-29-1847",
    "occupation": "Mechanic",
    "missingPerson": false
  },
  {
    "_id": "65a1b2c3d4e5f6a7b8c9d0e2",
    "firstName": "Jane",
    "lastName": "Smith",
    "dateOfBirth": "1995-08-22T00:00:00.000Z",
    "gender": "female",
    "ssn": "712-55-3901",
    "occupation": "Lawyer",
    "missingPerson": false
  }
]

Vehicles

Vehicles are registered to a specific civilian. Each vehicle has a unique plate number within a community and can be marked as stolen or recovered.

GET /api/civilian/:id/vehicles Auth Required

Retrieve all vehicles registered to a specific civilian.

Path Parameters

ParameterTypeDescription
idstringThe civilian's unique ID

Example Request

GET /api/civilian/65a1b2c3d4e5f6a7b8c9d0e1/vehicles
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Example Response 200 OK

[
  {
    "_id": "65b2c3d4e5f6a7b8c9d0e1f2",
    "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
    "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
    "plate": "ABC1234",
    "make": "Toyota",
    "model": "Camry",
    "year": 2022,
    "color": "Silver",
    "stolen": false,
    "createdAt": "2025-01-15T14:00:00.000Z"
  },
  {
    "_id": "65b2c3d4e5f6a7b8c9d0e1f3",
    "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
    "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
    "plate": "XYZ9876",
    "make": "Ford",
    "model": "Mustang",
    "year": 2024,
    "color": "Red",
    "stolen": false,
    "createdAt": "2025-01-20T10:15:00.000Z"
  }
]
POST /api/civilian/:id/vehicles Auth Required

Register a new vehicle to a civilian.

Path Parameters

ParameterTypeDescription
idstringThe civilian's unique ID

Request Body

FieldTypeRequiredDescription
platestringYesLicense plate number (unique per community)
makestringYesVehicle manufacturer (e.g. "Toyota")
modelstringYesVehicle model (e.g. "Camry")
yearnumberYesModel year (e.g. 2022)
colorstringNoVehicle color

Example Request

POST /api/civilian/65a1b2c3d4e5f6a7b8c9d0e1/vehicles
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

{
  "plate": "LOS4521",
  "make": "Chevrolet",
  "model": "Tahoe",
  "year": 2023,
  "color": "Black"
}

Example Response 201 Created

{
  "_id": "65c3d4e5f6a7b8c9d0e1f2a3",
  "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
  "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
  "plate": "LOS4521",
  "make": "Chevrolet",
  "model": "Tahoe",
  "year": 2023,
  "color": "Black",
  "stolen": false,
  "createdAt": "2025-02-01T08:00:00.000Z"
}
PUT /api/civilian/vehicle/:vehicleId/stolen Auth Required

Mark a vehicle as stolen or recovered. Stolen vehicles appear in LEO stolen vehicle lookups.

Path Parameters

ParameterTypeDescription
vehicleIdstringThe vehicle's unique ID

Request Body

FieldTypeRequiredDescription
stolenbooleanYestrue to mark stolen, false to mark recovered
communityIdstringYesThe community ID
stolenDescriptionstringNoDescription of circumstances
stolenDatestringNoDate the vehicle was stolen (e.g. "2025-02-10")

Example Request

PUT /api/civilian/vehicle/65c3d4e5f6a7b8c9d0e1f2a3/stolen
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

{
  "stolen": true,
  "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
  "stolenDescription": "Vehicle taken from parking lot at Del Perro Pier",
  "stolenDate": "2025-02-10"
}

Example Response 200 OK

{
  "_id": "65c3d4e5f6a7b8c9d0e1f2a3",
  "plate": "LOS4521",
  "make": "Chevrolet",
  "model": "Tahoe",
  "year": 2023,
  "color": "Black",
  "stolen": true,
  "stolenDescription": "Vehicle taken from parking lot at Del Perro Pier",
  "stolenDate": "2025-02-10T00:00:00.000Z",
  "updatedAt": "2025-02-10T16:00:00.000Z"
}

Licenses

Civilians can apply for various license types. Once applied, licenses are valid for 1 year. Administrators and LEO officers can update license statuses (suspend, revoke, etc.).

PUT /api/civilian/:id/licenses Auth Required

Civilian applies for a license. The license is created with a "Valid" status and a 1-year expiration date.

Path Parameters

ParameterTypeDescription
idstringThe civilian's unique ID

Request Body

FieldTypeRequiredDescription
licenseTypestringYesOne of: drivers, firearms, cdl, hunting, fishing, offroad, boating, pilot

Example Request

PUT /api/civilian/65a1b2c3d4e5f6a7b8c9d0e1/licenses
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

{
  "licenseType": "drivers"
}

Example Response 200 OK

{
  "_id": "65a1b2c3d4e5f6a7b8c9d0e1",
  "firstName": "John",
  "lastName": "Doe",
  "licenses": [
    {
      "licenseType": "drivers",
      "status": "Valid",
      "expirationDate": "2026-02-01T14:30:00.000Z"
    }
  ]
}
PUT /api/civilian/:id/license Admin / LEO Only

Admin or LEO updates a civilian's license status. Use this to suspend, revoke, or reinstate licenses.

Path Parameters

ParameterTypeDescription
idstringThe civilian's unique ID

Request Body

FieldTypeRequiredDescription
licenseTypestringYesOne of: drivers, firearms, cdl, hunting, fishing, offroad, boating, pilot
statusstringYesOne of: None, Valid, Suspended, Revoked, Expired

Example Request

PUT /api/civilian/65a1b2c3d4e5f6a7b8c9d0e1/license
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

{
  "licenseType": "drivers",
  "status": "Suspended"
}

Example Response 200 OK

{
  "_id": "65a1b2c3d4e5f6a7b8c9d0e1",
  "firstName": "John",
  "lastName": "Doe",
  "licenses": [
    {
      "licenseType": "drivers",
      "status": "Suspended",
      "expirationDate": "2026-02-01T14:30:00.000Z"
    }
  ]
}

911 Calls

Civilians can place 911 calls that are routed to active dispatchers. Two endpoints are available: one for authenticated web users and one for FiveM servers using API key authentication.

POST /api/civilian/911-call Auth Required

Place a 911 call as an authenticated civilian. The call appears on the dispatch board in real time via WebSocket.

Request Body

FieldTypeRequiredDescription
callTypestringYesType/description of the emergency (e.g. "Robbery in progress")
locationstringYesLocation of the emergency (e.g. "Vinewood Blvd & Alta St")
callerNamestringYesName of the caller
communityIdstringYesThe community ID

Example Request

POST /api/civilian/911-call
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

{
  "callType": "Robbery in progress",
  "location": "Vinewood Blvd & Alta St",
  "callerName": "John Doe",
  "communityId": "64f1a2b3c4d5e6f7a8b9c0d1"
}

Example Response 201 Created

{
  "_id": "65d4e5f6a7b8c9d0e1f2a3b4",
  "callType": "Robbery in progress",
  "location": "Vinewood Blvd & Alta St",
  "callerName": "John Doe",
  "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
  "status": "pending",
  "createdAt": "2025-02-15T20:30:00.000Z"
}
POST /api/civilian/fivem-911-call API Key (x-api-key)

Place a 911 call from a FiveM server. Authenticated via the community's FiveM API key instead of a JWT token.

Headers

HeaderDescription
x-api-keyThe community's FiveM API key (e.g. fvm_xxxxx)

Request Body

FieldTypeRequiredDescription
callTypestringYesType/description of the emergency
locationstringYesLocation of the emergency
callerNamestringYesName of the caller
communityIdstringYesThe community ID

Example Request

POST /api/civilian/fivem-911-call
Content-Type: application/json
x-api-key: fvm_abc123def456

{
  "callType": "Shots fired",
  "location": "Grove Street, South Los Santos",
  "callerName": "Anonymous",
  "communityId": "64f1a2b3c4d5e6f7a8b9c0d1"
}

Example Response 201 Created

{
  "_id": "65d4e5f6a7b8c9d0e1f2a3b5",
  "callType": "Shots fired",
  "location": "Grove Street, South Los Santos",
  "callerName": "Anonymous",
  "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
  "source": "fivem",
  "status": "pending",
  "createdAt": "2025-02-15T20:35:00.000Z"
}

Missing Persons & Stolen Vehicles

Civilians can be marked as missing persons, and LEO officers can query community-wide lists of missing persons and stolen vehicles.

PUT /api/civilian/:id/missing Auth Required

Mark a civilian as a missing person or mark them as found.

Path Parameters

ParameterTypeDescription
idstringThe civilian's unique ID

Request Body

FieldTypeRequiredDescription
missingPersonbooleanYestrue to mark as missing, false to mark as found
missingDatestringNoDate the person went missing (e.g. "2025-02-01")
lastSeenLocationstringNoLast known location
descriptionstringNoAdditional details about the missing person

Example Request

PUT /api/civilian/65a1b2c3d4e5f6a7b8c9d0e1/missing
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

{
  "missingPerson": true,
  "missingDate": "2025-02-01",
  "lastSeenLocation": "Sandy Shores Gas Station",
  "description": "Last seen wearing a blue jacket and jeans"
}

Example Response 200 OK

{
  "_id": "65a1b2c3d4e5f6a7b8c9d0e1",
  "firstName": "John",
  "lastName": "Doe",
  "missingPerson": true,
  "missingDate": "2025-02-01T00:00:00.000Z",
  "lastSeenLocation": "Sandy Shores Gas Station",
  "description": "Last seen wearing a blue jacket and jeans",
  "updatedAt": "2025-02-05T10:00:00.000Z"
}
GET /api/civilian/stolen-vehicles/:communityId LEO Only

Retrieve all stolen vehicles in a community. Restricted to LEO-role users.

Path Parameters

ParameterTypeDescription
communityIdstringThe community's unique ID

Example Request

GET /api/civilian/stolen-vehicles/64f1a2b3c4d5e6f7a8b9c0d1
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Example Response 200 OK

[
  {
    "_id": "65c3d4e5f6a7b8c9d0e1f2a3",
    "plate": "LOS4521",
    "make": "Chevrolet",
    "model": "Tahoe",
    "year": 2023,
    "color": "Black",
    "stolen": true,
    "stolenDescription": "Vehicle taken from parking lot at Del Perro Pier",
    "stolenDate": "2025-02-10T00:00:00.000Z",
    "civilianId": {
      "_id": "65a1b2c3d4e5f6a7b8c9d0e1",
      "firstName": "John",
      "lastName": "Doe"
    }
  },
  {
    "_id": "65c3d4e5f6a7b8c9d0e1f2a4",
    "plate": "SAF8832",
    "make": "BMW",
    "model": "M4",
    "year": 2024,
    "color": "White",
    "stolen": true,
    "stolenDescription": "Carjacked at gunpoint near Pillbox Hill",
    "stolenDate": "2025-02-12T00:00:00.000Z",
    "civilianId": {
      "_id": "65a1b2c3d4e5f6a7b8c9d0e2",
      "firstName": "Jane",
      "lastName": "Smith"
    }
  }
]
GET /api/civilian/missing-persons/:communityId LEO Only

Retrieve all missing persons in a community. Restricted to LEO-role users.

Path Parameters

ParameterTypeDescription
communityIdstringThe community's unique ID

Example Request

GET /api/civilian/missing-persons/64f1a2b3c4d5e6f7a8b9c0d1
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Example Response 200 OK

[
  {
    "_id": "65a1b2c3d4e5f6a7b8c9d0e1",
    "firstName": "John",
    "lastName": "Doe",
    "dateOfBirth": "1990-05-15T00:00:00.000Z",
    "gender": "male",
    "missingPerson": true,
    "missingDate": "2025-02-01T00:00:00.000Z",
    "lastSeenLocation": "Sandy Shores Gas Station",
    "description": "Last seen wearing a blue jacket and jeans",
    "mugshotUrl": ""
  }
]

Search endpoints allow querying civilians and vehicles across a community. Results are capped at 10 items per request.

GET /api/civilians/search Auth Required

Search for civilians by name. Query must be at least 2 characters. Returns a maximum of 10 results.

Query Parameters

ParameterTypeRequiredDescription
querystringYesSearch term (minimum 2 characters). Matches against first and last name.
communityIdstringYesThe community to search within

Example Request

GET /api/civilians/search?query=john&communityId=64f1a2b3c4d5e6f7a8b9c0d1
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Example Response 200 OK

[
  {
    "_id": "65a1b2c3d4e5f6a7b8c9d0e1",
    "firstName": "John",
    "lastName": "Doe",
    "dateOfBirth": "1990-05-15T00:00:00.000Z",
    "gender": "male",
    "ssn": "483-29-1847"
  },
  {
    "_id": "65a1b2c3d4e5f6a7b8c9d0e5",
    "firstName": "Johnny",
    "lastName": "Walker",
    "dateOfBirth": "1988-11-03T00:00:00.000Z",
    "gender": "male",
    "ssn": "291-44-8823"
  }
]
GET /api/vehicles/search Auth Required

Search for vehicles by plate number, model, or color. Returns a maximum of 10 results.

Query Parameters

ParameterTypeRequiredDescription
querystringYesSearch term. Matches against plate, model, and color.
communityIdstringYesThe community to search within

Example Request

GET /api/vehicles/search?query=ABC&communityId=64f1a2b3c4d5e6f7a8b9c0d1
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Example Response 200 OK

[
  {
    "_id": "65b2c3d4e5f6a7b8c9d0e1f2",
    "plate": "ABC1234",
    "make": "Toyota",
    "model": "Camry",
    "year": 2022,
    "color": "Silver",
    "stolen": false,
    "civilianId": {
      "_id": "65a1b2c3d4e5f6a7b8c9d0e1",
      "firstName": "John",
      "lastName": "Doe"
    }
  }
]

Banking

Each civilian has a bank account that is automatically created with a starting balance of $5,000. The banking API supports deposits, withdrawals, transfers between civilians, and transaction history.

Auto-provisioning: If a civilian's bank account does not exist when queried, one is automatically created with a $5,000 starting balance.
GET /api/banking/account/:civilianId Auth Required

Get a civilian's bank account. If no account exists, one is automatically created with a $5,000 balance.

Path Parameters

ParameterTypeDescription
civilianIdstringThe civilian's unique ID

Query Parameters

ParameterTypeRequiredDescription
communityIdstringYesThe community ID

Example Request

GET /api/banking/account/65a1b2c3d4e5f6a7b8c9d0e1?communityId=64f1a2b3c4d5e6f7a8b9c0d1
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Example Response 200 OK

{
  "_id": "65e5f6a7b8c9d0e1f2a3b4c5",
  "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
  "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
  "balance": 5000,
  "createdAt": "2025-01-15T12:00:00.000Z",
  "updatedAt": "2025-01-15T12:00:00.000Z"
}
POST /api/banking/deposit Auth Required

Deposit funds into a civilian's bank account.

Request Body

FieldTypeRequiredDescription
civilianIdstringYesThe civilian's unique ID
amountnumberYesAmount to deposit (must be positive)
descriptionstringYesDescription of the deposit (e.g. "Paycheck")
communityIdstringYesThe community ID

Example Request

POST /api/banking/deposit
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

{
  "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
  "amount": 2500,
  "description": "Weekly paycheck",
  "communityId": "64f1a2b3c4d5e6f7a8b9c0d1"
}

Example Response 200 OK

{
  "account": {
    "_id": "65e5f6a7b8c9d0e1f2a3b4c5",
    "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
    "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
    "balance": 7500
  },
  "transaction": {
    "_id": "65f6a7b8c9d0e1f2a3b4c5d6",
    "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
    "type": "deposit",
    "amount": 2500,
    "description": "Weekly paycheck",
    "balanceAfter": 7500,
    "createdAt": "2025-02-15T09:00:00.000Z"
  }
}
POST /api/banking/withdraw Auth Required

Withdraw funds from a civilian's bank account. The account must have sufficient balance.

Request Body

FieldTypeRequiredDescription
civilianIdstringYesThe civilian's unique ID
amountnumberYesAmount to withdraw (must be positive, cannot exceed balance)
descriptionstringYesDescription of the withdrawal (e.g. "Rent payment")
communityIdstringYesThe community ID

Example Request

POST /api/banking/withdraw
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

{
  "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
  "amount": 1200,
  "description": "Rent payment",
  "communityId": "64f1a2b3c4d5e6f7a8b9c0d1"
}

Example Response 200 OK

{
  "account": {
    "_id": "65e5f6a7b8c9d0e1f2a3b4c5",
    "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
    "communityId": "64f1a2b3c4d5e6f7a8b9c0d1",
    "balance": 6300
  },
  "transaction": {
    "_id": "65f6a7b8c9d0e1f2a3b4c5d7",
    "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
    "type": "withdrawal",
    "amount": 1200,
    "description": "Rent payment",
    "balanceAfter": 6300,
    "createdAt": "2025-02-15T10:00:00.000Z"
  }
}

Error Response 400 Bad Request

{
  "success": false,
  "msg": "Insufficient funds"
}
POST /api/banking/transfer Auth Required

Transfer funds between two civilians' bank accounts. The sender must have sufficient balance.

Request Body

FieldTypeRequiredDescription
fromCivilianIdstringYesSender civilian's unique ID
toCivilianIdstringYesRecipient civilian's unique ID
amountnumberYesAmount to transfer (must be positive, cannot exceed sender's balance)
descriptionstringYesDescription of the transfer

Example Request

POST /api/banking/transfer
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

{
  "fromCivilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
  "toCivilianId": "65a1b2c3d4e5f6a7b8c9d0e2",
  "amount": 500,
  "description": "Payment for vehicle repair"
}

Example Response 200 OK

{
  "fromAccount": {
    "_id": "65e5f6a7b8c9d0e1f2a3b4c5",
    "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
    "balance": 5800
  },
  "toAccount": {
    "_id": "65e5f6a7b8c9d0e1f2a3b4c6",
    "civilianId": "65a1b2c3d4e5f6a7b8c9d0e2",
    "balance": 5500
  },
  "transaction": {
    "_id": "65f6a7b8c9d0e1f2a3b4c5d8",
    "fromCivilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
    "toCivilianId": "65a1b2c3d4e5f6a7b8c9d0e2",
    "type": "transfer",
    "amount": 500,
    "description": "Payment for vehicle repair",
    "createdAt": "2025-02-15T11:00:00.000Z"
  }
}
GET /api/banking/transactions/:civilianId Auth Required

Retrieve transaction history for a civilian's bank account. Supports pagination.

Path Parameters

ParameterTypeDescription
civilianIdstringThe civilian's unique ID

Query Parameters

ParameterTypeRequiredDescription
communityIdstringYesThe community ID
pagenumberNoPage number (defaults to 1)
limitnumberNoResults per page (defaults to 20)

Example Request

GET /api/banking/transactions/65a1b2c3d4e5f6a7b8c9d0e1?communityId=64f1a2b3c4d5e6f7a8b9c0d1&page=1&limit=10
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...

Example Response 200 OK

{
  "transactions": [
    {
      "_id": "65f6a7b8c9d0e1f2a3b4c5d8",
      "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
      "type": "transfer",
      "amount": 500,
      "description": "Payment for vehicle repair",
      "balanceAfter": 5800,
      "createdAt": "2025-02-15T11:00:00.000Z"
    },
    {
      "_id": "65f6a7b8c9d0e1f2a3b4c5d7",
      "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
      "type": "withdrawal",
      "amount": 1200,
      "description": "Rent payment",
      "balanceAfter": 6300,
      "createdAt": "2025-02-15T10:00:00.000Z"
    },
    {
      "_id": "65f6a7b8c9d0e1f2a3b4c5d6",
      "civilianId": "65a1b2c3d4e5f6a7b8c9d0e1",
      "type": "deposit",
      "amount": 2500,
      "description": "Weekly paycheck",
      "balanceAfter": 7500,
      "createdAt": "2025-02-15T09:00:00.000Z"
    }
  ],
  "page": 1,
  "limit": 10,
  "totalPages": 1,
  "totalCount": 3
}