Shipment Tracking API
π¦ Use Case: Track Shipment Status via Shiprocket API
π§© Scenario:
You're running an e-commerce store and want to allow customers (or your operations team) to track the status of shipments in real-time using AWB (Air Waybill) numbers.
β
Step-by-Step: Python + Shiprocket API
Step 1: π Get API Credentials
You need:
Email & password (used for token generation)
AWB number of a shipment (after creating order & generating label)
Step 2: π Authenticate and Get Token
import requests
# Shiprocket API Login
url = "https://apiv2.shiprocket.in/v1/external/auth/login"
payload = {
"email": "your_email@example.com",
"password": "your_password"
}
response = requests.post(url, json=payload)
token = response.json().get("token")
print("Access Token:", token)
Step 3: π Track Shipment via AWB Number
# Replace with actual AWB number
awb_number = "1234567890"
track_url = f"https://apiv2.shiprocket.in/v1/external/courier/track/awb/{awb_number}"
headers = {
"Authorization": f"Bearer {token}"
}
track_response = requests.get(track_url, headers=headers)
track_data = track_response.json()
# Display current shipment status
print("Tracking Info:")
print(f"Current Status: {track_data['tracking_data']['shipment_track'][0]['current_status']}")
print(f"Delivered Date: {track_data['tracking_data']['shipment_track'][0]['delivered_date']}")
π― Output Example
Tracking Info:
Current Status: In Transit
Delivered Date: None
π§ Real Business Applications
π Purpose
β
Benefit
Customer shipment tracking
Reduce customer queries
Internal order monitoring
Optimize support + delivery timelines
Automate delivery status
Trigger alerts or emails on status change
π Bonus: Other Shiprocket API Functions
Feature
Endpoint
Create Order
/v1/external/orders/create/adhoc
Generate AWB
/v1/external/courier/assign/awb
Get Courier Service
/v1/external/courier/serviceability
Pickup Request
/v1/external/pickups
Shipment Label
/v1/external/courier/generate/pickup
(PDF URL for shipping label)
Last updated
Was this helpful?