Skip to main content

Return Order

The Return Order API Route will create a single reverse shipment in Openleaf.

You have to pass all the required Field at the minimum to create a return order. You can add additional parameters as per your preference.

Request

POST REQUEST
https://api.openleaf.tech/api/v1/order/returnOrder

FieldRequiredData TypeDescription
ol_order_id
  • No
  • Yes, if is_draft = true
BooleanUnique Openleaf order id received after saving the order.
customer_nameYesStringName of Consignee
customer_address_line1YesStringAddress Line 1 of Consignee
customer_address_line2NoStringAddress Line 2 of Consignee
customer_phoneYesIntegerMobile No of consignee
customer_alternate_phoneNoIntegerAlternate Mobile No of consignee
customer_pincodeYesIntegerPincode of consignee
customer_cityYesStringCity of consignee
customer_stateYesStringState of consignee
customer_countryYesStringCountry of consignee
customer_emailNoStringEmail of consignee
order_idYesStringUnique ID for the order
order_created_timeYesStringDate & Time of Order Creation (ISO Format)
pickup_locationYesStringPickup Location Name
order_typeYesStringCOD/PREPAID
order_modeYesStringSURFACE/EXPRESS
order_itemsYesArrayJSON Array with multiple objects containing info of the order items
order_items[i].sku_nameYesStringSKU name of item
order_items[i].skuYesStringSKU Number of item
order_items[i].sku_mrpYesStringPrice (MRP) of one unit
order_items[i].quantityYesIntegerNumber of units
order_items[i].product_imageNoStringURL of the product image
order_items[i].weightNoStringWeight of the product
invoice_valueYesDecimalInvoice Value
invoice_numberNoStringInvoice Number
cod_amountNoIntegerCash on Delivery amount
reference_numberNoStringReference Number
dimensionsYesObjectDimensions of courier
dimensions.lengthYesIntegerLength in cm
dimensions.breadthYesIntegerBreadth in cm
dimensions.heightYesIntegerHeight in cm
dimensions.weightYesIntegerWeight in gm
marketplaceNoStringMarketplace where the item was sold
order_noteNoStringNote for shipping label
seller_gstinNoStringGST No of seller
taxable_valueNoStringtaxable amount for GST
tax_percentageNoStringtax percentage
ewaybill_serial_numberNoStringE-waybill Number
hsn_codeNoStringHSN code of the product
is_seller_registered_under_gstNoStringGST Registration status of the seller
place_of_supplyNoStringPlace of supply of service
gst_total_taxNoDecimalTotal GST for the order
sgst_tax_rateNoIntegerSGST Tax Rate for the order
sgst_amountNoDecimalSGST Value for the order
igst_tax_rateNoIntegerIGST Tax Rate for the order
igst_amountNoDecimalIGST Value for the order
cgst_tax_rateNoIntegerCGST Tax Rate for the order
cgst_amountNoDecimalCGST Value for the order
consignee_gstinNoStringGST No of consignee
Header Example
{
"Authorization": "Bearer {{your_token}}",
"Content-Type": "application/json"
}
Request Example
{
"order_created_time": "2022-11-17T18:00:00+05:30",
"pickup_location": "Apple Warehouse",
"order_id": "OrderID0001",
"customer_name": "Steve Jobs",
"customer_address_line1": "Mumbai, 400014",
"customer_address_line2": "Maharashtra",
"customer_pincode": 411057,
"customer_city": "Pune",
"customer_state": "Maharashtra",
"customer_country": "India",
"customer_phone": 9998899988,
"customer_alternate_phone": 9998899988,
"order_items": [
{
"sku_name": "Protein Powder",
"sku_mrp": "599",
"quantity": 1,
"sku": "PP34A67",
"product_image": "https://openleaf-orders-bucket.s3.ap-south-1.amazonaws.com/business/openleaf_logo.png"
},
{
"sku_name": "Face Cream",
"sku_mrp": "299",
"quantity": 2,
"sku": "FC09A16",
"product_image": "https://openleaf-orders-bucket.s3.ap-south-1.amazonaws.com/business/openleaf_logo.png"
},
{
"sku_name": "Handwash",
"sku_mrp": "169",
"quantity": 2,
"sku": "HW69A37",
"product_image": "https://openleaf-orders-bucket.s3.ap-south-1.amazonaws.com/business/openleaf_logo.png"
}
],
"invoice_value": 1535,
"invoice_number": "example_invoice_no_123",
"reference_number": "example_ref_no_1234",
"dimensions": {
"length": 30,
"breadth": 30,
"height": 30,
"weight": 500
},
"marketplace": "Amazon",
"order_type": "PREPAID",
"order_mode": "SURFACE"
}

Response

FieldData TypeDescription
statusObjectObject containing the status of the request
status.messageStringMessage containing the outcome of the request
status.status_codeIntegerStatus Code of request
  • 200 if the request is successful
  • 400 if there is an error
status.successStringIf the response is successful then true else false
resultObjectObject containing the data of the created order
result.reference_noStringReference Number of the order
result.awb_noStringWaybill Number created by the Courier partner
result.ol_order_idStringOpenleaf Order ID
result.carrierStringThe Courier Partner which has been selected
result.shipping_label_urlStringShipping Label for the shipment
result.validation_keyStringKey to validate order in the future
Successful Response Example
{
"status": {
"message": "Order Placed Successfully",
"status_code": 200,
"success": true
},
"result": {
"reference_number": "example_ref_no_1234",
"awb_no": "19534810002520",
"ol_order_id": "948b6fb1-5e50-40d1-928b-d811d48bc7ab",
"carrier": "Blue Dart",
"shipping_label_url": "https://s3.ap-south-1.amazonaws.com/openleaf-order-bucket-03032022-42/shipping_label_77867556712.pdf",
"validation_key": "560fee51-1af3-4d1d-a6e8-0149b0868d38",
}
}
Error Response Example
{
"status": {
"message": "There was an error while creating the order",
"status_code": 500,
"success": false
}
}
IN CASE OF FAILURE

Please note, in case of any validation failure - order will not get created. Please wait for 10-15 seconds before you cancel the request for latency.

Example

Curl Command


curl --location --request POST 'https://api.openleaf.tech/api/v1/order/returnOrder' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{token}}' \
--data-raw '{
"order_created_time": "2022-11-17T18:00:00+05:30",
"pickup_location": "Apple Warehouse",
"order_id": "OrderID0001",
"customer_name": "Steve Jobs",
"customer_address_line1": "Mumbai, 400014",
"customer_address_line2": "Maharashtra",
"customer_pincode": 411057,
"customer_city": "Pune",
"customer_state": "Maharashtra",
"customer_country": "India",
"customer_phone": 9998899988,
"customer_alternate_phone": 9998899988,
"order_items": [
{
"sku_name": "Protein Powder",
"sku_mrp": "599",
"quantity": 1,
"sku": "PP34A67",
"product_image": "https://openleaf-orders-bucket.s3.ap-south-1.amazonaws.com/business/openleaf_logo.png"
},
{
"sku_name": "Face Cream",
"sku_mrp": "299",
"quantity": 2,
"sku": "FC09A16",
"product_image": "https://openleaf-orders-bucket.s3.ap-south-1.amazonaws.com/business/openleaf_logo.png"
},
{
"sku_name": "Handwash",
"sku_mrp": "169",
"quantity": 2,
"sku": "HW69A37",
"product_image": "https://openleaf-orders-bucket.s3.ap-south-1.amazonaws.com/business/openleaf_logo.png"
}
],
"invoice_value": 1535,
"invoice_number": "example_invoice_no_123",
"reference_number": "example_ref_no_1234",
"dimensions": {
"length": 30,
"breadth": 30,
"height": 30,
"weight": 500
},
"marketplace": "Amazon",
"order_type": "PREPAID",
"order_mode": "SURFACE",
"invoice_reference": "example_invoice_no_123"
}'

Output:

{
"status": {
"message": "Order Placed Successfully",
"status_code": 200,
"success": true
},
"result": {
"reference_number": "example_ref_no_1234",
"awb_no": "19534810002520",
"ol_order_id": "948b6fb1-5e50-40d1-928b-d811d48bc7ab",
"carrier": "Blue Dart",
"shipping_label_url": "https://s3.ap-south-1.amazonaws.com/openleaf-order-bucket-03032022-42/shipping_label_77867556712.pdf",
"validation_key": "560fee51-1af3-4d1d-a6e8-0149b0868d38",
}
}