Returns a purchase's details and its lines.
v1/purchases/get_entry.php
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| purchase_id | int | Yes | Purchase ID |
Response
An object purchase with the purchase's fields:
| Field | Type | Description |
|---|---|---|
| id | int | Purchase ID |
| status | int | Status, a code from Changing the Purchase Status |
| payment | int | Payment status, a code from Changing the Payment Status |
| date_placed | string | Purchase order date |
| date_received | string | Received date. Empty string if not set |
| supplier_id | int | Supplier ID |
| supplier_name | string | Supplier name |
| materials_storage_id | int | Materials storage location |
| materials_storage_name | string | Materials storage location name |
| products_storage_id | int | Products storage location |
| products_storage_name | string | Products storage location name |
| subtotal | float | Sum of the lines |
| delivery_price | float | Delivery cost |
| discount | float | Discount |
| total | float | Total: subtotal plus delivery_price minus discount |
| amount | float | Total quantity if all lines share one unit, otherwise null |
| lines | int | Number of lines |
| notes | string | Notes |
And two arrays of purchase lines: materials and products.
Line fields:
| Field | Type | Description |
|---|---|---|
| id | int | Material or product ID |
| sku | string | SKU |
| name | string | Name |
| amount | float | Quantity |
| unit | string | Unit of measure |
| total | float | Line total |
| price | float | Price per unit: total divided by amount |
| cost | float | Line cost |
| position | int | Line number in the purchase card, from 0 |
The position numbering is shared across both arrays: it restores the line order as in the purchase card.
The lines from the response can be sent to v1/purchases/edit unchanged: extra fields are ignored.
Example request
{
"purchase_id": 29645
}
Example response
{
"success": true,
"purchase": {
"id": 29645,
"status": 1,
"payment": 0,
"date_placed": "2026-10-06",
"date_received": "",
"supplier_id": 45,
"supplier_name": "Woodtrade Ltd",
"materials_storage_id": 3998,
"materials_storage_name": "Main location",
"products_storage_id": 3998,
"products_storage_name": "Main location",
"subtotal": 30000,
"delivery_price": 1500,
"discount": 0,
"total": 31500,
"amount": null,
"lines": 2,
"notes": "Invoice No. 118",
"materials": [
{
"id": 2051,
"sku": "M010",
"name": "Oak board",
"amount": 0.2,
"cost": 27300,
"unit": "cu m",
"position": 0,
"total": 26000,
"price": 130000
},
{
"id": 2052,
"sku": "M011",
"name": "Wood glue",
"amount": 10,
"cost": 4200,
"unit": "kg",
"position": 1,
"total": 4000,
"price": 400
}
],
"products": []
}
}
Errors
| Error | Reason |
|---|---|
| No purchase_id in input | purchase_id is missing |
| Purchase not found or access denied | Purchase not found or deleted |