Create Order
This endpoint allows you to create a new shipment order in the Gratero system. This page provides details on how to use this endpoint, including the request method, endpoint URLs for both test and production environments, and example request and response data.
POST
https://sandbox.gratero.com/v1/create-order
As of now, QC feature is not available for reverse orders from API.
Parameters
To create a order, ensure all the required parameters are included. Additional parameters can be added based on your needs.
Note: Make sure to provide the correct calculated total_amount
, as the API does not automatically compute the total.
Params | Type | Mandatory | Description |
---|---|---|---|
order_id | string | Yes | Specify the order ID for your order |
order_date | string | Yes | Date of order purchase(format YYYY-MM-DD). Must be within the last 7 days |
name | string | Yes | Full name of customer |
mobile | string | Yes | Customer mobile number |
alt_mobile | string | No | Customer alternate mobile number |
company_name | string | No | Customer company name |
string | No | Valid email address of customer | |
address_line_1 | string | Yes | Address details of customer |
address_line_2 | string | No | Further address details of customer |
city | string | Yes | Address city of customer |
state | string | Yes | Address state of customer |
pincode | integer | Yes | Pincode of customer address. Must be 6 digits |
products | array | Yes | List of products in the form of Array. Maximum 10 products allowed |
package_length | integer | Yes | Length of shipment in cms. Must be more than 1 |
package_breadth | integer | Yes | Breadth of shipment in cms. Must be more than 1 |
package_height | integer | Yes | Height of shipment in cms. Must be more than 1 |
package_weight | integer | Yes | Weight of shipment in kgs |
payment_mode | string | Yes | Payment method of shipment (cod or prepaid). cod is default |
discount | integer | No | Payment method of shipment (cod or prepaid). cod is default |
shipping_charge | integer | No | Shipping charges in rupee |
transaction_charge | integer | No | Transaction charges in rupee |
giftwrap_charge | integer | No | Giftwrap charges in rupee |
total_amount | integer | Yes | Total amount of order |
warehouse_id | integer | Yes | Warehouse ID (Pickup location) created in gratero system. If not given primary warehouse considered |
logistic_id | integer | Yes | The logistic id of courier you want to select |
ewaybill_no | string | No | Eway bill no of shipment. If shipment amount is greater than or equal to Rs. 50,000 |
delivery_remarks | string | No | Any comments or remarks about shipment |
New orders cannot be created using the same order IDs as cancelled orders.
JSON
"products": [
{
"product_name": "Books",
"price": 240,
"quantity": 2,
"sku": "SKU0000225",
"tax": 0,
"discount": 80
},
{
"product_name": "Another book",
"price": 400,
"quantity": 1,
"sku": "SKU000028",
"tax": 0,
"discount": 40
}
]
Find below logistics along with their IDs:
Logistic ID | Logistic |
---|---|
1 | Delhivery |
2 | Xpressbees |
3 | Ecom Express |
4 | DTDC |
Example
Request
JSON
{
"order_date": "2024-12-15",
"order_id": "GTR-0010",
"order_type": "forward",
"name": "Raghav Bansal",
"mobile": "9876543210",
"alt_mobile": "",
"email": "",
"company_name": "Acme Corp",
"gst_number": "GST123456789",
"address_line_1": "123, 1st Floor",
"address_line_2": "Main Road",
"city": "Jaipur",
"state": "Rajasthan",
"pincode": "302020",
"products": [
{
"product_name": "Books",
"price": 240,
"quantity": 2,
"sku": "SKU0000225",
"tax": 0,
"discount": 80
},
{
"product_name": "Another book",
"price": 400,
"quantity": 1,
"sku": "SKU000028",
"tax": 0,
"discount": 40
}
],
"package_length": 10,
"package_breadth": 5,
"package_height": 2,
"package_weight": 1.2,
"payment_mode": "prepaid",
"discount": 120,
"total_price": 660,
"warehouse_id": 26,
"logistic_id": 2
}
Response
JSON
{
"success": true,
"id": 7326,
"order_id": "GTR-0010",
"awb": "89218773627",
"logistic": "Delhivery",
"additional_info": "LKO/JAI",
"tracking_url": "https://gratero.com/track/89218773627",
"message": "Order created in system"
}
Code
import { Instance } from "gratero";
const gratero = new Instance({
api_key: "YOUR_API_KEY",
secret_key: "YOUR_SECRET_KEY",
environment: 'test'
});
gratero.order.create({
order_id: "12345",
// other parameters
}).then(data => console.log(data))
.catch(error => console.log(error))