Skip to content

Create Orders (Batch)

⚠️ This endpoint is currently disabled in production. The route is reachable but every request returns code: 1, message: "Api not found" until the batch ingestion path is re-enabled. Use Create Order one parcel at a time in the meantime.

API Overview

Reserved for future batch order submission. Each element of the orders array follows the same field rules as the single Create Order request body.

Request Information

  • Method: POST
  • Path: /openapi/order/create-orders
  • Authentication: Standard OpenAPI token (MD5-based)

Request Headers

FieldDescription
Content-Typeapplication/json
x-auth-name$API_NAME
x-auth-seed$SEED (13-digit millisecond Unix timestamp)
x-auth-token$TOKEN (MD5 hash)

Request Parameters

ParameterTypeRequiredDescription
ordersarrayYesArray of order objects. Each element has the same fields as the Create Order request body

Request Body Example

json
{
  "orders": [
    {
      "custom_tracking_num": "ORDER-001",
      "recipient_name": "Jane Smith",
      "recipient_country": "SG",
      "recipient_phone": "6591234567",
      "recipient_address": "123 Orchard Road",
      "recipient_city": "Singapore",
      "recipient_email": "jane@example.com",
      "postal_code": "238858",
      "sender_country": "SG",
      "client_size": "30,20,10",
      "client_weight": 1.5,
      "declared_value": 99.99,
      "declared_value_currency": "SGD",
      "item": [{"description": "Electronics", "itemHSCode": "8471300000", "quantity": 1, "unitPrice": 99.99, "weight": 1.5, "currency": "SGD", "totalValue": 99.99}]
    }
  ]
}

Token Generation Example

The authentication token is computed from your credentials and seed only -- request parameters are not included.

seed  = "1746700000000"   (13-digit ms timestamp)
token = md5( strtolower(api_name) + api_key + seed )

Authentication

This endpoint uses Standard OpenAPI Authentication (MD5 token).

For complete authentication instructions and code examples, see Authentication Guide.

Response Information

The response is in JSON format.

Response Format

FieldTypeDescription
codeintegerResult code. 0 = success, 1 = failure
messagestringResult description
dataarrayArray of per-order results

Success Response

  • Status Code: 200
  • Response Body:

The success response shape below describes the design intent. The endpoint currently short-circuits before reaching this code path; see the warning at the top of this document.

json
{
    "code": 0,
    "message": "success",
    "data": {
        "success": [
            {
                "custom_tracking_num": "C240719112801849950gAA",
                "date_time": "2024-07-19T13:30:48+08:00",
                "status": "Accepted",
                "error": []
            }
        ],
        "errors": [
            {
                "custom_tracking_num": "C240719112801849A950gAA",
                "date_time": "2024-07-19T13:30:48+08:00",
                "status": "Rejected",
                "error": [
                    {
                        "reason": "Service Code invalid"
                    }
                ]
            }
        ]
    }
}
FieldTypeDescription
data.successarrayOrders accepted and queued for creation
data.success[].custom_tracking_numstringYour submitted order reference
data.success[].date_timestringISO 8601 timestamp when the batch was processed
data.success[].statusstringAccepted for queued orders
data.success[].errorarrayEmpty for accepted orders
data.errorsarrayOrders rejected during validation; same element shape as success[] but with status: "Rejected" and one or more error[] entries

Error Response

  • Status Code: 200 (business logic error) or 4xx/5xx (system error)
  • Response Body:
json
{
  "code": 1,
  "message": "Api not found",
  "data": []
}

Common errors:

  • Endpoint disabled -- code 1, message Api not found (current behaviour)
  • Authentication failure → code 1; the message depends on the cause (e.g. x-auth-token: INVALID, x-auth-seed: TIMEOUT) — see signature.md
  • Order count exceeds the configured per-request limit -- code 1, message The one-time push order data cannot exceed N pieces

Code Reference

CodeDescription
0Success
1Failure

Example

Bash

bash
API_NAME="your_api_name"
API_KEY="your_api_key"
SEED=$(date +%s%3N)
TOKEN=$(printf '%s' "$(echo -n "$API_NAME" | tr '[:upper:]' '[:lower:]')${API_KEY}${SEED}" | md5sum | cut -d' ' -f1)

curl -X POST "https://api.test.wmgdelivery.com/v1/openapi/order/create-orders" \
  -H "Content-Type: application/json" \
  -H "x-auth-name: $API_NAME" \
  -H "x-auth-seed: $SEED" \
  -H "x-auth-token: $TOKEN" \
  -d '{
    "orders": [
      {
        "custom_tracking_num": "ORDER-001",
        "recipient_name": "Jane Smith",
        "recipient_country": "SG",
        "recipient_phone": "6591234567",
        "recipient_address": "123 Orchard Road",
        "recipient_city": "Singapore",
        "recipient_email": "jane@example.com",
        "postal_code": "238858",
        "sender_country": "SG",
        "client_size": "30,20,10",
        "client_weight": 1.5,
        "declared_value": 99.99,
        "declared_value_currency": "SGD",
        "item": [{"description": "Electronics", "itemHSCode": "8471300000", "quantity": 1, "unitPrice": 99.99, "weight": 1.5, "currency": "SGD", "totalValue": 99.99}]
      }
    ]
  }'

Windows PowerShell

powershell
$API_NAME = "your_api_name"
$API_KEY  = "your_api_key"
$SEED     = [string]([DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds())

$raw   = [System.Text.Encoding]::UTF8.GetBytes($API_NAME.ToLower() + $API_KEY + $SEED)
$md5   = [System.Security.Cryptography.MD5]::Create().ComputeHash($raw)
$TOKEN = -join ($md5 | ForEach-Object { $_.ToString("x2") })

$order = [ordered]@{
    custom_tracking_num     = "ORDER-001"
    recipient_name          = "Jane Smith"
    recipient_country       = "SG"
    recipient_phone         = "6591234567"
    recipient_address       = "123 Orchard Road"
    recipient_city          = "Singapore"
    recipient_email         = "jane@example.com"
    postal_code             = "238858"
    sender_country          = "SG"
    client_size             = "30,20,10"
    client_weight           = 1.5
    declared_value          = 99.99
    declared_value_currency = "SGD"
    item                    = @(@{ description = "Electronics"; itemHSCode = "8471300000"; quantity = 1; unitPrice = 99.99; weight = 1.5; currency = "SGD"; totalValue = 99.99 })
}

$body = [ordered]@{ orders = @($order) } | ConvertTo-Json -Depth 6 -Compress

$headers = @{
    "Content-Type" = "application/json"
    "x-auth-name"  = $API_NAME
    "x-auth-seed"  = $SEED
    "x-auth-token" = $TOKEN
}

$response = Invoke-RestMethod `
    -Uri "https://api.test.wmgdelivery.com/v1/openapi/order/create-orders" `
    -Method Post -Headers $headers -Body $body
$response | ConvertTo-Json -Depth 10

Python

python
import hashlib, time
import requests

API_NAME = 'your_api_name'
API_KEY  = 'your_api_key'
SEED     = str(int(time.time() * 1000))
TOKEN    = hashlib.md5((API_NAME.lower() + API_KEY + SEED).encode()).hexdigest()

headers = {
    'Content-Type': 'application/json',
    'x-auth-name':  API_NAME,
    'x-auth-seed':  SEED,
    'x-auth-token': TOKEN,
}

body = {
    'orders': [
        {
            'custom_tracking_num':     'ORDER-001',
            'recipient_name':          'Jane Smith',
            'recipient_country':       'SG',
            'recipient_phone':         '6591234567',
            'recipient_address':       '123 Orchard Road',
            'recipient_city':          'Singapore',
            'recipient_email':         'jane@example.com',
            'postal_code':             '238858',
            'sender_country':          'SG',
            'client_size':             '30,20,10',
            'client_weight':           1.5,
            'declared_value':          99.99,
            'declared_value_currency': 'SGD',
            'item': [{'description': 'Electronics', 'itemHSCode': '8471300000', 'quantity': 1, 'unitPrice': 99.99, 'weight': 1.5, 'currency': 'SGD', 'totalValue': 99.99}],
        }
    ]
}

resp = requests.post('https://api.test.wmgdelivery.com/v1/openapi/order/create-orders', json=body, headers=headers)
print(resp.json())

Node.js / TypeScript

typescript
import crypto from 'node:crypto';

const API_NAME = 'your_api_name';
const API_KEY  = 'your_api_key';
const SEED     = String(Date.now());
const TOKEN    = crypto.createHash('md5').update(API_NAME.toLowerCase() + API_KEY + SEED).digest('hex');

const body = JSON.stringify({
    orders: [
        {
            custom_tracking_num:     'ORDER-001',
            recipient_name:          'Jane Smith',
            recipient_country:       'SG',
            recipient_phone:         '6591234567',
            recipient_address:       '123 Orchard Road',
            recipient_city:          'Singapore',
            recipient_email:         'jane@example.com',
            postal_code:             '238858',
            sender_country:          'SG',
            client_size:             '30,20,10',
            client_weight:           1.5,
            declared_value:          99.99,
            declared_value_currency: 'SGD',
            item: [{ description: 'Electronics', itemHSCode: '8471300000', quantity: 1, unitPrice: 99.99, weight: 1.5, currency: 'SGD', totalValue: 99.99 }],
        },
    ],
});

const resp = await fetch('https://api.test.wmgdelivery.com/v1/openapi/order/create-orders', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'x-auth-name':  API_NAME,
        'x-auth-seed':  SEED,
        'x-auth-token': TOKEN,
    },
    body,
});
console.log(JSON.stringify(await resp.json(), null, 2));

PHP

php
<?php
$API_NAME = 'your_api_name';
$API_KEY  = 'your_api_key';
$SEED     = (string)(time() * 1000);
$TOKEN    = md5(strtolower($API_NAME) . $API_KEY . $SEED);

$body = [
    'orders' => [
        [
            'custom_tracking_num'     => 'ORDER-001',
            'recipient_name'          => 'Jane Smith',
            'recipient_country'       => 'SG',
            'recipient_phone'         => '6591234567',
            'recipient_address'       => '123 Orchard Road',
            'recipient_city'          => 'Singapore',
            'recipient_email'         => 'jane@example.com',
            'postal_code'             => '238858',
            'sender_country'          => 'SG',
            'client_size'             => '30,20,10',
            'client_weight'           => 1.5,
            'declared_value'          => 99.99,
            'declared_value_currency' => 'SGD',
            'item'                    => [
                ['description' => 'Electronics', 'itemHSCode' => '8471300000', 'quantity' => 1, 'unitPrice' => 99.99, 'weight' => 1.5, 'currency' => 'SGD', 'totalValue' => 99.99],
            ],
        ],
    ],
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.test.wmgdelivery.com/v1/openapi/order/create-orders');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'x-auth-name: '  . $API_NAME,
    'x-auth-seed: '  . $SEED,
    'x-auth-token: ' . $TOKEN,
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$response = curl_exec($ch);
curl_close($ch);
echo json_encode(json_decode($response, true), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "\n";
?>

Notes

  • Each order in the orders array follows the same field rules as Create Order.
  • The authentication token does not include request parameters; only credentials and seed are used.
  • The seed must be a 13-digit millisecond Unix timestamp and within ±10 minutes of server time.
  • All parameters are case-sensitive.

Error Codes

codemessageDescription
1Authentication error messageAuthentication failed; the returned message depends on the cause — see the full list in signature.md
1Api not foundThe endpoint is currently disabled; this is returned for every request regardless of the payload
1The one-time push order data cannot exceed N piecesBatch exceeds the configured per-request limit