Skip to main content

Couriers

Purpose​

Buy labels, cancel waybills, and track shipments. Master data (Courier) is separate from the HTTP strategy.

Contract​

integrationCode, ship, cancel, track. IntegrationAutoRegistrationService discovers strategies by those members.

CodeName where readWebhook controller found
SHPShiprocketPublic, enqueues webhook_queue
SHPINTLShiprocket internationalPublic route
DLHDelhiveryNo
BLDBluedartNo
BLDINTLBluedart internationalNo
FDXFedExNo
DTDCDTDCNo
SHWYShipwayPublic
STPStampsNo
PTRPorterNo
ITLiThink LogisticsPublic

Seed codes without a strategy class: NIP, PIK, SHYP, ARMX, AMZ.

Pickup Location Resolution (Strict Warehouse-Centric)​

Pickups are collected from the warehouse that packed the parcel:

  • Courier accounts do not store pickup locations. Courier config supplies only account-level details (customer codes, GST number, contact names); never a pickup address, area or coordinates.
  • Each warehouse–courier relationship is a WarehouseCourierLocation row (courierId_warehouseId unique key).
  • Couriers that book by a pickup id read it from the active mapping when ship() runs. If it is missing or paused, the booking fails with 400 Bad Request (courier.error.pickupIdRequired or the partner's own message).
  • Couriers that book by address send the warehouse's dispatch address; Porter also needs the warehouse's own coordinates.
  • PointNXT never creates or edits a pickup location in a courier account. Pickups are set up there; PointNXT reads them where the courier's API allows.
PartnerResolved FieldSource
Delhivery (DLH)pickup_locationexternalLocationId
Shiprocket (SHP)pickup_locationexternalLocationId (pickup nickname)
Shiprocket International (SHPINTL)pickup_location_id (numeric)externalLocationId
Shipway (SHWY)warehouse_id, return_warehouse_idexternalLocationId (sent as both; returns go to the pickup warehouse)
iThink Logistics (ITL)pickup_address_id, return_address_idexternalLocationId (sent as both; returns go to the pickup address)
Blue Dart (BLD, BLDINTL)OriginArea, CustomerCode; shipper and return addressexternalLocationId; the account CustomerCode; the warehouse address
DTDC, Porter, FedEx, Stamps, Amazon Shippingorigin / pickup addressthe warehouse dispatch address

The pickup id each courier needs (label, numeric, extra settings) is declared in src/common/integrations/courier-pickup.ts; test/integrations/courier-pickup.contract.spec.ts keeps it in step with the strategies.

Pickup lookup endpoints​

  • GET /v1/operations/courier/:id/pickup-setup: how the courier identifies pickups (pickupId, null for address-only couriers) and whether it can list them (canList, true when the strategy implements listPickupLocations: Shiprocket, Shiprocket International and Shipway (getwarehouses) today).
  • GET /v1/operations/courier/:id/pickup-locations: the pickups registered in the courier account.
  • POST /v1/operations/courier/:id/pickup-locations/sync ({ warehouseId }): confirms a pickup matches the warehouse's dispatch address after it was updated in the courier account. A mapping whose warehouse address changed after it was last saved is reported as pickupStale.

Data flow​

Labels: fulfillment_queue / batch-labels. Tracking: poll every 3 hours, manual refresh, and webhooks where a controller exists. See Labels and Tracking.

For an aggregator account, GET /v1/operations/courier/:id/supported-carriers returns carrier choices for the shipping UI. A booking can send subCarrierId (or legacy shipType) to select the actual carrier, plus optional pickupDate and pickupTime. The UI requires a carrier choice for an aggregator when no rate selection already supplies one. Shipway fetches its carrier list from the partner API and uses a cached fallback list if that request fails; treat the fallback as a selection aid, not a live serviceability quote.

Courier Allocation at a Warehouse​

Courier allocation (CourierAllocationService) only offers a courier that can collect from the shipment's warehouse (courierAvailableAtWarehouse):

  • Once a warehouse has any courier set up, only couriers set up and active there are eligible.
  • A warehouse with none can use couriers that book from the warehouse address, never one that needs a pickup id it has not been given.
  • A courier chosen by hand, and a shipment created directly with a courier and no AWB, are held to the same rule (courier.error.notAvailableAtWarehouse). A shipment created with an AWB records a parcel booked elsewhere and is not.
  • Preference order: the warehouse's preferred courier (mapping isDefault), then the channel's, then the tenant's; otherwise the lowest live rate.
  • Direction: forward shipments need whMapping.supportsForward; return shipments need courier.supportsReverse and whMapping.supportsReverse. Return pickups are not booked through couriers today.

Retries​

Fulfillment queue default is 3 attempts, exponential 2 seconds, if the processor throws. Webhook queue is 8 attempts, exponential 5 seconds. There is no shared carrier HTTP retry policy beyond that. Shiprocket in particular has many local catch blocks.

Idempotency and recovery​

Unknown: rate limits per carrier, and whether a label that the courier accepted but PointNXT failed to store is reconciled automatically.

Signature coverage is not “all courier webhooks.” Check each controller.

Code​

src/integrations/shiprocket, shiprocket-intl, delhivery, bluedart, bluedart-intl, fedex, dtdc, shipway, stamps, porter, ithink-logistics.