Skip to main content

Orders

client.orders

create(shipments)

Create one or more shipments. Supports both Prepaid and COD payment modes, single and multi-piece shipments.

Shipment fields

FieldTypeRequiredDescription
client_order_idstringYesYour unique order identifier
orderstringYesOrder date (YYYY-MM-DD)
pickup_locationstringYesWarehouse name (must exist in your account)
payment_mode"Prepaid" | "COD" | "Pickup"YesPayment mode
total_amountnumberYesInvoice value
weightnumberYesWeight in kg
namestringYesCustomer name
phonestringYesCustomer phone
addstringYesDelivery address line 1
citystringYesDelivery city
statestringYesDelivery state
pinstringYesDelivery pincode
countrystringYesDelivery country
cod_amountnumberCOD onlyAmount to collect at delivery
waybillstringNoLeave empty to auto-assign
length / breadth / heightnumberNoDimensions in cm
invoicestringNoInvoice number
e_way_bill_nostringNoE-waybill number
shipment_itemsShipmentItem[]NoLine-item breakdown

Returns

Promise<CreateOrderResponse>

{
packages: [
{
waybill: "1234567890",
client_order_id: "ORDER-001",
status: "Success",
remarks: null,
}
]
}

Example

const response = await client.orders.create([
{
client_order_id: "ORDER-001",
order: "2024-06-01",
pickup_location: "Mumbai Warehouse",
payment_mode: "Prepaid",
total_amount: 999,
weight: 0.5,
name: "Rahul Sharma",
phone: "9876543210",
add: "123, MG Road",
city: "Bengaluru",
state: "Karnataka",
pin: "560001",
country: "India",
},
]);

const waybill = response.packages[0]?.waybill;
console.log("Created waybill:", waybill);

update(shipments)

Update fields on existing shipments. Only pass the fields you want to change.

Example

await client.orders.update([
{
waybill: "1234567890",
name: "Rahul Kumar",
phone: "9999999999",
pin: "400001",
},
]);

cancel(waybills)

Cancel one or more shipments by waybill number.

Example

const results = await client.orders.cancel(["1234567890", "9876543210"]);

for (const r of results) {
console.log(r.waybill, r.status); // "1234567890" "Success"
}

updateEWaybill(params)

Attach or update the GST e-waybill number on a shipment.

Example

await client.orders.updateEWaybill({
waybill: "1234567890",
e_way_bill_no: "EWB1234567890",
});