GetTrackingEvents
Use webhooks for updates, and GET /api/tracking/{orderLineId} when you need the full history.
What’s different
Section titled “What’s different”- Track by order line. Use the
OrderLineIdfrom the create-order response where you usedShipmentId. It’s aGETwith the ID in the path. You can also track by courier tracking number and postcode withGET /api/tracking/{reference}/{postcode}. - One normalised stage, not a status on every event. Parcel Monkey put a harmonised
PARENT__SUBstatus on every event. Parcel2Go gives you the courier’s own events inResults, plus a singleStagefor the whole delivery and anIsInErrorflag. See Tracking statuses for how they line up. - Fewer fields per event. There’s no
locationorcarrier_url. TODO(verify) T8: Is event location included anywhere, for example inDescriptionorDetails? - One call per order line. An order with several items needs one tracking call per order line.
- History limit. Tracking returns
404for order lines paid more than 18 months ago.
Use webhooks instead of polling
Section titled “Use webhooks instead of polling”Parcel2Go can post a Tracking event to your endpoint each time a delivery enters a new stage. This replaces polling GetTrackingEvents on a timer.
- In your Parcel2Go account, go to My Account > Account > API Clients and choose Manage on your client.
- In Webhooks, enter your endpoint URL and a secret.
- Your endpoint must return
200. If it doesn’t, Parcel2Go retries with a backoff until it gets a200or reaches its retry limit.
Set up webhooks on your sandbox client to test, and again on your live client when you go live.
{ "Id": "e0363b4a-aead-4dd5-bcc5-73793ad49974", "Timestamp": "2018-08-30T11:37:03.6386334+00:00", "Signature": "ac6cff923966b1dfcb4560e32d9a6683ea9b1c1f41aa3ad9c8e36658f7389703", "Type": "Tracking", "Payload": { "OrderLineId": 1234567, "Timestamp": "2018-08-28T09:36:07.4805536+00:00", "StatusCode": "ABC", "StatusDescription": "Handed to Customer", "TrackingStage": "Delivered" }}TrackingStage is one of DroppedOff, Collected, InTransit, AtDepot, DeliveryScheduled or Delivered. Parcel2Go also sends Case events for enquiries and claims.
Verify the signature
Section titled “Verify the signature”Each webhook is signed with HMAC-SHA256 of Id:Timestamp:Type, using your webhook secret, with the timestamp formatted as yyyy-MM-dd HH:mm:ss. Check it before you trust the payload. Also reject repeated Ids and timestamps outside a sensible window.
<?php$secret = getenv('P2G_WEBHOOK_SECRET');$event = json_decode(file_get_contents('php://input'), true);
$timestamp = (new DateTimeImmutable($event['Timestamp']))->format('Y-m-d H:i:s');$expected = hash_hmac('sha256', "{$event['Id']}:{$timestamp}:{$event['Type']}", $secret);
if (!hash_equals($expected, strtolower($event['Signature'] ?? ''))) { http_response_code(401); exit;}
// Reject replays: store $event['Id'] and ignore any Id you've already processed.
if ($event['Type'] === 'Tracking') { $orderLineId = $event['Payload']['OrderLineId']; $stage = $event['Payload']['TrackingStage']; // Update your shipment record here, or queue it and return straight away.}
http_response_code(200);Polling examples
Section titled “Polling examples”curl -X GET "https://sandbox.parcel2go.com/api/tracking/115030194" \ -H "Authorization: Bearer $P2G_TOKEN" \ -H "Accept: application/json"<?php// $p2g is the client from the Authentication page$tracking = $p2g->request('GET', '/api/tracking/115030194');{ "Stage": "Delivered", "UsesStages": true, "IsInError": false, "Collected": "2026-12-07T14:53:00+00:00", "Delivered": "2026-12-09T12:20:00+00:00", "Results": [ { "Timestamp": "2026-12-09T12:20:00+00:00", "Description": "Delivered, signed for", "StatusCode": "<courier code>", "ParcelNumber": "<courier tracking number>", "DeliveryType": "Delivery" }, { "Timestamp": "2026-12-07T14:53:00+00:00", "Description": "Collected", "StatusCode": "<courier code>", "ParcelNumber": "<courier tracking number>", "DeliveryType": "Collection" } ]}Abridged. Descriptions and status codes come from the courier.
Compare with the Parcel Monkey GetTrackingEvents call
curl -X POST "https://api.parcelmonkey.co.uk/GetTrackingEvents" \ -H "Content-Type: application/json" \ -H "apiversion: 3.3" \ -H "userid: $PM_USER_ID" \ -H "token: $PM_API_KEY" \ -d '{ "ShipmentId": "4749253"}'<?php$ch = curl_init('https://api.parcelmonkey.co.uk/GetTrackingEvents');curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'apiversion: 3.3', 'userid: ' . $pmUserId, 'token: ' . $pmApiKey], CURLOPT_POSTFIELDS => json_encode([ 'ShipmentId' => '4749253', ]),]);$response = json_decode(curl_exec($ch), true);[ { "ShipmentId": "4749253", "time": "2026-12-09 12:20:00+0000", "status": "DELIVERED__SIGNED_FOR_BY_RECIPIENT", "location": "NEW YORK", "carrier_message": "Delivered, signed for", "carrier_reference": "123123123132", "carrier_url": "https://carrier.example.com/track/?reference=123123123132" }, { "ShipmentId": "4749253", "time": "2026-12-07 14:53:00+0000", "status": "COLLECTED_OR_DROPPED_OFF__COLLECTED", "location": "LEEDS", "carrier_message": "Collected", "carrier_reference": "123123123132", "carrier_url": "https://carrier.example.com/track/?reference=123123123132" }]Field mapping
Section titled “Field mapping”Request
Section titled “Request”| Parcel Monkey | Parcel2Go | Required | Notes |
|---|---|---|---|
ShipmentId | Yes / No | Use the OrderLineId (e.g. P2G1234567 or 1234567). GET, not POST. Postcode is optional. | |
(alternative) | Yes | Track by courier tracking number + collection or delivery postcode. |
Response
Section titled “Response”| Parcel Monkey | Parcel2Go | Required | Notes |
|---|---|---|---|
[] (top-level array of events) | Results[] | No | Events are wrapped in a TrackingResult that also carries the overall Stage and stage dates. |
ShipmentId | No equivalent | Not repeated on each event; you requested by OrderLineId. | |
time | Results[]. | No | ISO 8601 (PM used 'YYYY-MM-DD HH:MM:SS+0000'). |
status | StageIsInErrorResults[].Results[]. | No | No harmonised status per event. Stage is the normalised stage of the whole delivery; IsInError flags problems; StatusCode is the courier's own code. See the tracking status mapping. |
location | No equivalent | No dedicated location field. TODO(verify) T8: Is event location included anywhere (Description / Details)? | |
carrier_message | Results[]. | No | Details may hold more text. |
carrier_reference | Results[]. | No | Also available from POST /api/orders/{orderId}/parcelnumbers and labels/separate CourierTrackingNumbers. |
carrier_url | No equivalent | No courier tracking URL. | |
| New in Parcel2Go | EstimatedDeliveryDateDeliveredResults[]. | No | Stage timestamps, ETA and proof of delivery. |
Reference
Section titled “Reference”-
GET /api/tracking/{orderLineId} -
GET /api/tracking/{reference}/{postcode} POST /api/orders/{orderId}/parcelnumbers(courier tracking numbers for an order)- Parcel2Go webhooks guide