Fetch & Download Documents on Claims, Contacts & Companies
In our latest API update we have introduced endpoints to list and get documents, allowing you to retrieve document metadata and download the associated file.
Each Document object represents a file uploaded to its parent claim, contact or company and contains metadata describing that file, along with a URL to download it.
Endpoints Summary
Claims
- List Documents on a claim
- Get a Document on a claim
Contacts
- List Documents on a contact
- Get a Document on a contact
Companies
- List Documents on a company
- Get a Document on a company
The Document Object
The Document metadata includes useful attributes such as the filename (filename
), file size (size
), file type (file_type
) and upload date (created_at
). The folder
attribute contains the key of the folder to which the document belongs, or "unfiled" if it does not belong to a folder.
{
"id": 123456,
"filename": "Final Report.pdf",
"folder": "reports",
"extension": "pdf",
"file_type": "application/pdf",
"size": 753855,
"description": "Latest version of final report. Signed and approved.",
"source": "web",
"download_url": "https://...",
"created_at": "2021-12-01T09:22:19.394Z",
"updated_at": "2021-12-06T16:42:32.541Z",
"created_by": 123,
"updated_by": 456
}
Searching Documents
You can search documents by filename
by supplying the s
query parameter when making a list documents request.
Filtering by Folder
Documents can be organised into folders, or left "unfiled". The folder
attribute either contains a key referencing the folder, or is "unfiled" if the document does not belong to a folder.
By default, when listing documents, all documents on the parent object are returned, however you can filter the list for documents in a certain folder, by supplying the folder
query parameter.
Document Download URL Expiry
Document download URLs expire after 5 minutes of being fetched from the API, and are designed to be consumed right away, rather than stored or saved for later.
If a URL expires you can refresh it by simply requesting the document list or fetch endpoint again.