Skip to main content

approvePurchaseOrder

Requires permission purchase:purchase_order:approve.

Approves a purchase order: a DRAFT or SUBMITTED order becomes APPROVED. Any other status is refused. Needs the purchase order approve permission and the purchase orders feature on your plan.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

mutation ApprovePurchaseOrder($id: ID!) {
approvePurchaseOrder(id: $id) {
id
orderNumber
supplierCode
trackingCode
creatorName
projectName
items {
id
productName
uomName
variantName
createdAt
canceledQuantity
}
}
}

Variables:

{
"id": "id"
}

Response:

{
"data": {
"approvePurchaseOrder": {
"id": "id",
"orderNumber": "string",
"supplierCode": "string",
"trackingCode": "string",
"creatorName": "string",
"projectName": "string",
"items": [
{
"id": "id",
"productName": "string",
"uomName": "string",
"variantName": "string",
"createdAt": "2025-01-15T00:00:00Z",
"canceledQuantity": 0
}
]
}
}
}

Approve a purchase order:

mutation ApprovePurchaseOrder($id: ID!, $expectedVersion: Int) {
approvePurchaseOrder(id: $id, expectedVersion: $expectedVersion) {
id
orderNumber
status
}
}

Variables:

{
"id": "PURCHASE_ORDER_ID",
"expectedVersion": 1
}

Response:

{
"data": {
"approvePurchaseOrder": {
"id": "PURCHASE_ORDER_ID",
"orderNumber": "ORDER_NUMBER",
"status": "APPROVED"
}
}
}
approvePurchaseOrder(
expectedVersion: Int
id: ID!
): PurchaseOrder!

Arguments​

approvePurchaseOrder.expectedVersion ● Int scalar​

The version of the record you last read. The change is refused if someone else changed it since.

approvePurchaseOrder.id ● ID! non-null scalar​

The ID of the purchase order.

Type​

PurchaseOrder object​

A purchase order raised with a supplier.