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:
- GraphQL
- cURL
mutation ApprovePurchaseOrder($id: ID!) {
approvePurchaseOrder(id: $id) {
id
orderNumber
supplierCode
trackingCode
creatorName
projectName
items {
id
productName
uomName
variantName
createdAt
canceledQuantity
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation ApprovePurchaseOrder($id: ID!) {\n approvePurchaseOrder(id: $id) {\n id\n orderNumber\n supplierCode\n trackingCode\n creatorName\n projectName\n items {\n id\n productName\n uomName\n variantName\n createdAt\n canceledQuantity\n }\n }\n}",
"variables": {
"id": "id"
}
}
EOF
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:
- GraphQL
- cURL
mutation ApprovePurchaseOrder($id: ID!, $expectedVersion: Int) {
approvePurchaseOrder(id: $id, expectedVersion: $expectedVersion) {
id
orderNumber
status
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation ApprovePurchaseOrder($id: ID!, $expectedVersion: Int) {\n approvePurchaseOrder(id: $id, expectedVersion: $expectedVersion) {\n id\n orderNumber\n status\n }\n}",
"variables": {
"id": "PURCHASE_ORDER_ID",
"expectedVersion": 1
}
}
EOF
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.