Skip to main content

Shipping

client.shipping

calculateCost(params)

Get an estimated shipping charge between two pincodes.

Parameters

NameTypeRequiredDescription
origin_pinstringYesPickup pincode
destination_pinstringYesDelivery pincode
payment_mode"Prepaid" | "COD" | "Pickup"YesPayment mode
weightnumberYesWeight in kg
length / breadth / heightnumberNoVolumetric dimensions in cm
cod_amountnumberCOD onlyAmount to collect

Example

const cost = await client.shipping.calculateCost({
origin_pin: "400001",
destination_pin: "110001",
payment_mode: "COD",
weight: 1.5,
cod_amount: 599,
});

console.log("Total charge:", cost.total_amount);
console.log("COD fee:", cost.cod_charge);

fetchWaybills(count)

Pre-fetch waybill numbers to use in shipment creation. count must be 1–100.

const { waybill_list } = await client.shipping.fetchWaybills(10);
// ["1000001", "1000002", ...]

generateLabel(params)

Generate a shipping label PDF. Returns the raw ArrayBuffer — write it to a file or stream it.

import { writeFileSync } from "fs";

const pdf = await client.shipping.generateLabel({
waybill: "1234567890,9876543210", // comma-separated for bulk
});

writeFileSync("label.pdf", Buffer.from(pdf));

schedulePickup(params)

Schedule a courier pickup from a warehouse.

Parameters

NameTypeRequiredDescription
pickup_datestringYesPickup date (YYYY-MM-DD)
expected_package_quantitynumberYesExpected parcel count
client_warehouse_codestringNoWarehouse name/code
waybill_liststring[]NoSpecific waybills to pick up

Example

const result = await client.shipping.schedulePickup({
pickup_date: "2024-06-10",
expected_package_quantity: 5,
client_warehouse_code: "Mumbai Warehouse",
});

console.log("Scheduled pickup ID:", result.pickup_id);