Save Draft Order
The Save Draft Order API Route will save a single forward shipment in Openleaf. It does not create the order.
You have to pass all the required Field at the minimum to create an order. You can add additional parameters as per your preference.
Request
POST REQUEST
https://api.openleaf.tech/api/v1/order/saveDraftOrder
| Field | Required | Data Type | Description |
|---|---|---|---|
| customer_name | Yes | String | Name of Consignee |
| customer_address_line1 | Yes | String | Address Line 1 of Consignee |
| customer_address_line2 | No | String | Address Line 2 of Consignee |
| customer_phone | Yes | Integer | Mobile No of consignee |
| customer_alternate_phone | No | Integer | Alternate Mobile No of consignee |
| customer_pincode | Yes | Integer | Pincode of consignee |
| customer_city | Yes | String | City of consignee |
| customer_state | Yes | String | State of consignee |
| customer_country | Yes | String | Country of consignee |
| customer_email | No | String | Email of consignee |
| order_id | Yes | String | Unique ID for the order |
| order_created_time | Yes | String | Date & Time of Order Creation (ISO Format) |
| pickup_location | Yes | String | Pickup Location Name |
| order_type | Yes | String | COD/PREPAID |
| order_mode | Yes | String | SURFACE/EXPRESS |
| order_items | Yes | Array | JSON Array with multiple objects containing info of the order items |
| order_items[i].sku_name | Yes | String | SKU name of item |
| order_items[i].sku | Yes | String | SKU Number of item |
| order_items[i].sku_mrp | Yes | String | Price (MRP) of one unit |
| order_items[i].quantity | Yes | Integer | Number of units |
| order_items[i].product_image | No | String | URL of the product image |
| order_items[i].weight | No | String | Weight of the product |
| invoice_value | Yes | Decimal | Invoice Value |
| invoice_number | No | String | Invoice Number |
| cod_amount | No | Integer | Cash on Delivery amount |
| reference_number | No | String | Reference Number |
| dimensions | Yes | Object | Dimensions of courier |
| dimensions.length | Yes | Integer | Length in cm |
| dimensions.breadth | Yes | Integer | Breadth in cm |
| dimensions.height | Yes | Integer | Height in cm |
| dimensions.weight | Yes | Integer | Weight in gm |
| marketplace | No | String | Marketplace where the item was sold |
| order_note | No | String | Note for shipping label |
| seller_gstin | No | String | GST No of seller |
| taxable_value | No | String | taxable amount for GST |
| tax_percentage | No | String | tax percentage |
| ewaybill_serial_number | No | String | E-waybill Number |
| hsn_code | No | String | HSN code of the product |
| is_seller_registered_under_gst | No | String | GST Registration status of the seller |
| place_of_supply | No | String | Place of supply of service |
| gst_total_tax | No | Decimal | Total GST for the order |
| sgst_tax_rate | No | Integer | SGST Tax Rate for the order |
| sgst_amount | No | Decimal | SGST Value for the order |
| igst_tax_rate | No | Integer | IGST Tax Rate for the order |
| igst_amount | No | Decimal | IGST Value for the order |
| cgst_tax_rate | No | Integer | CGST Tax Rate for the order |
| cgst_amount | No | Decimal | CGST Value for the order |
| consignee_gstin | No | String | GST 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
| Field | Data Type | Description |
|---|---|---|
| status | Object | Object containing the status of the request |
| status.message | String | Message containing the outcome of the request |
| status.status_code | Integer | Status Code of request
|
| status.success | String | If the response is successful then true else false |
| result | Object | Object containing the data of the created order |
| result.ol_order_id | String | Openleaf Order ID |
Successful Response Example
{
"status": {
"message": "Order Has Been saved",
"status_code": 200,
"success": true
},
"result": {
"ol_order_id": "948b6fb1-5e50-40d1-928b-d811d48bc7ab",
}
}
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/createOrder' \
--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",
"validation_key": "560fee51-1af3-4d1d-a6e8-0149b0868d38",
}
}