Using the API

Revised: 05 October 2017

Overview

Coupa provides rich, robust access to read, edit, or integrate your data via RESTful API. This UTF-8 XML based interface allows you to create, update, and take action on individual records within Coupa by making an HTTPS request call.

New in Coupa Release 15

API keys can be configured to provide permission to API access and management. This gives administrators the ability to restrict access and utilization of any and all Coupa APIs from a single API key. Keys can also have an expiry date. If an administrator does not specify an expiry date then the key never expires. If an expiry date is specified, the API key expires at the end of the day (midnight UTC).

How to use the Coupa REST API

In Coupa, all data is stored as a business object or Resource, and each resource has a Resource URL, just like a webpage. Each Coupa customer has their own url, of the form {customer_name}.coupahost.com. Each resource is in the form /api/[resource]. Make sure to access the url using https and not http when using the Coupa API.

For example, an invoice API URL looks like:

https://{instance name}.coupahost.com/api/invoices

Please note, to make the Coupa API calls, caller program would need secure API Key. Contact your Coupa admin or Integration Architect for generating and providing the key to you. Keep the API keys secure, and do not share with any unauthorized users.

All API requests must pass the following headers:

  • X-COUPA-API-KEY with a Coupa API key
  • ACCEPT header with value set to application/xml.

Coupa API allows certain operators and arguments to be used, like GET Supplier based on Name (prefix, suffix, etc) or Creation Date, etc.. See Getting Started with APIs for more info

Best Practice

Shallow API Formats can be used on API calls to limit API response payload. Coupa's API returns a lot of data by default (for example: full objects for associations). This results in return values that can be huge and these returns can cause performance degradation. This can be a problem for customers that do not need the extraneous data not to mention the unnecessary consumption of resources.To better serve our customer's needs, Coupa has added a command return_object=limited that returns a limited xml response instead of the entire schema for an object.

Error Handling / Messages

For cXML, successful requests will return HTTP 200 OK. The body of the response will include the object details. Unsuccessful requests will return HTTP series  4xx or 5xx Bad Request. The body of the response will include validation errors formatted as XML. Calling program should have error handling logic to read the response messages and take corrective actions accordingly.

When Coupa receives your cXML invoice file, the following validation steps take place before the invoice gets uploaded into Coupa.