Skip to main content

Create PO

POST /v1/purchase-order

Creates a new purchase order with the specified items. The endpoint validates all input data and applies default values for any missing fields. Returns the complete purchase order object with calculated pricing, item details, and timestamps for tracking the order lifecycle.

Request Body

{
"items": [
{
"group_id": "group-id-1",
"amount": 5
}
]
}

Response Example

{
"_id": "order-id-1",
"tenant": "tenant-id-1",
"status": "draft",
"state": "",
"deleted": false,
"currency": {
"type": "NOK"
},
"price": 1233.55,
"distributor": {
"id": "distributor-id-1",
"name": "Example Distributor"
},
"items": [
{
"id": "product-id-1",
"group_id": "group-id-1",
"name": "Example Product",
"sku": "SKU-EX-1",
"isSubscription": false,
"unit": {
"price": 246.71
},
"amount": 5,
"price": 1233.55,
"date": {
"delivery": null,
"rest": null
}
}
],
"date": {
"order": null,
"canceled": null,
"accepted": null,
"confirmed": null,
"delivered": null,
"draft": "2025-01-01T00:00:00.000Z"
},
"created": "2025-01-01T00:00:00.000Z",
"updated": "2025-01-01T00:00:00.000Z"
}