Skip to content

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

FieldDescription
Content-Typeapplication/json
AuthorizationBearer <token>

Request Parameters

The request body is in JSON format and includes the following fields:

ParameterTypeRequiredDescription
wmg_tracking_numstringConditionalThe WMG tracking number of the parcel. Maximum 60 characters. Either this or tracking_number must be supplied.
tracking_numberstringConditionalYour own tracking number for the parcel. Maximum 50 characters. Either this or wmg_tracking_num must be supplied.
weightnumberNoNew declared weight. Stored with up to 3 decimal places. Omit to leave unchanged.
lengthnumberNoNew length. Stored with up to 2 decimal places. Omit to leave unchanged.
widthnumberNoNew width. Stored with up to 2 decimal places. Omit to leave unchanged.
heightnumberNoNew 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

FieldTypeDescription
Codeinteger0 = success; non-zero = failure
MessagestringHuman-readable result
DataarrayAlways 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

CodeDescription
0Success
1Failure

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 10

Python

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, with tracking_number, or with both. Supplying neither returns Tracking 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 0 is applied — send 0 only 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

codemessageDescription
1Tracking Number or wmg tracking num is invalidNeither wmg_tracking_num nor tracking_number was supplied.
1Parcel Not FoundNo parcel in your account matches the supplied identifier(s).
1Parcel was usedThe parcel belongs to an order that has already been closed.
1max size of wmg_tracking_num must be 60wmg_tracking_num is longer than 60 characters.
1max size of tracking_number must be 50tracking_number is longer than 50 characters.
1The resulting dimensions or weight exceed the limit for the parcel's service and destination. The message states which limit was breached.
1Error encountered, please contact tech@wmg-group.com with screenshot of error page for resolution.Unexpected server error.
1003Token errorThe token is missing, expired, or superseded by a newer login. Call Get Token again.