Add line item
POST
/api/purchase-orders/{id}/items
const url = 'http://localhost:3000/api/purchase-orders/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/items';const options = { method: 'POST', headers: {cookie: 'session=<session>', 'Content-Type': 'application/json'}, body: '{"description":"example","categoryId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","manufacturerId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","quantityOrdered":1,"unitCost":1,"notes":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:3000/api/purchase-orders/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/items \ --header 'Content-Type: application/json' \ --cookie session=<session> \ --data '{ "description": "example", "categoryId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "manufacturerId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "quantityOrdered": 1, "unitCost": 1, "notes": "example" }'Recalculates the PO totalValue.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ” id
required
string format: uuid
Request Body required
Section titled “Request Body required ” Media type application/json
object
description
required
string
categoryId
string format: uuid
manufacturerId
string format: uuid
quantityOrdered
integer
unitCost
number
notes
string
Responses
Section titled “ Responses ”Item created
Media type application/json
object
data
object
id
required
string format: uuid
poId
required
string format: uuid
description
required
string
categoryId
string format: uuid
categoryName
string
manufacturerId
string format: uuid
manufacturerName
string
quantityOrdered
required
integer
quantityReceived
required
integer
unitCost
Numeric(12,2) serialised as string
string
totalCost
Numeric(12,2) serialised as string
string
notes
string
createdAt
required
string format: date-time
updatedAt
required
string format: date-time
Example generated
{ "data": { "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "poId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "description": "example", "categoryId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "categoryName": "example", "manufacturerId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "manufacturerName": "example", "quantityOrdered": 1, "quantityReceived": 1, "unitCost": "example", "totalCost": "example", "notes": "example", "createdAt": "2026-04-15T12:00:00Z", "updatedAt": "2026-04-15T12:00:00Z" }}Description is required
Media type application/json
object
error
required
string
Example
{ "error": "Not found"}Not authenticated
Media type application/json
object
error
required
string
Example
{ "error": "Not found"}Insufficient role
Media type application/json
object
error
required
string
Example
{ "error": "Not found"}Purchase order not found
Media type application/json
object
error
required
string
Example
{ "error": "Not found"}