Skip to main content

Orders Guide

Document Type: Order
Document Type ID: 3 (verify with /document-type)


Overview​

Orders are documents that:

  • πŸ“¦ Register customer orders
  • ⚠️ OPTIONALLY reserve stock
  • πŸ”„ Can be converted to invoices (full or partial)
  • πŸ“‹ Serve as order confirmation
  • 🚚 Base for picking and shipping

When to Use​

  • βœ… Customer confirms order
  • βœ… Need to reserve stock
  • βœ… Track pending orders
  • βœ… Billing after order

Order Characteristics​

CharacteristicValueDescription
Affects Stock⚠️ OptionalCan reserve stock
Requires Payment❌ NoConfirmed order
Can be Closedβœ… YesCan be finalized
Fiscal Validation❌ NoNot a fiscal document
Allows Editingβœ… YesWhile not closed
Conversionβœ… YesCan generate Invoice

Create Order​

Basic Order​

POST /api/v1/invoices
Content-Type: application/json
Authorization: Bearer {token}
{
"serieId": 11,
"documentTypeId": 3,
"entityKeyId": "CLI001",
"entityDescription": "Example Client, Ltd",
"obs": "Order confirmed via phone",
"docReference": "PO-2025-001",
"dueDate": "2025-12-15",
"documentBodies": [
{
"itemKeyId": "PROD001",
"itemDescription": "Product 1",
"quantity": 10.0,
"retailPrice": 50.00,
"taxId": 1,
"paymentType": 1,
"stockFlow": 0, // Does not affect stock
"stockBehavior": 0, // No stock validation
"secondTaxId": 0
}
]
}

Order with Stock Reservation​

{
"serieId": 11,
"documentTypeId": 3,
"entityKeyId": "CLI001",
"obs": "Stock reserved until 12/31/2025",
"documentBodies": [
{
"itemKeyId": "PROD001",
"quantity": 10.0,
"retailPrice": 50.00,
"taxId": 1,
"paymentType": 1,
"stockFlow": 2, // Stock reservation
"stockBehavior": 1, // Validate availability
"originWarehouse": 1,
"secondTaxId": 0
}
]
}
Stock Reservation

Use stockFlow = 2 to reserve stock. The stock is blocked for other sales.


Conversion to Invoice​

Full Conversion​

1. Get order:

GET /api/v1/invoices/456
Authorization: Bearer {token}

2. Create invoice:

POST /api/v1/invoices
Content-Type: application/json
Authorization: Bearer {token}
{
"serieId": 1,
"documentTypeId": 5, // Invoice
"entityKeyId": "CLI001",
"docReference": "ORD A/456", // Reference to order
"documentBodies": [
{
"itemKeyId": "PROD001",
"quantity": 10.0, // Full quantity
"retailPrice": 50.00,
"taxId": 1,
"paymentType": 1,
"stockFlow": 1, // Stock outbound
"stockBehavior": 1,
"secondTaxId": 0
}
]
}

3. Close order:

PUT /api/v1/invoices/456
{
"id": 456,
"close": true,
"obs": "Fully invoiced - INV A/789"
}

Partial Conversion​

To invoice only part of the order, create an invoice with a smaller quantity:

{
"serieId": 1,
"documentTypeId": 5,
"entityKeyId": "CLI001",
"docReference": "ORD A/456 (Partial)",
"obs": "Partial billing - 5 of 10 units",
"documentBodies": [
{
"itemKeyId": "PROD001",
"quantity": 5.0, // Only 5 units
"retailPrice": 50.00,
"taxId": 1,
"paymentType": 1,
"stockFlow": 1,
"stockBehavior": 1,
"secondTaxId": 0
}
]
}
Order Remains Open

In partial conversion, the order remains open for future invoices.


Backorder Management​

Scenario: Insufficient Stock​

If there's not enough stock, create an order without reservation:

{
"serieId": 11,
"documentTypeId": 3,
"entityKeyId": "CLI001",
"obs": "Backorder - awaiting stock replenishment",
"documentBodies": [
{
"itemKeyId": "PROD001",
"quantity": 100.0, // Requested quantity
"retailPrice": 50.00,
"taxId": 1,
"paymentType": 1,
"stockFlow": 0, // No reservation (backorder)
"stockBehavior": 0, // No validation
"secondTaxId": 0
}
]
}

When stock is available, convert to invoice.


Best Practices​

  • Validate stock before reserving
  • Use customer's purchase order reference
  • Set delivery deadline in dueDate
  • Close fully invoiced orders
  • Keep history in obs field
  • Use stock reservation when appropriate

❌ Avoid​

  • Reserving stock unnecessarily
  • Leaving orders open after invoicing
  • Forgetting to reference order in invoice
  • Creating multiple orders for the same request

Common Use Cases​

Standard Order​

Customer places order, stock available, immediate billing.

Order with Reservation​

Customer places order, stock reserved, later billing.

Partial Order​

Customer places large order, partial deliveries/invoices.

Backorder​

Customer places order, insufficient stock, awaits replenishment.


Stock Flows​

stockFlow ValueBehaviorWhen to Use
0Does not affect stockBackorder, order without reservation
1Stock outboundDO NOT use for orders
2Stock reservationOrder with reservation
-1Stock inboundDO NOT use for orders

Differences vs Quotes​

AspectQuoteOrder
CommitmentProposalConfirmed order
StockNever affectsCan reserve
ValidityLimitedUntil fulfilled
PurposeNegotiationConfirmation

Differences vs Invoices​

AspectOrderInvoice
StockReservation (optional)Outbound
FiscalNoYes
PaymentNot requiredRequired
PurposeOrderDefinitive sale

Next Steps​


Last Updated: December 2, 2025