List Orders
Retrieve orders with comprehensive filtering and pagination.
List Orders
GET/api/orders
Retrieve all orders with optional filters.
Query Parameters
customer_idstring
Filter by customer ID
statusstring
Filter by status: pending, paid, processing, shipped, delivered, cancelled, refunded
fromstring
Created after date (ISO 8601 or YYYY-MM-DD)
tostring
Created before date
min_totalnumber
Minimum order total
max_totalnumber
Maximum order total
searchstring
Search in order number and notes
limitinteger
Results per page (default: 50, max: 100)
offsetinteger
Pagination offset
bash
# List all orders
curl -X GET "https://api.cekat.ai/api/orders" \
-H "Authorization: Bearer YOUR_API_KEY"
# Filter by status
curl -X GET "https://api.cekat.ai/api/orders?status=paid" \
-H "Authorization: Bearer YOUR_API_KEY"
# Filter by date range
curl -X GET "https://api.cekat.ai/api/orders?from=2025-03-01&to=2025-03-31" \
-H "Authorization: Bearer YOUR_API_KEY"
# Filter by customer
curl -X GET "https://api.cekat.ai/api/orders?customer_id=contact_abc123" \
-H "Authorization: Bearer YOUR_API_KEY"
# High-value orders
curl -X GET "https://api.cekat.ai/api/orders?min_total=1000" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
200 OK
{
"success": true,
"data": [
{
"id": "order_xyz789",
"order_number": "ORD-2025-0327-001",
"customer_id": "contact_abc123",
"customer": {
"id": "contact_abc123",
"name": "John Doe",
"email": "[email protected]",
"phone": "+62812345678"
},
"status": "shipped",
"items_count": 2,
"total": 227.00,
"currency": "USD",
"tracking_number": "TRK123456789",
"created_at": "2025-03-27T15:00:00Z",
"updated_at": "2025-03-28T10:00:00Z"
}
],
"pagination": {
"total": 500,
"limit": 50,
"offset": 0,
"has_more": true
}
}
Get Single Order
GET/api/orders/:id
Retrieve detailed information for a specific order.
bash
curl -X GET "https://api.cekat.ai/api/orders/order_xyz789" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
200 OK
{
"success": true,
"data": {
"id": "order_xyz789",
"order_number": "ORD-2025-0327-001",
"customer_id": "contact_abc123",
"customer": {
"id": "contact_abc123",
"name": "John Doe",
"email": "[email protected]",
"phone": "+62812345678"
},
"status": "shipped",
"items": [
{
"product_id": "prod_001",
"name": "Premium Widget",
"quantity": 2,
"price": 99.00,
"subtotal": 198.00,
"sku": "WGT-PRE"
},
{
"product_id": "prod_002",
"name": "Widget Accessory",
"quantity": 1,
"price": 29.00,
"subtotal": 29.00,
"sku": "WGT-ACC"
}
],
"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"
},
"tracking_number": "TRK123456789",
"tracking_url": "https://tracking.example.com/TRK123456789",
"notes": "Please gift wrap this order",
"metadata": {
"source": "website",
"campaign": "spring_sale"
},
"created_at": "2025-03-27T15:00:00Z",
"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"
}
]
}
}
Code Examples
javascript
const getOrders = async (filters = {}) => {
const params = new URLSearchParams(filters);
const response = await fetch(
`https://api.cekat.ai/api/orders?${params}`,
{ headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);
return response.json();
};
const getOrder = async (orderId) => {
const response = await fetch(
`https://api.cekat.ai/api/orders/${orderId}`,
{ headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);
return response.json();
};
// Get pending orders
const pending = await getOrders({ status: 'pending' });
// Get today's orders
const today = new Date().toISOString().split('T')[0];
const todaysOrders = await getOrders({ from: today, to: today });
// Get specific order detail
const order = await getOrder('order_xyz789');
console.log(`Order status: ${order.data.status}`);
