1. Delivery - Orders
3enab
🚚 Delivery Application
  • 👤 User Application
  • 🏪 Vendor Application
  • 👨‍💼 Admin Application
  • 🚚 Delivery Application
  • Auth - Delivery
    • Register a new delivery driver
      POST
    • Login delivery driver
      POST
    • Logout delivery driver
      POST
    • Refresh access token
      POST
    • Send phone OTP
      POST
    • Verify phone OTP
      POST
    • Send password reset OTP
      POST
    • Verify password reset OTP
      POST
    • Reset password
      POST
  • Delivery - Orders
    • Get all orders for delivery coordinator
      GET
    • Get driver's assigned orders
      GET
    • Driver — delivered orders report (date range)
      GET
    • Get order details
      GET
    • Send assignment request to driver (Coordinator)
      POST
    • Accept assignment (Driver)
      POST
    • Reject assignment (Driver)
      POST
    • Update order status
      PATCH
    • Coordinator — driver delivered orders report (date/time range)
      GET
  • Users - Delivery
    • Get current delivery user profile
      GET
    • Update current delivery user profile
      PUT
    • Delete current delivery user account
      DELETE
    • Change password
      POST
    • Change driver status (online/offline/busy)
      PATCH
    • Get all drivers by status (Coordinator)
      GET
    • Get driver by ID (Coordinator)
      GET
    • Update driver (Coordinator)
      PUT
    • Delete driver (Coordinator)
      DELETE
    • Get all delivery coordinators
      GET
  • Versions - Delivery
    • Get the latest version for Delivery app
  • Delivery - Delivery Areas
    • Get all delivery areas (delivery app)
    • Get delivery area by ID (delivery app)
  • Orders - Delivery
    • Get active orders for a specific driver
  • Vendors - Delivery
    • List vendors (Coordinator)
  1. Delivery - Orders

Send assignment request to driver (Coordinator)

POST
/api/v1/delivery/orders/{orderId}/assign
Coordinator sends an assignment request to a specific driver.
The driver will receive a socket event and push notification to accept or reject.
Flow:
1.
Coordinator calls this endpoint with driverId
2.
Order gets pendingDriver set (replaces old pending driver if exists)
3.
New driver receives "order:assignment-request" socket event
4.
New driver receives push notification
5.
Driver can accept or reject the assignment
Reassignment:
If order already has a pending driver, the new driver replaces them
Old pending driver receives "order:assignment-cancelled" notification
First driver to accept gets the order
Requirements:
Only coordinators can assign drivers
Driver must be online (deliveryStatus = "online")
Order status must be "preparing"
Order must not already have an assigned driver (accepted)
Order must not be a pickup order
Side Effects:
Sets pendingDriver on the order (replaces old if exists)
If replacing: sends "order:assignment-cancelled" to old driver
Sends socket event "order:assignment-request" to new driver
Sends push notification to new driver

Request

Authorization
JWT Bearer
Add the parameter
Authorization
to Headers
Example:
Authorization: ********************
API Key
Add parameter in header
x-api-key
Example:
x-api-key: ********************
or
Path Params

Body Params application/jsonRequired

Example
{
    "driverId": "64f1a2b3c4d5e6f7890a1234"
}

Responses

🟢200OK
application/json
Assignment request sent to driver
Body

Example
{
    "status": "success",
    "message": "Assignment request sent to driver",
    "data": {
        "order": {
            "_id": "string",
            "orderNumber": 0,
            "user": {
                "_id": "string",
                "name": "string",
                "phone": "string"
            },
            "vendor": {
                "_id": "string",
                "name": "string",
                "phone": "string",
                "location": {}
            },
            "assignedDriver": "string",
            "pendingDriver": "string",
            "items": [
                {
                    "item": {
                        "_id": "string",
                        "name": "string",
                        "description": "string",
                        "imagePath": "string",
                        "optionName": "string",
                        "category": {
                            "_id": "string",
                            "name": "string"
                        }
                    },
                    "optionId": "string",
                    "optionValue": "string",
                    "quantity": 0,
                    "unitPrice": 0,
                    "totalPrice": 0
                }
            ],
            "address": {
                "street": "string",
                "city": "string",
                "buildingNumber": "string",
                "floor": "string",
                "apartmentNumber": "string",
                "phone": "string"
            },
            "status": "pending",
            "total": 0,
            "subtotal": 0,
            "deliveryFee": 0,
            "discount": 0,
            "paymentMethod": "string",
            "isPickup": true,
            "notes": "string",
            "rejectionReason": "string",
            "createdAt": "2019-08-24T14:15:22.123Z",
            "updatedAt": "2019-08-24T14:15:22.123Z"
        }
    }
}
🟠400Bad Request
🟠401Unauthorized
🟠404Not Found
Modified at 2026-04-08 13:50:28
Previous
Get order details
Next
Accept assignment (Driver)
Built with