Create Order
Create a new order with customer and item information.
Create Order
POST/api/orders
Create a new order in the system.
Request Body
customer_idstring*
Contact ID of the customer
itemsarray*
Array of order items
totalnumber*
Total order amount
currencystring
Currency code (default: USD)
shipping_addressobject
Shipping address details
billing_addressobject
Billing address details
notesstring
Order notes
metadataobject
Custom metadata
Item Object
product_idstring*
Product identifier
namestring
Product name
quantityinteger*
Quantity ordered
pricenumber*
Unit price
skustring
Product SKU
bash
curl -X POST "https://api.cekat.ai/api/orders" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customer_id": "contact_abc123",
"items": [
{
"product_id": "prod_001",
"name": "Premium Widget",
"quantity": 2,
"price": 99.00,
"sku": "WGT-PRE"
},
{
"product_id": "prod_002",
"name": "Widget Accessory",
"quantity": 1,
"price": 29.00,
"sku": "WGT-ACC"
}
],
"total": 227.00,
"currency": "USD",
"shipping_address": {
"name": "John Doe",
"address": "123 Main St",
"city": "Jakarta",
"state": "DKI",
"postal_code": "12345",
"country": "ID"
},
"notes": "Please gift wrap this order"
}'
Response
201 OK
{
"success": true,
"data": {
"id": "order_xyz789",
"order_number": "ORD-2025-0327-001",
"customer_id": "contact_abc123",
"status": "pending",
"items": [
{
"product_id": "prod_001",
"name": "Premium Widget",
"quantity": 2,
"price": 99.00,
"subtotal": 198.00
},
{
"product_id": "prod_002",
"name": "Widget Accessory",
"quantity": 1,
"price": 29.00,
"subtotal": 29.00
}
],
"subtotal": 227.00,
"shipping": 0,
"tax": 0,
"total": 227.00,
"currency": "USD",
"shipping_address": {
"name": "John Doe",
"address": "123 Main St",
"city": "Jakarta",
"state": "DKI",
"postal_code": "12345",
"country": "ID"
},
"notes": "Please gift wrap this order",
"created_at": "2025-03-27T15:00:00Z",
"updated_at": "2025-03-27T15:00:00Z"
}
}
Code Examples
javascript
const createOrder = async (orderData) => {
const response = await fetch('https://api.cekat.ai/api/orders', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify(orderData)
});
return response.json();
};
// Create order
const order = await createOrder({
customer_id: 'contact_abc123',
items: [
{ product_id: 'prod_001', name: 'Widget', quantity: 1, price: 99.00 }
],
total: 99.00,
currency: 'USD'
});
console.log(`Order created: ${order.data.order_number}`);
