Dokumentasi ini dibuat berdasarkan panggilan API yang benar-benar ada di kode frontend/src.
Method: GET Endpoint: /api/auth/me Headers:
{
"Authorization": "Bearer {token}"
}Request Body:
nullResponse Body:
{
"data": {
"id": 1,
"email": "user@example.com",
"fullName": "User Name",
"roles": ["customer", "staff"]
}
}Method: POST Endpoint: /api/auth/login Headers:
{
"Content-Type": "application/json"
}Request Body:
{
"email": "user@example.com",
"password": "secret"
}Response Body:
{
"data": {
"accessToken": "jwt-token"
}
}Method: POST Endpoint: /api/auth/register Headers:
{
"Content-Type": "application/json"
}Request Body:
{
"email": "user@example.com",
"password": "secret",
"fullName": "User Name"
}Response Body:
{
"accessToken": "jwt-token"
}Method: POST Endpoint: http://localhost:8080/api/auth/register Headers:
{
"Content-Type": "application/json"
}Request Body:
{
"fullName": "User Name",
"email": "user@example.com",
"password": "secret"
}Response Body:
{
"accessToken": "jwt-token"
}Method: GET Endpoint: /api/dashboard/stats Headers:
{
"Authorization": "Bearer {token}"
}Request Body:
nullResponse Body:
{
"totalCars": 12,
"availableCars": 8,
"activeRentals": 5,
"monthlyRevenue": 12500.5,
"pendingRequests": 3
}Method: GET Endpoint: /api/rentals/recent Headers:
{
"Authorization": "Bearer {token}"
}Request Body:
nullResponse Body:
[
{
"id": 1,
"customer_id": "cust-1",
"car_id": "car-1",
"pickup_branch_id": "branch-1",
"return_branch_id": "branch-2",
"start_date": "2026-07-01",
"end_date": "2026-07-05",
"actual_return_date": null,
"status": "active",
"price_per_day": 120,
"total_price": 480,
"notes": null,
"approved_by": "staff-1",
"approved_at": "2026-06-30T10:00:00Z",
"rejection_reason": null,
"created_at": "2026-06-25T08:00:00Z",
"updated_at": "2026-06-30T10:00:00Z",
"car": {
"id": "car-1",
"brand": "Toyota",
"model": "Avanza",
"year": 2022,
"plate_number": "B1234XYZ",
"price_per_day": 120,
"status": "active",
"category_id": "cat-1",
"branch_id": "branch-1",
"image_url": null,
"description": null,
"seats": 7,
"transmission": "Automatic",
"fuel_type": "Petrol",
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-06-01T00:00:00Z"
},
"customer": {
"id": "cust-1",
"email": "user@example.com",
"full_name": "User Name",
"phone": null,
"address": null,
"driver_license": null,
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-01-01T00:00:00Z"
}
}
]Method: GET Endpoint: /api/rentals/my/recent Headers:
{
"Authorization": "Bearer {token}"
}Request Body:
nullResponse Body:
[
{
"id": 2,
"customer_id": "cust-1",
"car_id": "car-2",
"pickup_branch_id": "branch-1",
"return_branch_id": "branch-1",
"start_date": "2026-07-10",
"end_date": "2026-07-12",
"actual_return_date": null,
"status": "requested",
"price_per_day": 150,
"total_price": null,
"notes": "Need baby seat",
"approved_by": null,
"approved_at": null,
"rejection_reason": null,
"created_at": "2026-07-01T08:00:00Z",
"updated_at": "2026-07-01T08:00:00Z",
"car": {
"id": "car-2",
"brand": "Honda",
"model": "Mobilio",
"year": 2021,
"plate_number": "B5678XYZ",
"price_per_day": 150,
"status": "available",
"category_id": "cat-1",
"branch_id": "branch-1",
"image_url": null,
"description": null,
"seats": 7,
"transmission": "Manual",
"fuel_type": "Petrol",
"created_at": "2026-01-02T00:00:00Z",
"updated_at": "2026-06-02T00:00:00Z"
}
}
]Method: GET Endpoint: /api/customer/getAllCustomers Headers:
{
"Authorization": "Bearer {token}"
}Request Body:
nullResponse Body:
{
"data": [
{
"id": 1,
"fullName": "Customer Name",
"email": "customer@example.com",
"phone": "081234567890",
"createdAt": "2026-06-01T00:00:00Z"
}
]
}Method: GET Endpoint: /api/user/getAllUsers Headers:
{
"Authorization": "Bearer {token}"
}Request Body:
nullResponse Body:
[
{
"id": 1,
"user": "user@example.com",
"roles": ["admin", "staff"],
"joined": "2026-01-01T00:00:00Z"
}
]Method: GET Endpoint: /api/car-categories Headers:
{
"Authorization": "Bearer {token}"
}Request Body:
nullResponse Body:
[
{
"id": "cat-1",
"name": "Economy",
"description": "Budget cars",
"created_at": "2026-01-01T00:00:00Z"
}
]Method: GET Endpoint: /api/cars Headers:
{
"Authorization": "Bearer {token}"
}Query Parameters:
pagecategorystatusmin_pricemax_price
Request Body:
nullResponse Body:
[
{
"id": "car-1",
"brand": "Toyota",
"model": "Avanza",
"year": 2022,
"plate_number": "B1234XYZ",
"price_per_day": 120,
"status": "available",
"category_id": "cat-1",
"branch_id": "branch-1",
"image_url": null,
"description": null,
"seats": 7,
"transmission": "Automatic",
"fuel_type": "Petrol",
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-06-01T00:00:00Z"
}
]Method: GET Endpoint: /api/branches Headers:
{
"Authorization": "Bearer {token}"
}Request Body:
nullResponse Body:
[
{
"id": "branch-1",
"name": "Central Branch",
"address": "Jl. Example 1",
"phone": "081234567890",
"is_active": true,
"created_at": "2026-01-01T00:00:00Z",
"updated_at": "2026-06-01T00:00:00Z"
}
]Method: POST Endpoint: /api/branches Headers:
{
"Content-Type": "application/json",
"Authorization": "Bearer {token}"
}Request Body:
{
"name": "New Branch",
"address": "Jl. New",
"phone": "081234567891"
}Response Body:
{
"success": true
}Method: PATCH Endpoint: /api/branches/{id} Headers:
{
"Content-Type": "application/json",
"Authorization": "Bearer {token}"
}Request Body:
{
"id": "branch-1",
"name": "Central Branch Updated",
"address": "Jl. Example 1A",
"phone": "081234567892"
}Response Body:
{
"success": true
}Method: DELETE Endpoint: /api/branches/{id} Headers:
{
"Authorization": "Bearer {token}"
}Request Body:
nullResponse Body:
{
"success": true
}Method: GET Endpoint: /api/reports/dashboard Headers:
{
"Authorization": "Bearer {token}"
}Request Body:
nullResponse Body:
{
"total_revenue": 15000.5,
"total_rentals": 42,
"completed_rate": 0.85,
"status_distribution": {
"requested": 5,
"approved": 10,
"active": 7,
"completed": 18,
"cancelled": 2,
"rejected": 0
}
}Method: GET Endpoint: /api/reports/revenue Headers:
{
"Authorization": "Bearer {token}"
}Query Parameters:
period=monthly
Request Body:
nullResponse Body:
[
{
"month": "Jan",
"revenue": 4500.0
},
{
"month": "Feb",
"revenue": 5200.0
}
]Method: GET Endpoint: /api/reports/rentals Headers:
{
"Authorization": "Bearer {token}"
}Query Parameters:
status=completed
Request Body:
nullResponse Body:
{
"requested": 5,
"approved": 10,
"active": 7,
"completed": 18,
"cancelled": 2,
"rejected": 0
}Method: GET Endpoint: /api/rentals/my Headers:
{
"Authorization": "Bearer {token}"
}Request Body:
nullResponse Body:
[
{
"id": 3,
"customer_id": "cust-1",
"car_id": "car-3",
"pickup_branch_id": "branch-1",
"return_branch_id": "branch-1",
"start_date": "2026-08-01",
"end_date": "2026-08-05",
"actual_return_date": null,
"status": "requested",
"price_per_day": 100,
"total_price": null,
"notes": null,
"approved_by": null,
"approved_at": null,
"rejection_reason": null,
"created_at": "2026-07-20T00:00:00Z",
"updated_at": "2026-07-20T00:00:00Z",
"car": {
"id": "car-3",
"brand": "Suzuki",
"model": "Ertiga",
"year": 2021,
"plate_number": "B9101XYZ",
"price_per_day": 100,
"status": "available",
"category_id": "cat-1",
"branch_id": "branch-1",
"image_url": null,
"description": null,
"seats": 7,
"transmission": "Automatic",
"fuel_type": "Petrol",
"created_at": "2026-01-03T00:00:00Z",
"updated_at": "2026-06-03T00:00:00Z"
}
}
]Method: GET Endpoint: /api/rentals/requests Headers:
{
"Authorization": "Bearer {token}"
}Request Body:
nullResponse Body:
[
{
"id": 4,
"customer_id": "cust-2",
"car_id": "car-4",
"pickup_branch_id": "branch-1",
"return_branch_id": "branch-1",
"start_date": "2026-08-10",
"end_date": "2026-08-12",
"actual_return_date": null,
"status": "requested",
"price_per_day": 130,
"total_price": null,
"notes": "Need GPS",
"approved_by": null,
"approved_at": null,
"rejection_reason": null,
"created_at": "2026-07-22T00:00:00Z",
"updated_at": "2026-07-22T00:00:00Z"
}
]Method: GET Endpoint: /api/rentals Headers:
{
"Authorization": "Bearer {token}"
}Query Parameters:
statusstartend
Request Body:
nullResponse Body:
[
{
"id": 5,
"customer_id": "cust-3",
"car_id": "car-5",
"pickup_branch_id": "branch-2",
"return_branch_id": "branch-2",
"start_date": "2026-08-15",
"end_date": "2026-08-20",
"actual_return_date": "2026-08-20",
"status": "completed",
"price_per_day": 180,
"total_price": 900,
"notes": null,
"approved_by": "staff-2",
"approved_at": "2026-08-10T08:00:00Z",
"rejection_reason": null,
"created_at": "2026-07-25T00:00:00Z",
"updated_at": "2026-08-20T00:00:00Z"
}
]Method: POST Endpoint: /api/users/{id}/roles Headers:
{
"Content-Type": "application/json",
"Authorization": "Bearer {token}"
}Request Body:
{
"role": "staff"
}Response Body:
{
"success": true
}Method: DELETE Endpoint: /api/users/{id}/roles/{role} Headers:
{
"Authorization": "Bearer {token}"
}Request Body:
nullResponse Body:
{
"success": true
}