Partner API
Partner Integration Documentation
Create delivery orders, manage contacts, calculate prices, and track shipments through the Tawasil partner API. This page exposes only the partner integration flow, not the internal Swagger documentation.
Overview
Partners use Tawasil APIs to create delivery orders and follow delivery status from their own system or partner portal.
CLIENT role. Dedicated PARTNER_ADMIN and PARTNER_STAFF roles can be added later for multi-user partner companies.Authentication
All protected partner APIs require a JWT access token.
/login{
"email": "partner@example.com",
"password": "********"
}Send the returned token in the Authorization header.
Authorization: Bearer <access_token>/refreshUse refresh when the access token expires. If refresh fails, login again.
Recommended Flow
- Login using POST /login.
- Calculate the delivery price.
- Create the order.
- List orders.
- Track the order.
Pricing
Calculate the delivery price before creating the order.
/partners/orders/pricing{
"vehicle_type": "motorcycle",
"distance_km": 162.649
}Orders
Create an order
/orders/Create the order after preparing sender contact, receiver contact, vehicle type, and calculated price.
List partner orders
/clients/clients_get_ordersUseful query params: status_filter, page, and size.
Order details
/orders/{order_id}Tracking
Polling
/tracking/orders/{order_id}/liveRecommended polling interval: 10 to 30 seconds while the order is active.
WebSocket
/tracking/ws/protocol/tracking/ws?token=<jwt>{
"action": "subscribe",
"channel": "order:<order_id>"
}Dashboard
/clients/statisticsOptional query params: start_date, end_date.
Show total orders, orders by status, delivered orders, active orders, and date-filtered activity.
Restricted APIs
POST /orders/{order_id}/assign-manual
POST /orders/{order_id}/start_of_delivery
POST /orders/{order_id}/finish_delivering
PATCH /orders/orders/{order_id}/cancel
GET /clients/getallpartner
POST /contacts/admin
GET /contacts/admin