API
the Wakilni offers an API to help create and manage orders from third-party applications.
Developers can use this API to integrate Wakilni into their custom applications.
Below are steps required, along with detailed documentation on the API.
Testing environment
For Testing use the data below instead of the data in the Production Environment section
URL -> https://api-dev.wakilni.com
Setup
You need to register as a new client in https://dev.wakilni.com/sign-up and complete the integration as followed in the documentation.
Production environment
If everything went right, please find the Production data (use data below instead of the data in the Testing Environment section)
URL -> https://api.wakilni.com
JORDAN URL -> https://jordan-api.wakilni.com
Integration with Wakilni steps:
Each client will be able to generate an access token that is attached to your account to be used in the API.
Login to customer back office
Go to Settings
Open tab “Api Tokens”
Click “Link to your custom app”
Enter your shop name/label.
Click create
A key/secret combination will be created for this client.
Copy these credentials and pass them to the request of the auth api.
A token will be generated, which you can pas as a bearer token in the other apis.
Order flow
Bulk process is divided into 2 flows: pickup bulk and delivery bulk
Pickup bulk: driver pickups the product from the vendor
Delivery bulk: driver delivers the product to the recipient
Shipping price: Wakilni has default delivery prices based on pickup/delivery locations. Also, each customer can have his own customized prices.
Api process:
Start bulk: creates pickup bulk order (multiple bulks can be created)
Add delivery: creates delivery order related to pickup bulk (multiple deliveries can be created)
End bulk: orders become active and are sent to portal for shipping
Show order status: shows order status based on the flow update Status/ Status Code:
PENDING = 1
CONFIRMED = 2
DECLINED = 6
CANCELED = 7
PROCESSING = 3
SUCCESS = 4
FAILED = 5
CLOSED_FAILED = 8
POSTPONED = 9
PENDING_CANCELLATION = 10
SUCCESS, REJECTED = 4
When the order is delivered but the client rejected it
Authentication
API: https://api.wakilni.com/api/v2/third_party/auth_token
Method: GET
Body:
key: App keysecret: App secret
Response
Start bulk
API: https://api.wakilni.com/api/v2/clients/start_bulk
Method: POST
Header: Authorization: Bearer {token}
Body:
location_id: customer’s location id reference from your applongitude: customer’s location’s longitudelatitude: customer’s location’s latitudefloor: customer’s location’s floorarea: it is preferable to send us the area name from the list provided from get area’s list
Response
Add delivery
API: https://api.wakilni.com/api/v2/clients/add_delivery/{bulk_id}
Method: POST
Header: Authorization: Bearer {token}
Body:
get_order_details: Set to true if you want to display order details after creating orderget_barcode: Set to true if you want the barcode label returnedwaybill: To reference or identify your orderreceiver_id: The recipient’s unique reference id from your app or systemFor example: your recipient's id in your system is 123, then
"receiver_id" : 123
receiver_first_name: Recipient’s first namereceiver_last_name: Recipient’s last namereceiver_phone_number: Recipient’s phone numberreceiver_gender: Recipient’s gender (1 -> male, 2 -> female)receiver_email: Recipient’s emailreceiver_secondary_phone_number: Recipient’s secondary phone numberreceiver_location_id *: The recipient’s location's unique reference id from your app or systemFor example, your recipients shipping address location id is 123, then
"receiver_location_id" : 123
receiver_longitude: Customer’s location’s longitudereceiver_latitude: Customer’s location’s latitudereceiver_building: Customer’s location’s buildingreceiver_floor: Customer’s location’s floorreceiver_directions: Customer’s location’s directionsreceiver_area: It is preferable to send us the area name from the list provided from get area’s listcurrency: 1 -> USD, 2 -> LBPcash_collection_type_id: (paid: 54, on delivery: 52)type_id: (paper: 57, regular box: 58, small box: 59, large box: 60, very large box: 61)is_express: Whentrue, creates an Express order and prices accordingly. Omitting it (orfalse) defaults to a standard Bulk order.
Response:
packages: Array of barcode objects generated for this order's packages. Each object has abarcode_package_number. The array is empty if no barcode records exist yet, and is always present (nevernull). Barcodes are auto-generated when packages are created.
Note: for use of barcode label to display barcode image, add the blob value to the image src as follows:
End bulk
API: https://api.wakilni.com/api/v2/clients/end_bulk/{bulk_id}
Method: POST
Header: Authorization: Bearer {token}
Response:
Update order
API: https://api.wakilni.com/api/v2/clients/orders/{id}
Method: PUT
Header: Authorization: Bearer {token}
Description: Updates a pending delivery order. Uses PATCH semantics — only fields present in the body whose value differs from the stored value are changed; any omitted field is left unchanged.
Note: Only orders with status Pending (1) can be updated. Updating a non-pending order returns a 422.
Body (all fields optional — send only the fields you want to change):
Field reference:
waybill(max 100): Your internal reference / waybill number.car_needed: Whether a car (van) is needed for delivery.try_on: Whether the receiver can try on the item before accepting.exchange: Whether the order involves an exchange.is_express: Toggle express.trueon a standard bulk order switches it to Express Single and reprices;falseon an express order reverts it to Bulk and reprices.currency: Collection currency ID —1 = USD,2 = LBP.cash_collection_type_id:54 = Paid,52 = On Delivery. Switching to Paid (54) automatically resetscollection_amountto 0.collection_amount(≥ 0): Amount to collect from the receiver. If the collection type is Paid, the effective amount is always 0 regardless of what is sent.note(max 5000): Order note / instructions. Also stored as a public comment on the order.require_signature: Whether a signature must be collected on delivery.require_picture: Whether a picture must be taken on delivery.self_pickup: Whether the receiver will pick up from a Wakilni office. Settingtruerequiresself_pickup_details.office_id. Settingfalseremoves the self-pickup record and reprices.self_pickup_details.office_id: Required whenself_pickup = true. The ID of the Wakilni pickup office.new_receiver_location: Controls whether location changes apply to all orders sharing the same location, or to this order only.false(default) updates the existing location record in place — all ongoing orders sharing it see the change.trueclones the location into a new record assigned only to this order; the original is untouched. Only applies when location fields are changed (receiver_building,receiver_floor,receiver_directions,receiver_longitude,receiver_latitude,receiver_area). Recipient fields (name, phone, etc.) are always updated in place regardless of this flag.receiver_first_name/receiver_last_name: Receiver's name.receiver_phone_number/receiver_secondary_phone_number: Receiver's phone numbers.receiver_gender:1 = Male,2 = Female.receiver_email: Receiver's email.receiver_building/receiver_floor/receiver_directions: Receiver's location details.receiver_longitude/receiver_latitude: Receiver's location coordinates.receiver_area: Receiver's area name (e.g. "Hazmieh").packages: Replace-all — if present, all existing packages are deleted and replaced with exactly the list sent. To keep existing packages you must re-send them. Each element requiresquantity; other sub-fields are optional.packages.*.quantity(≥ 1): Required whenpackagesis present.packages.*.type_id:57 = Paper,58 = Regular Box,59 = Small Box,60 = Large Box,61 = Very Large Box. Defaults to 58 if omitted.packages.*.name(max 255): Package description / item name.packages.*.sku(max 255): Package SKU.
Price recalculation: The delivery price is automatically recalculated and applied to the order's price field when is_express changes.
Response:
packages: Current barcode objects for the order's packages after the update.
Error responses:
404— Order not found or does not belong to this customer → "Order not found."422— Order is not in Pending status → "Cannot update a non-pending order."422—self_pickup = truesent withoutoffice_id→ "The office id is required when self pickup is true."422—is_express = truebutClientCanExpressfeature flag disabled → "You cannot update this order to express, you can contact the operator."422— Validation failure (e.g. invalid currency ID) → field-level validation messages.
Example — update collection details & receiver area
Request:
Response:
Example — replace packages
Request:
Response:
Show order status
API: https://api.wakilni.com/api/v2/clients/orders/{id}
Method: POST
Header: Authorization: Bearer {token}
Response:
Show order status from tracking id
API: https://api.wakilni.com/api/v2/clients/tracking/orders/{tracking_id}
Method: POST
Header: Authorization: Bearer {token}
Response:
Cancel order
API: https://api.wakilni.com/api/v2/clients/orders/{id}/cancel
Method: PUT
Header: Authorization: Bearer {token}
Body:
reason: Reason for canceling the order
Response:
Note: You are able to cancel an order only if the status is pending
Get areas
API: https://api.wakilni.com/api/v2/areas
Method: GET
Header: Authorization: Bearer {token}
Pagination: https://api.wakilni.com/api/v2/areas?with_pagination=true&page=2
Filter: https://api.wakilni.com/api/v2/areas?search=name:beirut&searchJoin=and&with_filter=true
Pagination and Filter: https://api.wakilni.com/api/v2/areas?search=name:beirut&searchJoin=and&with_filter=true&with_pagination=true&page =2
Get order status
API: https://api.wakilni.com/api/v2/clients/orders/status?tracking_id={tracking_id}&order_id={order_id}
Note: You may use either the tracking_id or the order_id based on your preference
Method: GET
Header: Authorization: Bearer {token}
Response:
Example response:
Last updated