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β
| Characteristic | Value | Description |
|---|---|---|
| Affects Stock | β οΈ Optional | Can reserve stock |
| Requires Payment | β No | Confirmed order |
| Can be Closed | β Yes | Can be finalized |
| Fiscal Validation | β No | Not a fiscal document |
| Allows Editing | β Yes | While not closed |
| Conversion | β Yes | Can 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β
β Recommendedβ
- Validate stock before reserving
- Use customer's purchase order reference
- Set delivery deadline in
dueDate - Close fully invoiced orders
- Keep history in
obsfield - 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 Value | Behavior | When to Use |
|---|---|---|
0 | Does not affect stock | Backorder, order without reservation |
1 | Stock outbound | DO NOT use for orders |
2 | Stock reservation | Order with reservation |
-1 | Stock inbound | DO NOT use for orders |
Differences vs Quotesβ
| Aspect | Quote | Order |
|---|---|---|
| Commitment | Proposal | Confirmed order |
| Stock | Never affects | Can reserve |
| Validity | Limited | Until fulfilled |
| Purpose | Negotiation | Confirmation |
Differences vs Invoicesβ
| Aspect | Order | Invoice |
|---|---|---|
| Stock | Reservation (optional) | Outbound |
| Fiscal | No | Yes |
| Payment | Not required | Required |
| Purpose | Order | Definitive sale |
Next Stepsβ
- Invoices Guide - Convert order to invoice
- Quotes Guide - From quote to order
- Usage Guide - General API information
Last Updated: December 2, 2025