Tracking

Code Samples for Tracking: Java (.zip) | PHP (.zip) | C# (.zip)

Get Tracking Summary – SOAP

Summary

Name: Get Tracking Summary
Reason to Call: To get the most recent/significant tracking event for a parcel
Input: Parcel Identification Parameter(s)
(e.g PIN Number / DNC Number or Reference parameters)
Output: Date, location and event type for the most recent/significant event
Error Examples: PIN not found, duplicate PIN
Possible Next Calls: Get Tracking Details, Get Signature Image, Get Delivery Confirmation
Version history: Release notes

Call Details

WSDL: track.wsdl
Endpoint (Development): https://ct.soa-gw.canadapost.ca/vis/soap/track
Endpoint (Production): https://soa-gw.canadapost.ca/vis/soap/track
Namespace: http://www.canadapost.ca/ws/soap/track
Operation: GetTrackingSummary

SOAP Body

You can access Get Tracking Summary in one of three ways:

  • by parcel identification number (PIN)
  • by Delivery Notice Card (DNC) number
  • by reference parameters

This section describes the XML input elements to this service. For the hierarchical structure, see the XML diagram.

Get Tracking Summary – Request Elements
Element Name Type Required / Optional Description

get-tracking-summary-request

complex

required

The top level XML element for the request input information.

Note: Exactly one of pin-number, dnc-number, or reference-criteria must be present under this top level element.

locale

simple

optional

Indicates your language preference for receiving error messages.

EN = English
FR = French

If no value is provided, the default language is English.

pin-number

simple

conditionally required

The PIN (Parcel Identification Number) assigned by Canada Post on creation of the shipping label and used for tracking purposes.

(12, 13 or 16 characters)

When executing a request by PIN, this is mandatory and is the only parameter necessary.

dnc-number

simple

conditionally required

The Delivery Notice Card (DNC) number – The number on the card left by delivery personnel when no one is home to receive the delivery.

(15 numeric characters)

When executing a request by DNC number, this is mandatory and is the only parameter necessary.

reference-criteria

complex

conditionally required

This structure contains the reference parameters for a call by reference parameters.

customer-number

simple

optional

Can be either:

  • The customer number for the organization initiating the shipment
  • The customer number of the customer on whose behalf the parcel was mailed.

(10-digit numeric)

This is an optional element. If the customer-number element is not specified, the customer-number of the user that was used to authenticate this request will be used.

If you ship parcels on behalf of other customers and you specify their customer number in the request, only tracking results of parcels mailed “on behalf of” that customer (and that match the other criteria in your request) are returned.

If you ship parcels on behalf of other customers and you specify your own customer number, you will receive tracking results for any parcels you shipped for yourself, and all parcels you shipped for any other customers (providing they also match the other criteria in your request).

reference-number

simple

conditionally required

The value assigned to a parcel by the shipper at the time the shipment was created. You would have specified this value in either “customer-ref-1” or “customer-ref-2” fields of the submitted parcel.

(up to 35 characters)

When executing a request by reference parameter, the reference-number element is mandatory and must be included.

The get Tracking Summary service only returns tracking results for parcels that match the reference-number value.

destination-postal-code

simple

optional

The destination Postal Code, zip code or postal identifier for the parcel in its destination country. This is the value that would be supplied in the element “postal-zip-code” in a create shipment request.

Format is any of the following:

  • 6-character alphanumeric for Canada
    (A9A9A9)
  • 5-digit or 5-4 digit numeric code for US
    (99999 or 99999-9999)
  • Character String – up to 14 characters (free format) for other countries.

The destination-postal-code element is optional.

When present, the Get Tracking Summary service only returns tracking results for parcels that match the destination-postal-code value.

Note: For zip codes in the form 99999-9999, only the first 5 digits are used in the matching.

mailing-date-from

simple

conditionally required

The combination of mailing-date-from and mailing-date-to elements defines a range of dates for when the parcel(s) in question was shipped.

Format is: yyyy-mm-dd

The mailing-date-from value cannot be earlier than two calendar months from the current date.

When executing a request by reference parameter, both the mailing-date-from and mailing-date-to elements are mandatory and must be included.

The Get Tracking Summary service only returns tracking results for parcels that were shipped within the range of dates specified by the mailing-date-from and mailing-date-to elements.

mailing-date-to

simple

conditionally required

Request – XML Diagram

Get Tracking Summary – Structure of the XML Request

Get Tracking Summary – Structure of the XML Request

Response Details

Response – Elements

The following table describes the XML elements in the response to Get Tracking Summary. For the hierarchy of the response, see the
XML diagram.

Get Tracking Summary – Response Elements
Field Name Description

get-tracking-summary-response

The top level of the XML structure for the response.
It will either contain the results of a successful completion or the error structure.

tracking-summary

The main structure containing the results of the request.

pin-summary

Contains the response for the specified PIN.

May occur 1 …; 100 times

Note: PIN and DNC queries return a single pin-summary result. A reference search may return multiple pin-summary instances if more than one item matches the search criteria.

pin

The Parcel Identification Number (PIN) that you can use to call tracking services.

origin-postal-id

The first 3 digits of the origin Postal Code for Canadian destinations.

For an inbound international parcel, this field is blank or contains the postal identifier of the country of origin.

destination-postal-id

The first 3 digits of the destination Postal Code for parcels to be delivered in Canada.

For international parcels this is the postal identifier of the destination country (e.g. ZIP code for parcels with a U.S. destination) or an identifier of the destination country.

destination-province

The 2-digit province code for the destination.

"postal designators" - abbreviations used by Canada Post ISO 3166-2 for Canadian bound parcels.

Parcels bound for international destinations have the postal identifier of the destination country (e.g. ZIP code for parcels with a U.S. destination).

service-name

Canada Post service name in the language specified. The service-name will default to English if language is not specified.

For inbound international parcels, service name is empty or contains the service name from its shipper of origin if available.

mailed-on-date

The date of the first event for the item. If the item has been mailed from an international location this date may be blank.

expected-delivery-date

The date the item is expected to reach the destination address for addresses in Canada.

If the item has been mailed from or to an international location this date may be blank.

actual-delivery-date

The date the item was delivered.

Blank if not delivered or if delivery information from an international organization for an international shipment has not been provided.

delivery-option-completed-ind

0 – at least one option was not satisfied

1 – all options were satisfied

2 – no options were found

event-date-time

yyyymmdd:hhmmss

The time stamp of the most recent significant event.

event-description

A brief description of the event

attempted-date

The date that a delivery was attempted.

For shipments into or within Canada this will indicate that an unsuccessful attempt to deliver the parcel was made on the specified date.

customer-ref-1

The value supplied by the shipper as customer-ref-1when the shipment was first created with Canada Post. French character set is supported through this interface.

customer-ref-2

The value supplied by the shipper as customer-ref-2 when the shipment was first created with Canada Post. French character set is supported through this interface.

return-pin

If a return label (PIN) was printed at the same time the shipment was created and the shipment is being returned, the return PIN is displayed.

event-type

The value in this field will indicate what type of event is represented for this item.

event-location

For an event representing a scan or delivery, this value will indicate the location where the event took place.

signatory-name

If the event presented as the last most significant event is a signature, the text of this field contains the signatory name.

Response – XML Diagram

Response – Possible Error Responses

The response to error conditions for this web service follows the standard SOAP error response approach used for all Canada Post web services. For more information, see SOAP Fundamentals of Canada Post Web Services.

Possible error messages for this service include the following:

Code Description Notes

002

Duplicate Pin

Received on PIN or DNC searches where duplicate PINs have been encountered.

004

No Pin History

No tracking results were found based on the parameters provided. Check your parameters and the order of the from and to dates.

006

Reference number, mailed from date, mailed to date and destination Postal Code are required fields for a reference number search.

Received only on reference number searches.

008

Invalid Date

For summary reference searches, dates greater than 2 months old will result in a return of this error.

Examples

Sample SOAP XML – Reference Request

<get-tracking-summary-request>
<locale>EN</locale>
<reference-criteria>
<reference-number>DIA101</reference-number>
<destination-postal-code>K2H7X3</destination-postal-code>
<mailing-date-from>2012-03-23</mailing-date-from>
<mailing-date-to>2012-12-25</mailing-date-to>
</reference-criteria>
</get-tracking-summary-request>

Sample SOAP XML – Reference Search Result

<get-tracking-summary-response>
<tracking-summary>
<pin-summary>
<pin>1111111039265602</pin>
<origin-postal-id>K1G</origin-postal-id>
<destination-postal-id>K2H</destination-postal-id>
<destination-province>ON</destination-province>
<service-name>Xpresspost</service-name>
<mailed-on-date>2011-04-01</mailed-on-date>
<expected-delivery-date>2011-04-04</expected-delivery-date>
<actual-delivery-date></actual-delivery-date>
<delivery-option-completed-ind>2</delivery-option-completed-ind>
<event-date-time>20110401:155317</event-date-time>
<event-description>Order information received by Canada Post</event-description>
<attempted-date></attempted-date>
<customer-ref-1>APRIL1REF1A</customer-ref-1>
<customer-ref-2>APRIL1REF1B</customer-ref-2>
<return-pin></return-pin>
<event-type>INDUCTION</event-type>
<event-location></event-location>
<signatory-name></signatory-name>
</pin-summary>
<pin-summary>
<pin>1111111039414604</pin>
<origin-postal-id>K1G</origin-postal-id>
<destination-postal-id>K0J</destination-postal-id>
<destination-province>ON</destination-province>
<service-name>Expedited Parcels</service-name>
<mailed-on-date>2011-04-04</mailed-on-date>
<expected-delivery-date>2011-04-05</expected-delivery-date>
<actual-delivery-date></actual-delivery-date>
<delivery-option-completed-ind>2</delivery-option-completed-ind>
<event-date-time>20110404:133457</event-date-time>
<event-description>Order information received by Canada Post</event-description>
<attempted-date></attempted-date>
<customer-ref-1>APRIL1REF1A</customer-ref-1>
<customer-ref-2>APRIL1REF1C</customer-ref-2>
<return-pin></return-pin>
<event-type>INDUCTION</event-type>
<event-location></event-location>
<signatory-name></signatory-name>
</pin-summary>
<pin-summary>
<pin>1111111039423606</pin>
<origin-postal-id>J4W</origin-postal-id>
<destination-postal-id>K0J</destination-postal-id>
<destination-province>ON</destination-province>
<service-name>Expedited Parcels</service-name>
<mailed-on-date>2011-04-04</mailed-on-date>
<expected-delivery-date>2011-04-06</expected-delivery-date>
<actual-delivery-date></actual-delivery-date>
<delivery-option-completed-ind>2</delivery-option-completed-ind>
<event-date-time>20110404:153326</event-date-time>
<event-description>Order information received by Canada Post</event-description>
<attempted-date></attempted-date>
<customer-ref-1>APRIL1REF1A</customer-ref-1>
<customer-ref-2>APRIL1REF1H</customer-ref-2>
<return-pin></return-pin>
<event-type>INDUCTION</event-type>
<event-location></event-location>
<signatory-name></signatory-name>
</pin-summary>
<pin-summary>
<pin>1111111039298600</pin>
<origin-postal-id>K1G</origin-postal-id>
<destination-postal-id>K0J</destination-postal-id>
<destination-province>ON</destination-province>
<service-name>Expedited Parcels</service-name>
<mailed-on-date>2011-04-04</mailed-on-date>
<expected-delivery-date>2011-04-05</expected-delivery-date>
<actual-delivery-date></actual-delivery-date>
<delivery-option-completed-ind>2</delivery-option-completed-ind>
<event-date-time>20110404:133752</event-date-time>
<event-description>Order information received by Canada Post</event-description>
<attempted-date></attempted-date>
<customer-ref-1>APRIL1REF1A</customer-ref-1>
<customer-ref-2>APRIL1REF1D</customer-ref-2>
<return-pin></return-pin>
<event-type>INDUCTION</event-type>
<event-location></event-location>
<signatory-name></signatory-name>
</pin-summary>
</tracking-summary>
</get-tracking-summary-response>