Trackers
Create Trackers
Trackers serve two primary purposes in the PackageX platform: automatically tracking shipments generated within the platform and monitoring third-party shipments.
For tracking third-party shipments, you'll need to provide a tracking number. Including the provider ID is recommended as it optimizes tracking initiation. Without a provider ID, the system will attempt to identify the provider based on the tracking number pattern.
For sandbox environment testing, use tracking numbers in this format:
PKGX-[STATUS_CODE]-[RANDOM]
STATUS_CODE
: Seven characters that determine the shipment's journey (e.g., AAAAAAA for standard delivery)RANDOM
: Seven alphanumeric characters (A-Z, 0-9)
Each status code triggers a specific delivery scenario, allowing you to test various outcomes from successful deliveries to different exception cases. For status codes and their behaviors, refer to the Testing Trackers section.
The sandbox environment automatically processes these test tracking numbers through realistic delivery progressions, complete with appropriate status updates and location changes, enabling comprehensive integration testing.
Testing Trackers
The sandbox environment provides a structured way to simulate and test various delivery scenarios using predefined tracking number patterns. Each pattern triggers a specific sequence of status updates, allowing you to test your system's handling of both successful deliveries and exception cases.
To test different scenarios, create tracking numbers using this format:
PKGX-[STATUS_CODE]-[RANDOM_STRING]
Create Tracker
Create a tracker by either providing a tracking number or an inference ID. The tracker can be configured with various options to control its behavior and status updates.
The tracker can be created in two ways:
- Using a tracking number: Provide the tracking number and optional configuration parameters
- Using an inference ID: Use an existing inference to create a tracker with additional options
Once the tracker has been created webhooks will be sent anytime the tracker is updated. In the testing environment, the tracker will update approximately once every two minutes.
Required fields:
Either tracking_number
or inference_id
Optional fields for tracking number-based creation:
- type - Tracker type
- tags - Array of string tags
- metadata - Custom JSON metadata
- manifest_id - Associated manifest identifier
- chained_status - Outstanding tracking status
- service_level_id - Service level Id
- recipient_contact_id - Recipient contact Id
- estimated_delivery_at - Estimated delivery timestamp
- auto_close_shipments_option - Option for automatically closing shipments
- auto_close_shipments_status - Status for auto-closing shipments
Optional fields for inference-based creation:
- type - Tracker type
- metadata - Custom JSON metadata
- options - Configuration options for the tracker and transformations
- tracking_update - Additional tracking update information
The API returns a tracker object in the response data field upon successful creation (status code: 201).
Update Tracker
Update a tracker's metadata, destination information, chaining configuration, and other properties. The endpoint supports modifying location data, contact information, and shipment chaining. While you don't have permission to modify trackers created by other providers, all users can add, update, or delete metadata on the resource.
The endpoint allows you to update various aspects of a tracker:
- Metadata - Add or update custom metadata fields
- Location Information - Update location, layout, and address details
- Contact Information - Set destination and sender contacts
- Tracker Configuration - Modify type, status, and auto-close options
- Shipment Chaining - Add or remove shipments from the tracker's chain
When updating chained shipments:
- Shipments being added must not already be in the tracker
- Shipments being removed must exist in the tracker
- The current shipment must either be already chained or being added
- You can specify an index when adding a single shipment to position it within the chain
The API returns the updated tracker object in the response data field. Any modifications to the tracker will trigger appropriate webhook events to notify your systems of the changes.
Optional Parameters
When creating or updating a tracker, you can set the tracker type by defining the type
in the body of the request and setting it to inbound
or outbound