Shipment Tracking API

The Shipments API provides comprehensive access to outbound shipment information for orders that have been fulfilled and shipped from MasonHub distribution centers. Track packages, manage customer notifications, and analyze shipping performance.

Shipment information is automatically created when orders are fulfilled. Use callbacks for real-time shipping notifications.

Core Operations

Get Shipments

Retrieve detailed shipment information for fulfilled orders.

id
array

MasonHub shipment UUIDs (1-30 items)

coid
array

Customer order IDs (1-30 items)

sdt
string

Start date/time (RFC3339 format)

edt
string

End date/time (RFC3339 format)

offset
integer
default:
"0"

Pagination offset

limit
integer
default:
"30"

Number of results (1-100)

list_type
string
default:
"detail"

Response format: “detail” or “summary”

Query Parameters

ParameterTypeDescriptionDefault
idarray of UUIDsMasonHub shipment UUIDs [1..30]-
coidarray of stringsCustomer order IDs [1..30]-
sdtstringStart date/time (RFC3339)-
edtstringEnd date/time (RFC3339)-
offsetintegerPagination offset0
limitintegerNumber of results [1..100]30

Shipment Data Structure

Core Fields

Identification

id: MasonHub internal UUID

shipment_id: Human-readable identifier

customer_order_id: Your order reference

Carrier Information

shipping_provider: UPS, USPS, FedEx, etc.

shipper_service_level: ground, priority, express

tracking_number: Carrier tracking number

Timing

shipment_date_time: Actual ship time

estimated_delivery: Carrier estimate

actual_delivery: Confirmed delivery

Contents

shipment_line_items: Items in package

package_details: Weight & dimensions

special_handling: Handling requirements

Line Item Details

Each shipment contains detailed line item information:

{
  "shipment_line_items": [
    {
      "sku_customer_id": "shirts872340",
      "quantity": 2
    },
    {
      "sku_customer_id": "pants3422",
      "quantity": 1
    }
  ]
}

Multi-Shipment Orders

Orders frequently ship in multiple packages due to:

1

Size Constraints

Items too large for single package

2

Geographic Distribution

Items shipping from different distribution centers

3

Inventory Availability

Partial availability requiring sequential shipments

4

Business Rules

Customer preferences or shipping policies

Multi-Shipment Example

Carrier Integration

Supported Carriers

UPS

Services: Ground, Air, International

Tracking: Real-time updates

URL Pattern: ups.com/tracking/{number}

USPS

Services: Priority, Express, Ground

Tracking: Standard updates

URL Pattern: usps.gov/tracking/{number}

FedEx

Services: Express, Ground, International

Tracking: Real-time updates

URL Pattern: fedex.com/track/{number}

Tracking URLs

MasonHub provides direct tracking URLs for immediate customer access:

{
  "tracking_number": "1z324897234nferg45",
  "tracking_url": "http://ups.com/tracking/1z324897234nferg45",
  "mobile_tracking_url": "http://m.ups.com/tracking/1z324897234nferg45",
  "carrier_app_link": "ups://track/1z324897234nferg45"
}

Event Integration

Order Fulfillment Callbacks

Receive orderEvent callbacks when orders ship:

Delivery Confirmation

Some carriers provide delivery confirmation callbacks:

{
  "callback_url": "https://client.com/api/delivery_event",
  "message_type": "deliveryEvent",
  "message_id": "f79881fe-e65c-48g1-d82c-590c1d97cgcg",
  "data": {
    "shipment_id": "88888",
    "tracking_number": "1z324897234nferg45",
    "delivery_status": "delivered",
    "delivery_date_time": "2018-08-09T14:32:00Z",
    "delivery_location": "Front Door",
    "signature_required": false,
    "signed_by": null
  }
}

Customer Notifications

Shipping Confirmation

Use shipment data to create comprehensive shipping notifications:

<h2>Your Order Has Shipped!</h2>
<p>Order #{{customer_order_id}} has been shipped via {{shipping_provider}}.</p>

<h3>Tracking Information</h3>
<p>Tracking Number: <strong>{{tracking_number}}</strong></p>
<p><a href="{{tracking_url}}">Track Your Package</a></p>

<h3>Shipped Items</h3>
{{#each shipment_line_items}}
<p>{{sku_customer_id}} - Quantity: {{quantity}}</p>
{{/each}}

<p>Estimated Delivery: {{estimated_delivery}}</p>

Analytics & Reporting

Shipping Metrics

Track key performance indicators:

Sample Analytics Query

// Analyze shipping performance by carrier
function analyzeCarrierPerformance(shipments) {
  const carrierStats = {};
  
  shipments.forEach(shipment => {
    const carrier = shipment.shipping_provider;
    
    if (!carrierStats[carrier]) {
      carrierStats[carrier] = {
        totalShipments: 0,
        onTimeDeliveries: 0,
        averageTransitTime: 0
      };
    }
    
    carrierStats[carrier].totalShipments++;
    
    // Calculate on-time delivery
    if (shipment.actual_delivery <= shipment.estimated_delivery) {
      carrierStats[carrier].onTimeDeliveries++;
    }
  });
  
  return carrierStats;
}

Advanced Features

Package Optimization

Smart Packaging

Automatic package size selection based on item dimensions and shipping rules

Consolidation

Intelligent order consolidation to minimize shipment count

Split Optimization

Optimal splitting when consolidation isn’t possible

Cost Optimization

Automatic carrier and service level selection for cost efficiency

Special Handling

Track special handling requirements:

{
  "special_handling": {
    "fragile": true,
    "signature_required": true,
    "adult_signature": false,
    "delivery_confirmation": true,
    "insurance_value": 500.00,
    "temperature_controlled": false
  }
}

Best Practices

Real-time Updates

Use orderEvent callbacks for immediate shipment notifications rather than polling

Multi-shipment Handling

Always design systems to handle multiple shipments per order

Customer Communication

Provide proactive shipping updates and tracking information

Error Handling

Handle cases where tracking information may not be immediately available

Integration Tips

  1. Callback Processing: Design fast callback handlers for shipment events
  2. Data Storage: Store shipment data for customer service and analytics
  3. Tracking Integration: Provide direct tracking links in customer communications
  4. Mobile Optimization: Ensure tracking links work well on mobile devices

Error Handling

Common scenarios and solutions:

Next Steps

After implementing shipment tracking, explore: