TraceNow API - Package Tracking


Welcome to TraceNow API

Track any package and shipment globally with the TraceNow API. This API allows you to initiate a tracking request and retrieve tracking results.

Step 1: Initiate Tracking Request

To initiate the tracking process, make a POST request to the /shipments/tracking endpoint. You'll receive a unique UUID identifying your tracking request.

The following is an example of how to make this request using cURL:

curl --location --request POST 'https://traceNowapi.com/api/v3/shipments/tracking' \
--header 'Content-Type: application/json' \
--data-raw '{
 "shipments": [
  {
   "trackingId": "EE10021942088880001030003D0N",
   "destinationCountry": "Canada"
  }
 ],
 "language": "en",
 "apiKey": ""
}'
            

You will receive a response containing the UUID for your tracking request.

Step 2: Retrieve Tracking Information

After initiating the tracking request, make a GET request to /shipments/tracking with the UUID you received from Step 1. Keep calling this endpoint until you receive the tracking results.

Here’s an example of how to make the GET request using cURL:

curl --location --request GET 'https://traceNowapi.com/api/v3/shipments/tracking?uuid=&apiKey=' \
--header 'Accept: application/json'
            

The response will provide details about the shipment such as its status, weight, origin, and destination.

Node.js Example

Here is an example of how to initiate a tracking request and check the tracking status using Node.js and the Axios library:

var axios = require('axios');
var data = JSON.stringify({
 "shipments": [
  {
   "trackingId": "EE10021942088880001030003D0N",
   "destinationCountry": "Canada"
  }
 ],
 "language": "en",
 "apiKey": ""
});

var config = {
  method: 'post',
  url: 'https://traceNowapi.com/api/v3/shipments/tracking',
  headers: { 
   'Content-Type': 'application/json'
  },
  data: data
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });
            

Once you receive the UUID from the tracking request, you can check the status with a GET request using the UUID.

Python Example

Here is an example of how to initiate a tracking request and check the tracking status using Python and the requests library:

import requests
import json
import time

apiKey = 'your_api_key_here'
trackingUrl = 'https://traceNowapi.com/api/v3/shipments/tracking'
shipments = [{'trackingId': 'tracking_number_1', 'language': 'en', 'country': 'United States'},
             {'trackingId': 'tracking_number_2', 'language': 'en', 'country': 'Canada'}]

# Initiate tracking request
response = requests.post(trackingUrl, json={'apiKey': apiKey, 'shipments': shipments})

if response.status_code == 200:
    # Get UUID from response
    uuid = response.json()['uuid']
    # Function to check tracking status with UUID
    def check_tracking_status():
        response = requests.get(trackingUrl, params={'apiKey': apiKey, 'uuid': uuid})
        if response.status_code == 200:
            if response.json()['done']:
                print('Tracking complete')
            else:
                print('Tracking in progress...')
                time.sleep(10)  # Sleep for 10 seconds before checking again
                check_tracking_status()
        else:
            print(response.text)
    check_tracking_status()
else:
    print(response.text)
            

This example demonstrates how to initiate the tracking request and poll the tracking status until the process is complete.