Skip to main content

Tracking

Fetch

You can retrieve one or many package tracking statuses passing the tracking numbers to the Tracking API.

import karrio
from karrio.core.models import TrackingRequest

request = TrackingRequest(...)

tracking_details_list, messages = karrio.Tracking.fetch(request).from_(carrier_gateway).parse()

Parameters

TrackingRequest

NameTypeDescription
tracking_numbersList[str]required
language_codestr
level_of_detailsstr

Response

TrackingDetails

NameTypeDescription
carrier_namestrrequired
carrier_idstrrequired
tracking_numberstrrequired
eventsList[TrackingEvent]required
deliveredbool

TrackingEvent

NameTypeDescription
datestrrequired
descriptionstrrequired
locationstr
codestr
timestr
signatorystr

Message

NameTypeDescription
carrier_namestrrequired
carrier_idstrrequired
messageUnion[str, Any]
codestr
detailsdict

Code sample

import karrio
from karrio.core.models import TrackingRequest

request = karrio.Tracking.fetch(
TrackingRequest(tracking_numbers=["1Z12345E6205277936"])
)

tracking_details_list, messages = request.from_(carrier_gateway).parse()
On success
print(tracking_details_list)
# [
# TrackingDetails(
# carrier_name="canadapost",
# carrier_id="canadapost",
# tracking_number="7023210039414604",
# events=[
# TrackingEvent(
# date="2011-04-04",
# description="Order information received by Canada Post",
# location="",
# code="INDUCTION",
# time="13:34",
# signatory="",
# )
# ],
# delivered=None,
# )
# ]