Uploading Documents via the API

While there are a range of different types of API endpoints that drive the Affinda solution, uploading documents for processing (and receiving the response) is core to the product. Without documents, there is no Intelligent Document Processing!

Request Body

The following parameters may be included in the API POST request to Affinda using the Upload a document for parsing endpoint.

Note, all individual parameters are optional, however, one (and only one) of the following must be specified:

  • File or URL
  • Workspace or Collection
ParameterDescription
fileFile as binary data blob. Supported formats: PDF, ZIP, DOC, DOCX,XLS, XLSX, ODT, RTF, TXT, HTML, PNG, JPG, TIFF, JEPG
urlURL to a document to download and process
collectionUniquely identifier for the Collection to upload the document to

- The Collection identifier can be found by either using the Get list of all collections endpoint or through the app
- If Collection is specified, the document will not be classified to a different Collection if it is the wrong type (however it may be rejected depending on settings)
workspaceUniquely identifier for the Workspace to upload the document to

- The Workspace identifier can be found by either using the Get list of all workspaces endpoint or through the app
- If Workspace is specified, Affinda will attempt to classify the document into a relevant Collection based on document type
waitIf "true" (default), will return a response only after processing has been completed. If "false", will return an empty data object which can be polled at the GET endpoint until processing is complete.
customIdentifierSpecify a custom identifier for the document.
fileNameThe optional filename of the file
expiryTimeThe date/time in ISO-8601 format when the document will be automatically deleted. Defaults to no expiry.
languageLanguage code in ISO 639-1 format. Must specify zh-cn or zh-tw for Chinese.
rejectDuplicatesIf "true", parsing will fail when the uploaded document is duplicate of an existing document, no credits will be consumed. If "false", will parse the document normally whether its a duplicate or not. If not provided, will fallback to the workspace settings.
regionBiasA JSON representation of the RegionBias object. Influences geocoding and other results.
lowPriorityExplicitly mark this document as low priority.
compactIf true, the returned parse result (assuming wait is also true) will be a compact version of the full result.
deleteAfterParseIf true, no data will be stored after parsing. Only compatible with requests where wait: True.
enableValidationToolIf true, the document will be viewable in the Affinda Validation Tool. Set to False to optimize parsing speed.

📘

Adjust parameters to reduce parsing time

To optimise response times, include these parameters when submitting a document:

  • enableValidationTool: False
  • deleteAfterParse: True
  • compact: True

Note, with the above parameters, the document can not be viewed in the Affinda interface or the data pulled at a later date.