http://localhost:8000/api/booking
All routes below are prefixed with this base URL.
Authorization: Bearer <customer_token>
Content-Type: application/json
{
"category": [
{
"categoryId": "paper",
"name": "Paper",
"estimatedWeight": 13,
"subcategories": [
{
"subCategoryId": "newspaper",
"name": "Newspaper"
}
]
}
],
"scrapImages": [
{
"imageUrl": "/upload/file/file1.jpg",
"size": 204800,
"type": "image/jpeg"
}
],
"pickupLocation": {
"doorNo": "12A",
"flat": "3rd Floor",
"area": "MG Road",
"city": "Bangalore",
"state": "Karnataka",
"pincode": "560001",
"coordinates": {
"lat": 12.9716,
"lng": 77.5946
}
},
"estimatedPrice": 195
}
{
"success": true,
"message": "Booking created successfully",
"data": {
"_id": "bookingId",
"status": "requested",
"type": "online",
"estimatedPrice": 195,
"createdAt": "timestamp"
}
}
400 At least one category is required
400 Valid pickup location is required
400 Estimated price must be a number
400 Only 3 active pickup bookings are allowed
401 Unauthorized
Authorization: Bearer <customer_token>
{
"success": true,
"bookings": [
{
"_id": "bookingId",
"status": "requested",
"estimatedPrice": 195,
"pickupLocation": {...},
"createdAt": "timestamp"
}
]
}
{
"success": true,
"bookings": [],
"message": "No active bookings found"
}
Authorization: Bearer <customer_token>
{
"success": true,
"bookings": [
{
"_id": "bookingId",
"status": "completed",
"estimatedPrice": 220,
"createdAt": "timestamp"
}
]
}
Authorization: Bearer <vendor_token>
{
"success": true,
"bookings": [
{
"_id": "bookingId",
"status": "requested",
"estimatedPrice": 195
}
]
}
Authorization: Bearer <vendor_token>
{
"success": true,
"bookings": [
{
"_id": "bookingId",
"status": "completed",
"estimatedPrice": 220
}
]
}
Authorization: Bearer <vendor_token>
Content-Type: application/json
{
"bookingId": "664f0c2f8f7b1c0012abcd12"
}
{
"success": true,
"message": "Booking accepted successfully",
"data": {
"_id": "bookingId",
"status": "accepted",
"vendorAssignment": {
"vendorId": {
"_id": "vendorId",
"email": "vendor@gmail.com",
"phone": "9999999999",
"ownername": "Rahul",
"businessname": "ABC Scrap"
},
"assignedAt": "timestamp"
}
}
}
400 bookingId is required
400 Invalid bookingId
400 Booking already accepted by another vendor
404 No active subscription found
401 Unauthorized
Authorization: Bearer <vendor_token>
Content-Type: application/json
{
"bookingId": "664f0c2f8f7b1c0012abcd12",
"employeeId": "664f0d5e8f7b1c0012abcd45"
}
{
"success": true,
"message": "Booking assigned to employee successfully",
"data": {
"_id": "bookingId",
"status": "accepted",
"vendorAssignment": {
"vendorId": {
"_id": "vendorId",
"email": "vendor@gmail.com",
"phone": "9999999999",
"ownername": "Rahul",
"businessname": "ABC Scrap"
}
},
"employeeAssignment": {
"employeeId": {
"_id": "employeeId",
"emp_id": "EMP001",
"fullname": "Aman Kumar",
"email": "employee@gmail.com",
"phone": "8888888888"
},
"assignedAt": "timestamp"
}
}
}
400 bookingId and employeeId are required
400 Invalid bookingId or employeeId
400 Vendor has not accepted this booking yet
404 Booking not found
404 Employee not found
401 Unauthorized
Authorization: Bearer <employee_token>
Content-Type: application/json
{
"bookingId": "664f0c2f8f7b1c0012abcd12",
"status": "completed"
}
onTheWay
arrived
completed
cancelled
{
"success": true,
"data": {
"_id": "bookingId",
"status": "completed"
}
}
400 All fields are required
400 Pickup not found
401 Unauthorized
Authorization: Bearer <vendor_token>
bookingId = MongoDB booking _id
GET /booking-detail/664f0c2f8f7b1c0012abcd12
{
"success": true,
"data": {
"_id": "bookingId",
"customerId": {
"_id": "customerId",
"fullname": "Rahul Kumar",
"phone": "9999999999",
"profileImg": "/uploads/profile.jpg"
},
"category": [
{
"categoryId": "paper",
"name": "Paper",
"estimatedWeight": 13
}
],
"pickupLocation": {
"doorNo": "12A",
"area": "MG Road",
"city": "Bangalore",
"state": "Karnataka",
"pincode": "560001"
},
"estimatedPrice": 195,
"status": "requested",
"createdAt": "timestamp"
}
}
400 Invalid bookingId
404 Booking not found
401 Unauthorized