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.
| Code | Name where read | Webhook controller found |
|---|---|---|
SHP | Shiprocket | Public, enqueues webhook_queue |
SHPINTL | Shiprocket international | Public route |
DLH | Delhivery | No |
BLD | Bluedart | No |
BLDINTL | Bluedart international | No |
FDX | FedEx | No |
DTDC | DTDC | No |
SHWY | Shipway | Public |
STP | Stamps | No |
PTR | Porter | No |
ITL | iThink Logistics | Public |
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
WarehouseCourierLocationrow (courierId_warehouseIdunique 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 with400 Bad Request(courier.error.pickupIdRequiredor 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.
| Partner | Resolved Field | Source |
|---|---|---|
Delhivery (DLH) | pickup_location | externalLocationId |
Shiprocket (SHP) | pickup_location | externalLocationId (pickup nickname) |
Shiprocket International (SHPINTL) | pickup_location_id (numeric) | externalLocationId |
Shipway (SHWY) | warehouse_id, return_warehouse_id | externalLocationId (sent as both; returns go to the pickup warehouse) |
iThink Logistics (ITL) | pickup_address_id, return_address_id | externalLocationId (sent as both; returns go to the pickup address) |
Blue Dart (BLD, BLDINTL) | OriginArea, CustomerCode; shipper and return address | externalLocationId; the account CustomerCode; the warehouse address |
| DTDC, Porter, FedEx, Stamps, Amazon Shipping | origin / pickup address | the 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 implementslistPickupLocations: 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 aspickupStale.
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 needcourier.supportsReverseandwhMapping.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.