Skip to main content

Purchase Order List

Endpoint: GET /api/v6.1/purchase_orders

Description: This API is used to retrieve a list of purchase orders from the CRM system, including customer information, product details, order status, assigned person, and custom fields.


Request

Method: GET

Headers:

X-API-KEY: <your-api-key>
Cookie: <your-session-cookie>

Query Parameters: | Parameter | Type | Description |
|---------|------|-------|
| fields | string | List of fields to retrieve, comma-separated |
| filtering[status:eq] | int | Filter by order status, e.g., 1 for confirmed |
| limit | int | Number of records to retrieve |
| offset | int | Starting position (for pagination) |
| sort | string | Field to sort by, e.g., order_date |
| direction | string | Sort direction: asc or desc |\


Response

Status: 200 OK

{
"data": [
{
"id": 123,
"order_code": "PO001",
"real_amount": 1000000,
"f_amount": 1000000,
"discount": 0,
"discount_amount": 0,
"vat_amount": 0,
"account_id": null,
"account_code": "",
"account_email": "",
"account_phone": "",
"account_address": "",
"order_date": "2025-05-12 00:00:00",
"created_at": "2025-05-12 09:10:48",
"updated_at": "2025-05-12 09:10:48",
"status": 1,
"assigned_user": 2,
"assigned_user_name": "Responsible Person",
"contact_name": "",
"contact_phone": "",
"contact_email": "",
"detail_custom_fields": {
"sub_order_code": "",
"private_note": ""
},
"custom_fields": [],
"order_details": [
{
"id": 456,
"product_id": 789,
"product_name": "Product Name A",
"product_code": "SP123",
"quantity": 2,
"price": 500000,
"amount": 1000000,
"unit_name": "Piece",
"product_avatar": "https://example.com/image.png"
}
]
}
],
"has_more": true,
"offset": 1,
"limited": 2,
"sorted": {
"order_date": "DESC"
}
}

Description of key fields

Order Information: | Field | Type | Description |
|--------|------|-------|
| id | integer | Internal order ID |
| order_code | string | Unique order code |
| real_amount, f_amount | number | Total actual value / before discount |
| discount, discount_amount | number | Discount (%) and amount |
| vat_amount | number | VAT amount |
| order_date, created_at, updated_at | datetime | Order date, creation, and update |
| status | int | Order status |\

Customer Information: | Field | Type | Description |
|--------|------|-------|
| account_id, account_code | int, string | Customer ID and code |
| account_email, account_phone, account_address | string | Customer contact information |
| contact_name, contact_phone, contact_email | string | Consignee or primary contact |\

Assigned Person: | Field | Type | Description |
|--------|------|-------|
| assigned_user | int | Assigned staff ID |
| assigned_user_name | string | Assigned staff name |\

Product Details (order_details): | Field | Description |
|--------|-------|
| product_id, product_name, product_code | Product identification information |
| quantity, price, amount | Quantity, unit price, total amount |
| unit_name, product_avatar | Unit of measurement and featured image |\

Extended Fields (detail_custom_fields): An object containing custom fields such as:\

  • sub_order_code: sub order code\
  • private_note: internal or extended notes\