Returns a write-off with its lines.
v1/writeoffs/get_entry.php
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| writeoff_id | int | Yes | Write-off ID |
Response
An object writeoff with the write-off's fields:
| Field | Type | Description |
|---|---|---|
| id | int | Write-off ID |
| num | string | Number |
| date | string | Write-off date, YYYY-MM-DD |
| status | int | Status: 0 Plan, 1 Written off |
| materials_storage_id | int | Storage location materials are written off from |
| materials_storage_name | string | Materials storage location name |
| products_storage_id | int | Storage location products are written off from |
| products_storage_name | string | Products storage location name |
| cost | float | Cost of what was written off |
| amount | float | Total quantity. null if the items have different units |
| lines | int | Number of lines |
| notes | string | Notes |
And lines in two arrays: materials and products. If there are no items of one type, the array is empty.
| Field | Type | Description |
|---|---|---|
| id | int | Material or product ID |
| sku | string | SKU |
| name | string | Name |
| amount | float | Quantity |
| unit | string | Unit of measure |
| cost | float | Line cost |
| position | int | Line number in the write-off, from 0. The numbering is shared by materials and products |
The lines from the response can be sent to v1/writeoffs/edit unchanged.
Example request
{
"writeoff_id": 19291
}
Example response
{
"success": true,
"writeoff": {
"id": 19291,
"num": "48",
"date": "2026-10-06",
"status": 1,
"materials_storage_id": 3998,
"materials_storage_name": "Main",
"products_storage_id": 4001,
"products_storage_name": "Finished goods",
"cost": 26350,
"amount": null,
"lines": 2,
"notes": "Defect while cutting",
"materials": [
{
"id": 2051,
"sku": "M010",
"name": "Oak board",
"amount": 0.15,
"unit": "cu m",
"cost": 20250,
"position": 0
}
],
"products": [
{
"id": 512,
"sku": "P-TABLE-01",
"name": "Dining table",
"amount": 1,
"unit": "pcs",
"cost": 6100,
"position": 1
}
]
}
}
Errors
| Error | Reason |
|---|---|
| No writeoff_id in input | writeoff_id is missing |
| Write-off not found or access denied | Write-off not found or deleted |