Attachments API

Use the Attachments API to manage attachments on Coupa Reference and Transactional objects.

Actions

Most Coupa resources allow you to add attachments to both the core resources along with comments on the resource. See the Comments API for details.

The Attachments API allows you to perform the following actions.

Verb Path Action Description
POST /api/contracts/:contract_id/attachments create Create attachment
POST /api/invoices/:invoice_id/attachments create Create attachment
POST /api/expense_reports/:expense_report_id/attachments create Create attachment
POST /api/purchase_orders/:purchase_order_id/attachments create Create attachment
POST /api/users/:user_id/attachments create Create attachment
POST /api/requisitions/:requisition_id/attachments create Create attachment
GET /api/contracts/:contract_id/attachments index Query attachments
GET /api/inventory_transactions/:id/attachments/:id show Show attachment
GET /api/invoices/:invoice_id/attachments index Query attachments
GET /api/expense_reports/:expense_report_id/attachments index Query attachments
GET /api/purchase_orders/:purchase_order_id/attachments index Query attachments
GET /api/users/:user_id/attachments index Query attachments
GET /api/requisitions/:requisition_id/attachments index Query attachments
GET /api/contracts/:contract_id/attachments/:id show Show attachment
GET /api/invoices/:invoice_id/attachments/:id show Show attachment
GET /api/expense_reports/:expense_report_id/attachments/:id show Show attachment
GET /api/purchase_orders/:purchase_order_id/attachments/:id show Show attachment
GET /api/users/:user_id/attachments/:id show Show attachment
GET /api/requisitions/:requisition_id/attachments/:id show Show attachment
GET /api/attachments/:attachment_id show Show attachment based on an attachment ID.
PATCH /api/contracts/:contract_id/attachments/:id update You cannot update attachments via the API
PUT /api/contracts/:contract_id/attachments/:id update You cannot update attachments via the API
PATCH /api/invoices/:invoice_id/attachments/:id update You cannot update attachments via the API
PUT /api/invoices/:invoice_id/attachments/:id update You cannot update attachments via the API
PATCH /api/expense_reports/:expense_report_id/attachments/:id update You cannot update attachments via the API
PUT /api/expense_reports/:expense_report_id/attachments/:id update You cannot update attachments via the API
PATCH /api/purchase_orders/:purchase_order_id/attachments/:id update You cannot update attachments via the API
PUT /api/purchase_orders/:purchase_order_id/attachments/:id update You cannot update attachments via the API
PATCH /api/users/:user_id/attachments/:id update You cannot update attachments via the API
PUT /api/users/:user_id/attachments/:id update You cannot update attachments via the API
PATCH /api/requisitions/:requisition_id/attachments/:id update You cannot update attachments via the API
PUT /api/requisitions/:requisition_id/attachments/:id update You cannot update attachments via the API
DELETE /api/requisitions/:requisition_id/attachments/:id delete Delete an attachment from the Requisition Header (works for other document types too, like Orders)
DELETE /api/requisition_lines/:requisition_line_id/attachments/:id delete Delete an attachment from the Requisition Line (works for other document types too, like Orders)
DELETE /api/attachments/:attachment_id delete Delete an attachment

Elements

The following elements are available for the Attachments API:

Element Description Required Field? Unique? Allowable Value Api_In Field? Api_Out Field? Data Type
created-at Automatically created by Coupa in the format YYYY-MM-DDTHH:MM:SS+HH:MMZ yes datetime
file-url URL to attached file yes yes string
id Coupa unique identifier yes yes integer
intent intent yes yes string(40)
linked-to link to specific feature yes string(255)
text text yes text
type type yes yes yes string(255)
updated-at Automatically created by Coupa in the format YYYY-MM-DDTHH:MM:SS+HH:MMZ yes datetime
url url yes string(255)

Example

The following example post creates an attachment of the file, Standard_Terms_Conditions.pdf, for the contract 12345.

curl -X POST \
  https://<INSTANCE>/api/requisitions/12345/attachments \
  -H "Accept: application/xml" \
  -H "content-type: multipart/form-data" \
  -H "x-coupa-api-key: <API KEY>" \
  -F "attachment[file]=@/Users/IntegrationAdmin/Contracts/Standard_Terms_Conditions.pdf" \
  -F "attachment[type]=file"
  -F "attachment[intent]=Supplier"