Civilian API
Manage characters, vehicles, licenses, 911 calls, banking, missing persons, and stolen vehicles.
Authorization: Bearer <token> header unless otherwise noted. FiveM endpoints use the x-api-key header instead.
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.
Create a new civilian character. A bank account with a $5,000 balance is automatically created.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
firstName | string | Yes | Character's first name |
lastName | string | Yes | Character's last name |
dateOfBirth | string | Yes | Date of birth (e.g. "1990-05-15") |
communityId | string | Yes | ID of the community this civilian belongs to |
middleName | string | No | Character's middle name |
gender | string | No | One of: male, female, other |
race | string | No | Character's race/ethnicity |
hairColor | string | No | One of: black, brown, blonde, red, gray, white, bald |
eyeColor | string | No | One of: brown, blue, green, hazel, gray, amber |
height | string | No | Character's height (e.g. "5'11\"") |
weight | string | No | Character's weight (e.g. "180 lbs") |
address | string | No | Residential address |
phone | string | No | Phone number |
occupation | string | No | Current occupation |
bloodType | string | No | One of: A+, A-, B+, B-, AB+, AB-, O+, O- |
allergies | string | No | Known allergies |
medications | string | No | Current medications |
mugshotUrl | string | No | URL to mugshot/photo image |
nationality | string | No | Nationality |
placeOfBirth | string | No | Place of birth |
ssn | string | No | Social 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"
}
Retrieve all civilians belonging to the authenticated user. Optionally filter by community.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
communityId | string | No | Filter 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"
}
]
Retrieve a single civilian by ID. The civilian must belong to the authenticated user.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The 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"
}
Update a civilian's editable fields. Protected fields (firstName, lastName, dateOfBirth, ssn) cannot be modified.
firstName, lastName, dateOfBirth, and ssn cannot be changed after creation. Any values sent for these fields will be ignored.
Editable Fields
| Field | Type | Description |
|---|---|---|
occupation | string | Current occupation |
height | string | Character's height |
weight | string | Character's weight |
eyeColor | string | One of: brown, blue, green, hazel, gray, amber |
hairColor | string | One of: black, brown, blonde, red, gray, white, bald |
address | string | Residential address |
phone | string | Phone number |
emergencyContact | string | Emergency contact name |
emergencyContactPhone | string | Emergency contact phone number |
bloodType | string | One of: A+, A-, B+, B-, AB+, AB-, O+, O- |
allergies | string | Known allergies |
medications | string | Current medications |
nationality | string | Nationality |
placeOfBirth | string | Place of birth |
mugshotUrl | string | URL 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 a civilian and all associated vehicles. This action is permanent and cannot be undone.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The 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"
}
Retrieve all civilians in a community. Restricted to users with admin or LEO roles.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
communityId | string | The 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.
Retrieve all vehicles registered to a specific civilian.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The 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"
}
]
Register a new vehicle to a civilian.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The civilian's unique ID |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
plate | string | Yes | License plate number (unique per community) |
make | string | Yes | Vehicle manufacturer (e.g. "Toyota") |
model | string | Yes | Vehicle model (e.g. "Camry") |
year | number | Yes | Model year (e.g. 2022) |
color | string | No | Vehicle 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"
}
Mark a vehicle as stolen or recovered. Stolen vehicles appear in LEO stolen vehicle lookups.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
vehicleId | string | The vehicle's unique ID |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
stolen | boolean | Yes | true to mark stolen, false to mark recovered |
communityId | string | Yes | The community ID |
stolenDescription | string | No | Description of circumstances |
stolenDate | string | No | Date 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.).
Civilian applies for a license. The license is created with a "Valid" status and a 1-year expiration date.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The civilian's unique ID |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
licenseType | string | Yes | One 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"
}
]
}
Admin or LEO updates a civilian's license status. Use this to suspend, revoke, or reinstate licenses.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The civilian's unique ID |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
licenseType | string | Yes | One of: drivers, firearms, cdl, hunting, fishing, offroad, boating, pilot |
status | string | Yes | One 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.
Place a 911 call as an authenticated civilian. The call appears on the dispatch board in real time via WebSocket.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
callType | string | Yes | Type/description of the emergency (e.g. "Robbery in progress") |
location | string | Yes | Location of the emergency (e.g. "Vinewood Blvd & Alta St") |
callerName | string | Yes | Name of the caller |
communityId | string | Yes | The 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"
}
Place a 911 call from a FiveM server. Authenticated via the community's FiveM API key instead of a JWT token.
Headers
| Header | Description |
|---|---|
x-api-key | The community's FiveM API key (e.g. fvm_xxxxx) |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
callType | string | Yes | Type/description of the emergency |
location | string | Yes | Location of the emergency |
callerName | string | Yes | Name of the caller |
communityId | string | Yes | The 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.
Mark a civilian as a missing person or mark them as found.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The civilian's unique ID |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
missingPerson | boolean | Yes | true to mark as missing, false to mark as found |
missingDate | string | No | Date the person went missing (e.g. "2025-02-01") |
lastSeenLocation | string | No | Last known location |
description | string | No | Additional 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"
}
Retrieve all stolen vehicles in a community. Restricted to LEO-role users.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
communityId | string | The 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"
}
}
]
Retrieve all missing persons in a community. Restricted to LEO-role users.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
communityId | string | The 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
Search endpoints allow querying civilians and vehicles across a community. Results are capped at 10 items per request.
Search for civilians by name. Query must be at least 2 characters. Returns a maximum of 10 results.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search term (minimum 2 characters). Matches against first and last name. |
communityId | string | Yes | The 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"
}
]
Search for vehicles by plate number, model, or color. Returns a maximum of 10 results.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search term. Matches against plate, model, and color. |
communityId | string | Yes | The 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.
Get a civilian's bank account. If no account exists, one is automatically created with a $5,000 balance.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
civilianId | string | The civilian's unique ID |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
communityId | string | Yes | The 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"
}
Deposit funds into a civilian's bank account.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
civilianId | string | Yes | The civilian's unique ID |
amount | number | Yes | Amount to deposit (must be positive) |
description | string | Yes | Description of the deposit (e.g. "Paycheck") |
communityId | string | Yes | The 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"
}
}
Withdraw funds from a civilian's bank account. The account must have sufficient balance.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
civilianId | string | Yes | The civilian's unique ID |
amount | number | Yes | Amount to withdraw (must be positive, cannot exceed balance) |
description | string | Yes | Description of the withdrawal (e.g. "Rent payment") |
communityId | string | Yes | The 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"
}
Transfer funds between two civilians' bank accounts. The sender must have sufficient balance.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
fromCivilianId | string | Yes | Sender civilian's unique ID |
toCivilianId | string | Yes | Recipient civilian's unique ID |
amount | number | Yes | Amount to transfer (must be positive, cannot exceed sender's balance) |
description | string | Yes | Description 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"
}
}
Retrieve transaction history for a civilian's bank account. Supports pagination.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
civilianId | string | The civilian's unique ID |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
communityId | string | Yes | The community ID |
page | number | No | Page number (defaults to 1) |
limit | number | No | Results 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
}