Modify Parcel Size & Weight
API Overview
Updates the dimensions and/or weight of a parcel that has already been registered but not yet shipped out on a closed order. Send only the measurements you want to change.
Request Information
- Method: POST
- Path:
/api/parcel/edit-parcel-size-weight - Authentication: Bearer Token
Request Headers
| Field | Description |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer <token> |
Request Parameters
The request body is in JSON format and includes the following fields:
| Parameter | Type | Required | Description |
|---|---|---|---|
| wmg_tracking_num | string | Conditional | The WMG tracking number of the parcel. Maximum 60 characters. Either this or tracking_number must be supplied. |
| tracking_number | string | Conditional | Your own tracking number for the parcel. Maximum 50 characters. Either this or wmg_tracking_num must be supplied. |
| weight | number | No | New declared weight. Stored with up to 3 decimal places. Omit to leave unchanged. |
| length | number | No | New length. Stored with up to 2 decimal places. Omit to leave unchanged. |
| width | number | No | New width. Stored with up to 2 decimal places. Omit to leave unchanged. |
| height | number | No | New height. Stored with up to 2 decimal places. Omit to leave unchanged. |
Request Body Example
json
{
"wmg_tracking_num": "CY18000004XX4SG",
"weight": "12.028",
"length": "12.08",
"width": "12.08",
"height": "12.08"
}Authentication
This endpoint uses Bearer token authentication.
Obtain a token from Get Token and send it as Authorization: Bearer <Token>.
Response Information
The response is in JSON format.
Response Format
| Field | Type | Description |
|---|---|---|
| Code | integer | 0 = success; non-zero = failure |
| Message | string | Human-readable result |
| Data | array | Always an empty array for this endpoint |
Success Response
- Status Code: 200
json
{
"Code": 0,
"Message": "Success",
"Data": []
}This endpoint returns no payload. A Code of 0 means the parcel was updated.
Error Response
- Status Code: 200 (business logic error) or 4xx/5xx (system error)
json
{
"Code": 1,
"Message": "Parcel Not Found",
"Data": []
}Code Reference
| Code | Description |
|---|---|
| 0 | Success |
| 1 | Failure |
Example
Bash
bash
BASE_URL="https://api.postal.test.wmgdelivery.com"
TOKEN="your_access_token"
curl -X POST "$BASE_URL/api/parcel/edit-parcel-size-weight" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{"wmg_tracking_num":"CY18000004XX4SG","weight":"12.028","length":"12.08","width":"12.08","height":"12.08"}'Windows PowerShell
powershell
$BASE_URL = "https://api.postal.test.wmgdelivery.com"
$TOKEN = "your_access_token"
# Send only the measurements you want to change
$body = @{
wmg_tracking_num = "CY18000004XX4SG"
weight = "12.028"
length = "12.08"
width = "12.08"
height = "12.08"
} | ConvertTo-Json
$response = Invoke-RestMethod -Uri "$BASE_URL/api/parcel/edit-parcel-size-weight" -Method Post `
-ContentType "application/json" -Body $body -Headers @{Authorization = "Bearer $TOKEN"}
$response | ConvertTo-Json -Depth 10Python
python
import requests
BASE_URL = "https://api.postal.test.wmgdelivery.com"
TOKEN = "your_access_token"
# Send only the measurements you want to change
resp = requests.post(f"{BASE_URL}/api/parcel/edit-parcel-size-weight", json={
"wmg_tracking_num": "CY18000004XX4SG",
"weight": "12.028",
"length": "12.08",
"width": "12.08",
"height": "12.08",
}, headers={"Authorization": f"Bearer {TOKEN}"}, timeout=10)
print(resp.json())Node.js / TypeScript
typescript
const BASE_URL = "https://api.postal.test.wmgdelivery.com";
const TOKEN = "your_access_token";
const res = await fetch(`${BASE_URL}/api/parcel/edit-parcel-size-weight`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${TOKEN}`,
},
// Send only the measurements you want to change
body: JSON.stringify({
wmg_tracking_num: "CY18000004XX4SG",
weight: "12.028",
length: "12.08",
width: "12.08",
height: "12.08",
}),
});
console.log(await res.json());PHP
php
<?php
$BASE_URL = 'https://api.postal.test.wmgdelivery.com';
$TOKEN = 'your_access_token';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $BASE_URL . '/api/parcel/edit-parcel-size-weight');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Authorization: Bearer ' . $TOKEN,
]);
// Send only the measurements you want to change
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'wmg_tracking_num' => 'CY18000004XX4SG',
'weight' => '12.028',
'length' => '12.08',
'width' => '12.08',
'height' => '12.08',
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$response = curl_exec($ch);
curl_close($ch);
echo json_encode(json_decode($response, true), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "\n";
?>Notes
- Identify the parcel with
wmg_tracking_num, withtracking_number, or with both. Supplying neither returnsTracking Number or wmg tracking num is invalid. When both are supplied, the parcel must match both values. - Both identifiers are normalised to upper case before matching, so their case does not matter.
- Omitted measurements are left untouched, so a partial update is the normal case. An explicit
0is applied — send0only if you really mean zero. - The parcel must not already belong to a closed order. Once its order is closed the measurements are locked and the call returns
Parcel was used. - The resulting length, width, height and weight are validated together against the limits for the parcel's service and destination. Because omitted values fall back to what is already stored, a single new dimension can still push the parcel over a limit — the message names the limit that was breached.
- Every change is recorded against the parcel for audit purposes.
- Only parcels belonging to the authenticated account can be modified.
- All parameters are case-sensitive.
Error Codes
| code | message | Description |
|---|---|---|
1 | Tracking Number or wmg tracking num is invalid | Neither wmg_tracking_num nor tracking_number was supplied. |
1 | Parcel Not Found | No parcel in your account matches the supplied identifier(s). |
1 | Parcel was used | The parcel belongs to an order that has already been closed. |
1 | max size of wmg_tracking_num must be 60 | wmg_tracking_num is longer than 60 characters. |
1 | max size of tracking_number must be 50 | tracking_number is longer than 50 characters. |
1 | The resulting dimensions or weight exceed the limit for the parcel's service and destination. The message states which limit was breached. | |
1 | Error encountered, please contact tech@wmg-group.com with screenshot of error page for resolution. | Unexpected server error. |
1003 | Token error | The token is missing, expired, or superseded by a newer login. Call Get Token again. |