Akwaan Express Merchant API Documentation

Table of Contents

Overview

The Akwaan Express Merchant API allows external merchants to integrate with the Akwaan Express delivery system to create, track, and manage orders. This documentation covers all available endpoints for merchant integration.

Base Information

Authentication

API Key Authentication

All API requests require an API key to be included in the request headers.

ApiKey: your-api-key-here

Getting API Access

  1. Contact Akwaan Express support to register your merchant account
  2. Provide your integration details:
    • Webhook URL: Your server endpoint to receive order status updates
    • Contact information: Email, phone, company details
  3. Receive your unique API key and integration configuration
  4. Your webhook URL will be configured in the system to receive status updates
  5. No direct access to the admin panel is required - all operations via API

Order Management

Important: Order ID Usage

All API operations use the External Order ID (the ID from your system):

1. Create Order (External Merchant)

Creates a new order for external merchants using API key authentication.

POST /api/b2b/merchants/order

Headers:

Content-Type: application/json
ApiKey: your-api-key-here

Request Body:

{
  "code": "ORD-2024-001",
  "customerName": "أحمد حسن علي",
  "customerPhoneNumber": "07901234567",
  "customerSecondPhoneNumber": "07801234567",
  "externalId": "550e8400-e29b-41d4-a716-446655440000",
  "content": "1x iPhone 15 Pro Max 256GB - أسود",
  "deliveryZoneName": "الزعفرانية",
  "pickupZoneName": "المنصور",
  "pickUpGovernorateId": 1,
  "deliveryGovernorateId": 1,
  "note": "قطعة هشة - تعامل معها بحذر شديد",
  "amount": 40000.00,
  "paidAmount": 0.00,
  "nearestLandmark": "قرب مجمع بغداد التجاري",
  "pickUpLocation": {
    "lat": 33.3152,
    "long": 44.3661
  },
  "deliveryLocation": {
    "lat": 33.3406,
    "long": 44.4009
  }
}

Response:

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "code": "MERCHANT-001-ORD-2024-001",
  "customerName": "أحمد حسن علي",
  "customerPhoneNumber": "07901234567",
  "customerSecondPhoneNumber": "07801234567",
  "externalId": "550e8400-e29b-41d4-a716-446655440000",
  "content": "1x iPhone 15 Pro Max 256GB - أسود",
  "deliveryZoneName": "الزعفرانية",
  "pickupZoneName": "المنصور",
  "pickupGovernorate": {
    "id": 1,
    "name": "محافظة بغداد"
  },
  "deliveryGovernorate": {
    "id": 1,
    "name": "محافظة بغداد"
  },
  "note": "قطعة هشة - تعامل معها بحذر شديد",
  "amount": 40000.00,
  "paidAmount": 0.00,
  "nearestLandmark": "قرب مجمع بغداد التجاري",
  "size": "Small",
  "pickUpLocation": {
    "lat": 33.3152,
    "long": 44.3661
  },
  "deliveryLocation": {
    "lat": 33.3406,
    "long": 44.4009
  },
  "status": "Pending"
}

2. Get Order by External ID

Retrieves order details using the external order ID (your system's order ID).

GET /api/b2b/external/order/{externalId}

Headers:

ApiKey: your-api-key-here

Example:

GET /api/b2b/external/order/550e8400-e29b-41d4-a716-446655440000

Response:

Same as Create Order response

3. Cancel Order

Cancels an existing order using the internal order ID.

PUT /api/b2b/merchant/order/{externalId}/cancel

Headers:

Content-Type: application/json
ApiKey: your-api-key-here

Example:

PUT /api/b2b/merchant/order/550e8400-e29b-41d4-a716-446655440000/cancel

Response:

Updated order object with status "Cancelled"

Data Structures

OrderCreationIntegrationForm

Field Type Required Description
code string Yes Unique order code (will be prefixed with merchant code)
customerName string Yes Customer's full name
customerPhoneNumber string Yes Primary phone number (max 15 chars)
customerSecondPhoneNumber string No Secondary phone number (max 15 chars)
externalId GUID Yes Your system's order ID
content string Yes Item name and quantity (e.g., "2x iPhone 15 Pro Max", "5x Samsung Galaxy S24")
deliveryZoneName string Yes Name of delivery zone/area
pickupZoneName string Yes Name of pickup zone/area
pickUpGovernorateId int Yes Governorate ID for pickup location
deliveryGovernorateId int Yes Governorate ID for delivery location
note string No Additional notes for the order
amount decimal Yes Order value/amount (separate from delivery fee)
nearestLandmark string No Landmark near delivery location
pickUpLocation Location No GPS coordinates for pickup
deliveryLocation Location No GPS coordinates for delivery
size OrderSize No Order size (Small, Medium, Large) - defaults to Small

Location Object

Field Type Description
lat double Latitude coordinate
long double Longitude coordinate

Order Status Enum

Value Description
Pending (0) Order created, awaiting processing
InPickUpShipment (1) Assigned to pickup delegate
InPickUpProgress (2) Pickup in progress
AtPickUpPoint (3) At pickup location
Received (4) Successfully picked up
NotReceived (5) Pickup failed
InWarehouse (6) Order in warehouse
InDeliveryShipment (7) Assigned to delivery delegate
InDeliveryProgress (8) Delivery in progress
AtDeliveryPoint (9) At delivery location
Delivered (10) Successfully delivered
PartiallyDelivered (11) Partially delivered
Cancelled (12) Order cancelled
Completed (13) Order completed
RescheduledInWarehouse (14) Rescheduled in warehouse
RescheduledDelegate (15) Rescheduled with delegate
RefundedInWarehouse (16) Order is returned in the warehouse
RefundedDelegate (17) Order is refunded by user and is with delegate now
InRefundShipment (27) In refund list - assigned to return to merchant
InRefundProgress (28) On the way to return to merchant
RefundedToMerchant (29) Order refunded to merchant

Order Size Enum

Value Description
Small (0) Small package
Medium (1) Medium package
Large (2) Large package

Error Handling

Error Response Format

{
  "error": "Error message description",
  "details": "Additional error details if available"
}

Common Error Messages

Error Message Description Solution
API Key is missing No API key provided in headers Include ApiKey header
Please notify the akwaan delivery system to add your integration details API key not found or inactive Contact support to activate your integration
Merchant Not Found Associated merchant not found Contact support
Pickup Governorate Not Found Invalid pickup governorate ID Use valid governorate ID
Delivery Governorate Not Found Invalid delivery governorate ID Use valid governorate ID
please notify the delivery system to set a delivery zone prices No pricing configured for delivery zone Contact support to configure pricing
Order with the same code Already Exists Duplicate order code Use unique order code
Delivery Zone or Pickup Zone cant be null or empty Missing zone names Provide both pickup and delivery zone names

HTTP Status Codes

Code Description
200 Success
400 Bad Request (validation errors)
401 Unauthorized (invalid API key)
404 Not Found
500 Internal Server Error

Webhooks

The system supports webhooks for real-time order status updates. When you register for API access, you must provide your webhook URL where you want to receive status updates.

Webhook Configuration

During registration, provide your webhook URL in this format:

The system will automatically append the external order ID to your URL when sending updates.

Webhook Events

Event Type Description
OrderStatusCreated Order created successfully
OrderStatusUpdated Order status changed
OTPSend Order status update sent with OTP (OTP sent to merchant's app, not SMS/WhatsApp)
OTPResend OTP resent to merchant's app

Webhook Payload

The system will send HTTP PUT requests to your configured webhook URL with the following format:

URL Pattern: {YOUR_WEBHOOK_URL}/api/akwaan/order-delivery/webhook

Example URL: https://merchant-api.example.com/api/akwaan/order-delivery/webhook

Headers:

Content-Type: application/json
Authorization: {your-auth-header} (if configured)

Payload:


[
    {
        "eventType": "OrderStatusUpdated",
        "eventData": {
            "orderId" : "02323",
            "status": "InDeliveryProgress"
        }
    }
]

Webhook Event Data

Event Type Event Data
OrderStatusCreated {"status": "Pending"}
OrderStatusUpdated {"status": "InDeliveryProgress"}
OTPSend {"status": "InDeliveryProgress", "otp": "123456"}
OTPResend {"otp": "123456"}

Sample Data for Testing

Governorate IDs (Iraq)

Content Field Examples

The content field should describe the items and quantities being shipped:

Payment Fields Clarification

Important: The amount field should only contain the value of the items, not the delivery cost. The delivery fee will be calculated and added automatically by the system.

Example Payment Breakdown:

Item Value (amount): 40,000 IQD
Delivery Fee: 5,000 IQD (calculated by system)
Total Amount: 45,000 IQD (calculated by system)

What to send: Only the item value (40,000) in the amount field

What you'll receive: Item value + calculated delivery fee in the response

Integration Checklist

Before integrating with the Akwaan Express API, ensure you have:

Support

For technical support or questions about the API:

Changelog

Version Date Changes
1.0 2025-09-12 Initial API documentation for Akwaan Express

This documentation is maintained by the Akwaan Express development team. For the most up-to-date information, please refer to the latest version of this document.