Documents Overview
To attach a document to a Wholechain event through the API, first upload the document, then add its Document ID to the event.
Use this for purchase orders, invoices, bills of lading, certificates and other supporting records. Documents added this way appear in the Wholechain Documents section and on every event they are attached to, just like documents uploaded in the UI.
Step 1: Upload the document
Send the file to POST /Integration/Documents, one file per request. The response returns the document's documentId: either the ID you supplied or one Wholechain generated. Keep it for step 2.
For headers, file rules, responses and errors, see Upload your Documents.
Step 2: Add the document to an event
Add the documentId to the DocumentIds array of any event you send to POST /Integration/Events. Wholechain attaches the document when it creates the event.
"DocumentIds": ["PO-450001"]
For the full event payload and how IDs that can't be found are reported, see the Events API documentation.
Good to know
- A Document ID can be used as soon as the upload returns
status: Uploaded. - One document can be attached to any number of events.
- An event is always created, even if some of its Document IDs can't be found.
- Only documents from the same account as the API key can be attached.