Check on Tracking

After your job has been processed you can check on the shipment tracking by doing a GET call on the /jobs/{id}/Tracking endpoint using the ID returned from the /jobs call that created the job. This is an optional call that you can also check through the website as well, even if you submitted your job via API.

Important The tracking information is only provided back to Click2Mail once per day so calling it once per day is sufficient to get the most up to date information.

Note In the staging environment the API will never return tracking details as the items are never actually sent.

The one required parameter is trackingType, which we will set to 'IMB' for this tutorial. Acceptable values are 'IMB' meaning Intelligent Mail Barcode, and 'IMPB' meaning Intelligent Mail Package Barcode.

Important trackingType is a QUERY parameter, so must be specified within the URL.

An optional parameter is to specify the desire for tracking details. By default this value is set to false.

The following code sample demonstrates requesting tracking information for job ID 8675309:

# Load the HTTP requests module
import requests

# Define credentials
myusername = 'awesomeuser'
mypassword = 'gReAt/PaSsWoRd123'

headers = {'user-agent': 'my-app/0.0.1'}

# Note the ID of the previously-created job
jobId = '8675309'

# Set the tracking for the job
trackingType = "trackingType=IMB"

# Define the endpoint to use, including the jobId
url = "" + jobId + "/tracking?" + trackingType

# Make the GET call
r = requests.get(url, headers=headers, auth=(myusername, mypassword))

# Display the result - a success should return status_code 201

# Display the full XML returned.

If the GET call is successful, it will return an HTTP status code of 201, along with an XML body containing tracking information about the mail pieces within the job:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <address>Awesome User,715 S Calhoun St,Fort Wayne,IN,46802</address>
      <dateTime>2021-12-22 20:32:02.0</dateTime>