Approvals API (/approvals)

Use the approvals API to create, update, or query the approval of a document. This includes specific endpoints to take action (reject/hold/approve) as well as requisition details like requestor, line items, and shipping details.

The URL to access the approvals API is:
https://<instance>/api/approvals/<approval id>

See Integration Best Practices for more info. To learn more about implementing remote approvals, see Remote Approvals via API.

Actions

Verb Path Action Description
PUT /api/approvals/:id/approve approvePerform Approve action on an approval
PUT /api/approvals/:id/hold holdPerform Hold action on an approval
GET /api/approvals indexQuery approvals
PUT /api/approvals/:id/reject rejectPerform Reject action on an approval
GET /api/approvals/:id showShow approval
PUT /api/approvals/:id updateUpdate approval

Elements

These are the elements available for the Approvals API

Field Name Field Description Req'd Unique? Allowable Values In Out Type
approvable-idThe document ID that was approvedyesinteger
approvable-typeThe document type that was approved (requisition, purchase order, etc)yesstring(255)
approval-chain-idID of the approval chain this approval is located inyesinteger
approval-dateThe date the approval occurredyesdatetime
approved-byThe user name that made the approvalyes User
approverapproveryes User, Approval Group
approver-idThe user ID that made the approvalyesinteger
approver-typeThe role of the approveryesstring(255)
created-atAutomatically created by Coupa in the format YYYY-MM-DDTHH:MM:SS+HH:MMZyesdatetime
created-byUser who createdyes User
delegatedelegateyes User, Approval Group
delegate-idThe delegate ID that made the approval (if applicable)yesinteger
delegatesDelegatesyesDelegate Approval
holdableHold the approval or notyesboolean
idCoupa unique identifieryesinteger
noteReason for approval or rejectyestext
positionThe position in the approval chain this approval occurredyesinteger
reasonsReasonsyesApproval Reason
statusThe status of the approval (approved, escalated, rejected, etc)yesstring(50)
typeHow the approval occured (override approval, approval chain approval, etc)yesstring(255)
updated-atAutomatically created by Coupa in the format YYYY-MM-DDTHH:MM:SS+HH:MMZyesdatetime
updated-byUser who updatedyes User

Example

In this example, we queried for a single approval with an ID of 12622. We did a GET to the URL:

https://<instance url>/api/approvals/12622 

Approvals GET Response

<?xml version="1.0" encoding="UTF-8"?>
<approval>
	 <id type="integer">12622</id>
	 <created-at type="datetime">2012-02-15T14:56:22-08:00</created-at>
	 <updated-at type="datetime">2012-04-23T11:49:25-07:00</updated-at>
	 <position type="integer">1</position>
	 <approval-chain-id nil="true" />
	 <status>approved</status>
	 <approval-date type="datetime">2012-02-15T14:56:59-08:00</approval-date>
	 <note />
	 <type>ManagementHierarchyApproval</type>
	 <approvable-type>RequisitionHeader</approvable-type>
	 <approvable-id type="integer">2696</approvable-id>
	 <approver>
			<id type="integer">3</id>
			<login>vpierre</login>
			<email>upgrade+vp@coupa.com</email>
			<employee-number />
			<firstname>Victor (CFO)</firstname>
			<lastname>Pierre</lastname>
			<salesforce-id nil="true" />
	 </approver>
	 <created-by>
			<id type="integer">9</id>
			<login>bjenkins</login>
			<email>upgrade+bj@coupa.com</email>
			<employee-number />
			<firstname>Bob (VP Procurement)</firstname>
			<lastname>Jenkins</lastname>
			<salesforce-id nil="true" />
	 </created-by>
<updated-by>
			<id type="integer">17</id>
			<login>coupa_metrics_gatherer</login>
			<email>do_not_reply_metrics@coupa.com</email>
			<employee-number nil="true" />
			<firstname>Coupa</firstname>
			<lastname>Metrics</lastname>
			<salesforce-id nil="true" />
	 </updated-by>
</approval>

Approving or Rejecting

The following describes how you can use the Coupa API to perform actions on Approvals.

Approving

/api/approvals/{id}/approve

Rejecting

/api/approvals/{id}/reject

Adding Reason

In both cases, an approval must be Pending (and not already approved or rejected) for the action to be valid. It is also possible to provide a "Reason" for the rejection through the XML request directly. For example, to reject an approval by id of 12612 and provide a reason of "Rejected by Integration", you would use the following request:

PUT https://{instance url}/api/approvals/12612/reject?reason=Rejected%20by%20Integration
Successful requests will return HTTP 200 Response. The body of the response will include the created requisition. Unsuccessful requests will return
HTTP 400 Bad Request
. The body of the response will include validation errors formatted as XML.