Skip to main content

Update Draft Order

Endpoint
POST /v1/draft_orders/:id

You can update the draft order as long as it is not confirmed using Confirm Draft Order API yet. With this you can change the courier information, user information, etc. This endpoints also necessary if you want to make the draft order to be ready to confirm if you don't specify the courier information during Create Draft Order.

API Parameters

shipper_contact_name string
OPTIONAL
The name of the shipper.

shipper_contact_phone string
OPTIONAL
The phone number of the shipper.

shipper_contact_email string
OPTIONAL
The email of the shipper.

shipper_organization string
OPTIONAL
The organization of the shipper.

origin_contact_name string
OPTIONAL
The name of the person in the pickup location.

origin_contact_phone string
OPTIONAL
The phone number of the person in the pickup location.

origin_contact_email string
OPTIONAL
The email of the person in the pickup location.

origin_address string
OPTIONAL
Complete address of the pickup location.

origin_note string
OPTIONAL
Additional information of the pickup location to ease pickup process.

origin_postal_code number
OPTIONAL
Postal code of the pickup location.

origin_coordinate object
OPTIONAL
Coordinates of the pickup location. If you use an instant courier, you must use coordinate.
Show child parameters
origin_coordinate.latitude double
OPTIONAL
Latitude of the pickup location.

origin_coordinate.longitude double
OPTIONAL
Longitude of the pickup location.


origin_collection_method string
OPTIONAL
Use the available_collection_method from Rates API. Value can be pickup, or drop_off. Default to pickup.
pickup your package will be picked by courier based on origin that you specify.
drop_off you must drop off the package to the nearest courier agent.

destination_contact_name string
OPTIONAL
The name of the person in destination location.

destination_contact_phone string
OPTIONAL
The phone number of the person in destination location.

destination_contact_email string
OPTIONAL
The email of the person in destination location.

destination_address string
OPTIONAL
Complete address of the destination location.

destination_note string
OPTIONAL
Additional information of the destination location to ease destination process.

destination_postal_code number
OPTIONAL
Postal code of the destination location.

destination_coordinate object
OPTIONAL
Coordinates of the destination location. If you use an instant courier, you must use coordinate.
Show child parameters
destination_coordinate.latitude double
OPTIONAL
Latitude of the destination location.

destination_coordinate.longitude double
OPTIONAL
Longitude of the destination location.


destination_cash_on_delivery number
OPTIONAL
State the COD Amount if you want to activate COD delivery.

destination_cash_on_delivery_type string
OPTIONAL
The COD disbursement window. Value can be 7_days, 5_days, or 3_days.
7_days you will receiver your money 7 days after the item is delivered.
5_days you will receiver your money 5 days after the item is delivered.
3_days you will receiver your money 3 days after the item is delivered.

destination_proof_of_delivery boolean
OPTIONAL
Proof of delivery feature.

destination_proof_of_delivery_note string
OPTIONAL
Notes for proof of delivery. It is optionalif proof of delivery feature is activated.

courier_company string
OPTIONAL
Shipping provider that will be used for this particular shipment. List of available courier can be found using Couriers API.

courier_type string
OPTIONAL
Courier type based on the courier company used. Each type can be different for each company. Value of type can be found within the Rates API and Couriers API.

courier_insurance number
OPTIONAL
The amount of the insurance value. This is optionalif you want to insured your shipment. For example, if your item is valued at IDR 1.000.000, then you should put 1000000 for the value.

delivery_type string
OPTIONAL
Type of delivery order is now and scheduled.
now will generate waybill instantly and pickup right away.
scheduled will generate waybill instantly and pickup based on delivery date and delivery time.

delivery_date string
Optional
The delivery date format: “YYYY-MM-DD”

delivery_time string
Optional
The delivery time format: “HH:mm”

order_note string
OPTIONAL
Additional information for the shipment.

metadata object
OPTIONAL
You can insert any kind of data through this object for internal purposes.

reference_id string
OPTIONAL
You can insert your internal order id here. Must unique for each draft order id.

tags array
OPTIONAL
You can insert multiple custom tags (in string) for filtering your orders by tag later on.

items array
OPTIONAL
The list of item you will send for delivery
Show child parameters
items.name string
OPTIONAL
Name of your package.

items.description string
OPTIONAL
A description of your package. You can share the color, the details or any that help describing your item.

items.category string
OPTIONAL
Categorization of your package, the value must be one of these table value. If empty, the default value will beothers
ValueDescription
fashionClothing, accessories, and personal adornments.
healthcareProducts related to health, wellness, and personal care.
food_and_drinkItems related to food and beverages.
electronicElectronic devices and accessories.
beautyBeauty products and cosmetics.
outdoor_gearEquipment and apparel for outdoor activities.
home_accessoriesItems that enhance the decor and functionality of the home.
hobbyProducts related to leisure and hobbies.
collectionItems that belong to a particular collection or set.
sparepartReplacement parts and accessories.
groceriesFood and household items typically purchased for regular consumption.
othersMiscellaneous items that don't fit into the other categories.

items.sku string
OPTIONAL
Item SKU if you have one.

items.value number
OPTIONAL
The value of the item.

items.quantity number
OPTIONAL
The total of the item.

items.weight number
OPTIONAL
The weight of the item in grams.

items.height number
OPTIONAL
The height of the item in centimeters. Item dimensions can affect the weight of your item which can cause a price different.

items.length number
OPTIONAL
The length of the item in centimeters. Item dimensions can affect the weight of your item which can cause a price different.

items.width number
OPTIONAL
The width of the item in centimeters. Item dimensions can affect the weight of your item which can cause a price different.

Type of Request

Set courier

If you want to set the courier for the draft order, make sure you call the get the courier rates using Retrieve Draft Order Rates API. The only courier_company and courier_type value that are supported are the one that are displayed on the Retrieve Draft Order Rates API response.

Once you have selected the courier company and the courier type, the draft order status is automatically updated to "ready" status. Once the status is ready, you can confirm the Draft Order using Confirm Draft Order API and the order will be created.

JSON Body Request
{
"courier_company": "sicepat",
"courier_type": "reg"
}

Set origin and destination

This endpoint can be used to change the origin and destination information, for example, if previously the origin and destination are defined with postal code, it can be changed to coordinate.

Upon changing, if the courier_company and courier_type already set, and it's instant courier, but the origin or destination are set to other than coordinate, it will nullify the courier_company and courier_type, hence the draft order status will be placed.

JSON Body Request
{
"origin_coordinate": {
"latitude": -6.1751,
"longitude": 106.8650
},
"destination_coordinate": {
"latitude": -6.2115,
"longitude": 106.8452
}
}

When you send origin and destination value, you must at least choose one type of origin or destination. Origin and destination must at least have postal codes, coordinates or area ids. You do not need to insert all of the three values.

API Response

Updated

API Response
{
"success": true,
"code": 20011003,
"object": "draft_order",
"id": "ef18275c-02a9-4887-a56b-f374edb96ec4",
"order_id": null,
"origin": {
"area_id": "IDNP6IDNC148IDND836IDNZ12430",
"address": "CITOS - Cilandak Town Square, Kota Jakarta Selatan, Jakarta 12430",
"note": null,
"contact_name": "John Doe",
"contact_phone": "081234567901",
"contact_email": "[email protected]",
"coordinate": {
"latitude": null,
"longitude": null
},
"province_name": "DKI Jakarta",
"city_name": "Jakarta Selatan",
"district_name": "Cilandak",
"postal_code": 12430,
"collection_method": "pickup"
},
"destination": {
"area_id": "IDNP6IDNC147IDND835IDNZ10210",
"address": "Jl. Contoh No. 12",
"note": null,
"contact_name": "Jake Doe",
"contact_phone": "0812345678902",
"contact_email": "[email protected]",
"coordinate": {
"latitude": null,
"longitude": null
},
"province_name": "DKI Jakarta",
"city_name": "Jakarta Pusat",
"district_name": "Tanah Abang",
"postal_code": 10210,
"proof_of_delivery": {
"use": false,
"fee": 0,
"note": null,
"link": null
},
"cash_on_delivery": {
"payment_method": null,
"amount": null,
"amount_currency": "IDR",
"note": null,
"type": null
}
},
"courier": {
"name": null,
"phone": null,
"company": "sicepat",
"type": "reg",
"link": null,
"tracking_id": null,
"waybill_id": null,
"insurance": {
"amount": 0,
"amount_currency": "IDR",
"fee": 0,
"fee_currency": "IDR",
"note": ""
},
"routing_code": null
},
"delivery": {
"type": "now",
"datetime": "2024-09-19T03:40:22.810Z",
"note": null,
"distance": null,
"distance_unit": "kilometer"
},
"extra": [],
"tags": [],
"metadata": null,
"items": [
{
"name": "Black Leather Bag",
"description": "Goods",
"value": 30,
"quantity": 1,
"height": 1,
"width": 1,
"length": 1,
"weight": 1
}
],
"currency": "IDR",
"tax_lines": [],
"price": 11500,
"status": "ready",
"reference_id": "example/35ef876e-3902-4186-873a-e9012ea1e354",
"invoice_id": "1209839012839012",
"user_id": "6448e9d77ff7510bbadfa605",
"created_at": "2024-09-19T03:40:22.802Z",
"updated_at": "2024-09-19T03:40:22.802Z",
"placed_at": null,
"ready_at": "2024-09-19T03:40:22.802Z",
"confirmed_at": null,
"deleted_at": null
}