API Integration

Shipping API Integration for Indian Ecommerce: The Complete Technical Guide

Manual shipping operations — copying tracking numbers, printing labels one-by-one, calling couriers to check status — waste 2–4 hours daily for every 100 orders processed. Shipping API integration automates all of this. This guide covers everything: courier APIs, aggregator APIs, webhook tracking, and platform-specific integrations.

Direct Courier API vs Aggregator API: Which to Integrate

Direct courier API integration means connecting individually to Delhivery's API, XpressBees' API, Ecom Express' API, etc. — each with its own authentication, endpoints, request/response format, error handling, and documentation quality. A full integration with 3 couriers takes 3–6 weeks of developer time and requires ongoing maintenance as each courier updates their API.

Aggregator API integration means connecting once to a platform like ApnaCourier that normalizes all courier APIs behind a single, consistent interface. One integration unlocks all connected couriers. The tradeoff: you lose access to courier-specific edge features, and you depend on the aggregator's uptime. For most Indian ecommerce businesses, aggregator API is the right choice — lower integration cost, faster time-to-market, and single maintenance burden.

  • Direct courier API: 1–2 weeks per courier integration; 3 couriers = 3–6 weeks developer time
  • Aggregator API: single integration unlocks all couriers; normalized schema; one maintenance burden
  • Direct API advantage: access to courier-specific features; no intermediary dependency
  • Aggregator API advantage: 10× faster integration; unified tracking and analytics; lower ops overhead
  • Recommendation: aggregator API for most businesses; direct for enterprise with dedicated tech teams

Core Shipping API Operations: Create, Track, Cancel

Every shipping API, whether direct or aggregator, supports three core operations: (1) Create Shipment — POST request with order details (weight, dimensions, addresses, COD/prepaid, declared value) returns AWB number and label data; (2) Track Shipment — GET request with AWB number returns current status and movement history; (3) Cancel Shipment — DELETE/POST request before pickup cancels the shipment and avoids charges.

Additional operations available in most APIs: Rate Check (get shipping cost before committing to courier), Serviceability Check (is this pincode serviceable?), NDR Update (provide buyer response to failed delivery), Bulk AWB Generation, and Manifest Generation (end-of-day pickup manifest). Always implement serviceability check at checkout to avoid creating undeliverable orders.

  • Create Shipment: POST with order details → returns AWB + label PDF/ZPL
  • Track Shipment: GET with AWB → returns status history array with timestamps
  • Cancel Shipment: before pickup only — after pickup incurs return charges
  • Rate Check: test rate before creating shipment — allows dynamic rate display at checkout
  • Serviceability Check: validate pincode before order confirmation — prevents undeliverable orders

Webhook Integration for Real-Time Tracking Updates

Polling tracking status (checking every 15 minutes via GET request) is inefficient — it generates unnecessary API calls and introduces latency. Webhooks are the modern standard: the courier or aggregator pushes status updates to your endpoint when something changes. You receive tracking events — Picked Up, In Transit, Out for Delivery, Delivered, Undelivered — as HTTP POST requests to your configured webhook URL.

Webhook implementation: register your webhook URL in the courier/aggregator dashboard, set up an HTTP POST handler at that URL that receives the tracking event payload, authenticate the webhook (verify shared secret in request header), process the event (update order status, trigger customer notification, log for analytics), and return HTTP 200 within 30 seconds to acknowledge receipt. Use a queue (AWS SQS, Redis) between your webhook receiver and processing logic to handle traffic spikes.

  • Webhooks push tracking events to your URL — no polling needed; events in real time
  • Standard tracking events: Picked Up, In Transit, Out for Delivery, Delivered, Undelivered/NDR
  • Webhook security: verify shared secret in request header before processing
  • Always return HTTP 200 within 30 seconds — otherwise courier/aggregator will retry
  • Use queue (Redis/SQS) between receiver and processor — handles traffic spikes safely

Label Generation and Printing at Scale

Shipping labels come in two formats: PDF (standard, printable on any printer) and ZPL (Zebra Programming Language, for thermal label printers). For volume above 100 labels/day, thermal label printers (Zebra GK420d or TSC DA210 at ₹8,000–₹15,000) pay for themselves in time savings within a month. Below 100 labels/day, PDF printing on A4 paper cut to size is sufficient.

Bulk label generation via API: submit an array of order objects in a single POST request, receive an array of AWBs and a merged PDF or ZIP of individual label files. Most aggregator APIs support bulk label generation of 50–500 shipments per request. For very high volumes (2,000+ labels/day), use asynchronous bulk generation: submit the request, receive a job ID, poll for completion, then download the label file. This prevents API timeout on large batches.

  • Label formats: PDF (universal) and ZPL (thermal printers — faster for high volume)
  • Thermal printer ROI: above 100 labels/day, thermal printer pays back in under 1 month
  • Bulk API: submit array of orders → receive array of AWBs + merged label PDF in one request
  • Async bulk generation for 2,000+ labels: submit → get job ID → poll for completion → download
  • ZPL label printers: Zebra GK420d (₹8,000–₹10,000) or TSC DA210 (₹6,000–₹8,000)

Integrating Shipping APIs with Shopify and WooCommerce

Shopify integration options: (1) ApnaCourier Shopify app — one-click install, auto-syncs orders, generates labels from Shopify admin, pushes tracking back to order; (2) Custom API integration via Shopify's Order webhook + carrier service API — more flexibility but requires developer setup; (3) Shopify Shipping (Shopify's native solution) — limited to international carriers, not useful for Indian domestic shipping.

WooCommerce integration: ApnaCourier WooCommerce plugin auto-syncs orders, generates labels in bulk, and updates tracking numbers on WooCommerce orders. For custom WooCommerce setups with non-standard order flows, use the REST API: subscribe to WooCommerce order.created webhooks, call ApnaCourier API to create shipment, write back AWB and tracking URL to WooCommerce order meta. Total developer time for clean custom WooCommerce integration: 2–4 days.

  • Shopify: use ApnaCourier app (zero-code) or custom Carrier Service API (developer needed)
  • WooCommerce: use ApnaCourier plugin (zero-code) or order webhook + REST API (2–4 days dev)
  • Auto-sync: orders created in Shopify/WooCommerce auto-appear in ApnaCourier — no manual entry
  • Tracking write-back: AWB and tracking URL push automatically back to Shopify/WooCommerce order
  • Custom platforms: use REST API with webhook for order creation events → create shipment → write back

Frequently Asked Questions

Start Shipping Smarter Today

Join thousands of Indian businesses using ApnaCourier to save time and money on logistics.

View Pricing