# Purchase Order
A purchase order is an inventory transaction issued by the business to a supplier requesting inventory items.
# The Purchase Order Object
# Sample
{
"items": [{
"pivot": {
"quantity": 10,
"cost": 102,
"unit": "box",
"unit_to_storage_factor": 2,
"quantity_received": 10
},
"id": "8ff2470a-ebec-4a1b-aba5-02c8634b53ec",
"name": "Tomatoes",
"sku": "s-001"
}],
"supplier": {
"id": "90de1d49-5df3-42a9-83d5-d7c7d1d8f17f",
"name": "Hyper Market"
},
"submitter": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"branch": {
"id": "90de0d46-3100-431b-97af-a93ded481029",
"name": "Branch 2"
},
"creator": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"poster": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"id": "90dfe96c-aefc-435a-a218-6dc813522f45",
"business_date": "2022-05-16",
"delivery_date": "2022-05-16",
"reference": "PO-000001",
"additional_cost": 0,
"status": 6,
"notes": null,
"created_at": "2020-06-23 12:01:23",
"updated_at": "2020-06-23 12:09:45",
"reviewed_at": "2020-06-23 12:01:53",
"closed_at": "2020-06-23 12:09:45",
"submitter_id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"submitted_at": "2020-06-23 12:01:25"
}
# Attributes
| Field | Type | Rule | Description |
|---|---|---|---|
id | string | Unique identifier for the purchase order. | |
business_date | string | nullable updatable | Business date of the purchase order. |
delivery_date | string | nullable updatable | The assigned delivery date of the purchase order. |
reference | string | nullable updatable | Reference of the purchase order. |
notes | string | nullable updatable | Notes on the purchase order. |
additional_cost | double | updatable | Any additional cost related to the purchase order |
status* | integer | updatable | The Purchase Order Status. |
items* | array | updatable includable | List of Inventory Items attached to the purchase order |
branch* | object | updatable includable | The Branch attached to the purchase order |
supplier* | object | updatable includable | TheSupplier attached to the purchase order |
creator* | object | updatable includable | The User who created the purchase order |
submitter | object | updatable includable | The User who submitted the purchase order for review. |
poster | object | includable | The User who posted the purchase order |
reviewed_at | string | Time YYYY-MM-DD HH-MM-SS in UTC at which the purchase order was reviewed. | |
closed_at | string | Time YYYY-MM-DD HH-MM-SS in UTC at which the purchase order was closed. | |
submitted_at | string | Time YYYY-MM-DD HH-MM-SS in UTC at which the purchase order was submitted for review. | |
created_at | string | sortable | Time YYYY-MM-DD HH-MM-SS in UTC at which the purchase order was created. |
updated_at | string | sortable | Time YYYY-MM-DD HH-MM-SS in UTC at which the purchase order was updated. |
# Statuses
| Type | Description |
|---|---|
| 1 | Draft |
| 2 | Pending |
| 3 | Approved |
| 4 | Declined |
| 5 | Partially Received |
| 6 | Closed |
# List Purchase orders
GET /purchase_orders
# Scope
inventory.transactions.read
# Filters
idbusiness_datebusiness_date_afterbusiness_date_beforedelivery_datereferencestatusbranch_idsupplier_idcreator_idposter_idsubmitter_idupdated_aftercreated_onupdated_on
# Response
{
"data": [{
"items": [{
"pivot": {
"quantity": 10,
"cost": 102,
"unit": "box",
"unit_to_storage_factor": 2,
"quantity_received": 10
},
"id": "8ff2470a-ebec-4a1b-aba5-02c8634b53ec",
"name": "Tomatoes",
"sku": "s-001"
}],
"supplier": {
"id": "90de1d49-5df3-42a9-83d5-d7c7d1d8f17f",
"name": "Hyper Market"
},
"submitter": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"branch": {
"id": "90de0d46-3100-431b-97af-a93ded481029",
"name": "Branch 2"
},
"creator": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"poster": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"id": "90dfe96c-aefc-435a-a218-6dc813522f45",
"business_date": "2020-06-23",
"reference": "PO-000001",
"additional_cost": 0,
"status": 6,
"notes": null,
"created_at": "2020-06-23 12:01:23",
"updated_at": "2020-06-23 12:09:45",
"reviewed_at": "2020-06-23 12:01:53",
"closed_at": "2020-06-23 12:09:45",
"submitter_id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"submitted_at": "2020-06-23 12:01:25"
}]
}# Get Purchase Order
GET /purchase_orders/{purchaseOrderId}
# Scope
inventory.transactions.read
# Response
{
"data": {
"items": [{
"pivot": {
"quantity": 10,
"cost": 102,
"unit": "box",
"unit_to_storage_factor": 2,
"quantity_received": 10
},
"id": "8ff2470a-ebec-4a1b-aba5-02c8634b53ec",
"name": "Tomatoes",
"sku": "s-001"
}],
"supplier": {
"id": "90de1d49-5df3-42a9-83d5-d7c7d1d8f17f",
"name": "Hyper Market"
},
"submitter": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"branch": {
"id": "90de0d46-3100-431b-97af-a93ded481029",
"name": "Branch 2"
},
"creator": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"poster": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"id": "90dfe96c-aefc-435a-a218-6dc813522f45",
"business_date": "2020-06-23",
"reference": "PO-000001",
"additional_cost": 0,
"status": 6,
"notes": null,
"created_at": "2020-06-23 12:01:23",
"updated_at": "2020-06-23 12:09:45",
"reviewed_at": "2020-06-23 12:01:53",
"closed_at": "2020-06-23 12:09:45",
"submitter_id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"submitted_at": "2020-06-23 12:01:25"
}
}# Create Purchase order
You can create a purchase order in draft & pending statuses only. If in pending status the submitter_id should be included.
POST /purchase_orders
# Scope
inventory.transactions.write
# Request
{
"notes": "Some Notes",
"status": 1,
"additional_cost": 20,
"branch_id": "8d84b5d2",
"supplier_id": "8d973321",
"creator_id": "8d88a550",
"poster_id": "8d82ff0c",
"items": [{
"id": "8d869249",
"quantity": 10,
"cost": 40,
"unit": "box",
"unit_to_storage_factor": 5
}]
}# Response
{
"data": {
"items": [{
"pivot": {
"quantity": 10,
"cost": 102,
"unit": "box",
"unit_to_storage_factor": 2,
"quantity_received": 10
},
"id": "8ff2470a-ebec-4a1b-aba5-02c8634b53ec",
"name": "Tomatoes",
"sku": "s-001"
}],
"supplier": {
"id": "90de1d49-5df3-42a9-83d5-d7c7d1d8f17f",
"name": "Hyper Market"
},
"submitter": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"branch": {
"id": "90de0d46-3100-431b-97af-a93ded481029",
"name": "Branch 2"
},
"creator": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"poster": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"id": "90dfe96c-aefc-435a-a218-6dc813522f45",
"business_date": "2020-06-23",
"reference": "PO-000001",
"additional_cost": 0,
"status": 6,
"notes": null,
"created_at": "2020-06-23 12:01:23",
"updated_at": "2020-06-23 12:09:45",
"reviewed_at": "2020-06-23 12:01:53",
"closed_at": "2020-06-23 12:09:45",
"submitter_id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"submitted_at": "2020-06-23 12:01:25"
}
}# Update Purchase Order
You can update the purchase order status to all available statuses.
PUT /purchase_orders/{purchaseOrderId}
# Scope
inventory.transactions.write
# Request
{
"status": 2,
"additional_cost": 0,
"notes": "Some Notes",
"branch_id": "8d207fc3",
"supplier_id": "8d207fc3",
"creator_id": "8d207fc3",
"poster_id": "8d207fc3",
"items": [{
"id": "8d207fc3",
"quantity": 200,
"cost": 400,
"unit": "box",
"unit_to_storage_factor": 5
}]
}# Response
{
"data": {
"items": [{
"pivot": {
"quantity": 10,
"cost": 102,
"unit": "box",
"unit_to_storage_factor": 2,
"quantity_received": 10
},
"id": "8ff2470a-ebec-4a1b-aba5-02c8634b53ec",
"name": "Tomatoes",
"sku": "s-001"
}],
"supplier": {
"id": "90de1d49-5df3-42a9-83d5-d7c7d1d8f17f",
"name": "Hyper Market"
},
"submitter": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"branch": {
"id": "90de0d46-3100-431b-97af-a93ded481029",
"name": "Branch 2"
},
"creator": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"poster": {
"id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"name": "Chief"
},
"id": "90dfe96c-aefc-435a-a218-6dc813522f45",
"business_date": "2020-06-23",
"reference": "PO-000001",
"additional_cost": 0,
"status": 6,
"notes": null,
"created_at": "2020-06-23 12:01:23",
"updated_at": "2020-06-23 12:09:45",
"reviewed_at": "2020-06-23 12:01:53",
"closed_at": "2020-06-23 12:09:45",
"submitter_id": "8ff243ca-e650-4d82-ba02-6dd3b673c0c4",
"submitted_at": "2020-06-23 12:01:25"
}
}# Delete Purchase Order
DELETE /purchase_orders/{purchaseOrderId}
# Scope
inventory.transactions.write
The API will return 200indicating that the purchase order has been deleted.