Commercial orders are the upstream transactional documents that drive outbound and inbound warehouse activity in Dragon Guard WMS. Sales orders are linked to shipments — when a shipment is created with aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/CodexaCP/DG_WEB/llms.txt
Use this file to discover all available pages before exploring further.
salesOrderId, the backend validates company ownership and populates commercial fields from the order snapshot. Purchase orders are linked to receipts, providing the expected-quantity context for the receiving flow. Both entity types are company-scoped and support creation, update, and listing from the web frontend.
Endpoints overview
| Method | Path | Description |
|---|---|---|
GET | /api/sales-orders | List all sales orders for a company |
POST | /api/sales-orders | Create a new sales order |
PUT | /api/sales-orders | Update an existing sales order |
GET | /api/purchase-orders | List all purchase orders for a company |
POST | /api/purchase-orders | Create a new purchase order |
PUT | /api/purchase-orders | Update an existing purchase order |
Sales Orders
Sales orders represent confirmed commercial commitments to customers. When a sales order is referenced by a shipment, the backend reads commercial data (customer, seller, prices, terms) from the order and writes a snapshot onto the shipment document.List sales orders
The ID of the active company. Returns sales orders belonging to this company only.
Filter by customer ID.
Filter by order status. Common values:
Open, PartiallyShipped, Shipped, Cancelled.Free-text search across order number, customer name, and external reference fields.
Page number (1-based). Defaults to
1.Records per page. Defaults to
50.Create a sales order
The company this sales order belongs to.
Unique order number within the company. Duplicate order numbers return error code
validation.salesOrderDuplicate.The ID of the customer for this order. Must be an active customer in the same company.
Order date in ISO 8601 format (
YYYY-MM-DD).Optional seller assigned to this order.
Optional external order reference (e.g., customer’s PO number).
Array of order line items.
201 Created
Update a sales order
The ID of the sales order to update.
Updated seller assignment.
Updated external reference.
Replacement set of order lines. Providing this array replaces all existing lines on the order.
Sales orders that have been fully shipped (
status: "Shipped") are read-only. Only Open and PartiallyShipped orders may be edited.Purchase Orders
Purchase orders represent committed procurement events from vendors. When referenced on a receipt header, the purchase order provides the expected items and quantities for the inbound receiving flow.List purchase orders
The ID of the active company.
Filter by vendor ID.
Filter by order status. Common values:
Open, PartiallyReceived, Received, Cancelled.Free-text search across order number, vendor name, and external reference.
Page number (1-based). Defaults to
1.Records per page. Defaults to
50.Create a purchase order
The company this purchase order belongs to.
Unique order number within the company. Duplicate order numbers return error code
validation.purchaseOrderDuplicate.The ID of the vendor for this order. Must be an active vendor in the same company.
Order date in ISO 8601 format (
YYYY-MM-DD).Expected delivery date (
YYYY-MM-DD). Passed to the receipt header when a receiving document is created from this order.Optional external reference (e.g., vendor confirmation number).
Array of purchase order line items.
201 Created
Update a purchase order
The ID of the purchase order to update.
Updated expected delivery date.
Updated external reference.
Replacement set of order lines.
Business rules
Sales order ↔ Shipment link
When a shipment is created with asalesOrderId:
- The backend validates that the referenced sales order belongs to the same
active_company_idas the shipment. Cross-company order references are rejected with a400validation error. - Commercial fields on the shipment (customer, seller, pricing terms) are populated from the order snapshot at the time of shipment creation.
- Once the snapshot is written, subsequent changes to the sales order will not propagate to the shipment.
The commercial field snapshot ensures that historical documents remain accurate even if master data or order values change after the shipment is created.
Duplicate validation
| Entity | Duplicate error code | Key fields |
|---|---|---|
| Sales Order | validation.salesOrderDuplicate | CompanyId + OrderNo |
| Purchase Order | validation.purchaseOrderDuplicate | CompanyId + OrderNo |
Error codes
| HTTP Status | Meaning |
|---|---|
400 | Validation error — missing fields, cross-company salesOrderId, duplicate order number (validation.salesOrderDuplicate, validation.purchaseOrderDuplicate) |
401 | Missing or expired JWT token |
500 | Internal server error |