Update Order
Update existing order information including status, tracking, and metadata.
Update Order
PUT/api/orders/:id
Update an existing order's details.
Request Body
statusstring
New order status
tracking_numberstring
Shipping tracking number
tracking_urlstring
Tracking URL
notesstring
Order notes
metadataobject
Custom metadata (partial update)
shipping_addressobject
Updated shipping address
Status Values
Valid status values: pending, paid, processing, shipped, delivered, cancelled, refunded
bash
# Update order status to shipped
curl -X PUT "https://api.cekat.ai/api/orders/order_xyz789" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "shipped",
"tracking_number": "TRK123456789",
"tracking_url": "https://tracking.example.com/TRK123456789"
}'
# Cancel an order
curl -X PUT "https://api.cekat.ai/api/orders/order_xyz789" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "cancelled",
"notes": "Customer requested cancellation"
}'
# Add metadata
curl -X PUT "https://api.cekat.ai/api/orders/order_xyz789" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"metadata": {
"gift_wrap": true,
"gift_message": "Happy Birthday!"
}
}'
Response
200 OK
{
"success": true,
"data": {
"id": "order_xyz789",
"order_number": "ORD-2025-0327-001",
"status": "shipped",
"tracking_number": "TRK123456789",
"tracking_url": "https://tracking.example.com/TRK123456789",
"updated_at": "2025-03-28T10:00:00Z",
"status_history": [
{
"status": "pending",
"timestamp": "2025-03-27T15:00:00Z"
},
{
"status": "paid",
"timestamp": "2025-03-27T15:30:00Z"
},
{
"status": "processing",
"timestamp": "2025-03-27T16:00:00Z"
},
{
"status": "shipped",
"timestamp": "2025-03-28T10:00:00Z"
}
]
}
}
Common Use Cases
Mark as Paid
bash
curl -X PUT "https://api.cekat.ai/api/orders/order_xyz789" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "status": "paid" }'
Ship Order with Tracking
bash
curl -X PUT "https://api.cekat.ai/api/orders/order_xyz789" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "shipped",
"tracking_number": "POS-123456789",
"tracking_url": "https://posindonesia.id/track/POS-123456789"
}'
Mark as Delivered
bash
curl -X PUT "https://api.cekat.ai/api/orders/order_xyz789" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "status": "delivered" }'
Cancel Order
bash
curl -X PUT "https://api.cekat.ai/api/orders/order_xyz789" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "cancelled",
"notes": "Customer requested cancellation - refund processed"
}'
Code Examples
javascript
const updateOrder = async (orderId, updates) => {
const response = await fetch(
`https://api.cekat.ai/api/orders/${orderId}`,
{
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify(updates)
}
);
return response.json();
};
// Mark order as shipped
const shipped = await updateOrder('order_xyz789', {
status: 'shipped',
tracking_number: 'TRK123456789'
});
// Cancel order
const cancelled = await updateOrder('order_xyz789', {
status: 'cancelled',
notes: 'Customer request'
});
Order Status Flow
Typical order status flow:
pending → paid → processing → shipped → delivered
Orders can also transition to cancelled or refunded from any status.
