Files

Upload a file to DocAI.

For best results, uploaded files should be whole documents (rather than pages, paragraphs or fragments).

The content type does not need to be specified, with the exception of eOCR files, which must use the content type application/eocr. If not provided, the content type will be automatically detected and returned in the attributes of the response. Plain text content must be UTF-8 encoded.

For Microsoft Word documents (.doc and .docx extensions), the header value X-Attr-OCR=msword can be used to bypass OCR and instead read the characters and layout directly from the original file.

Files are deleted from the system after 7 days by default, configurable to a maximum of 14 days. Your file's expiration date can be found in the response of this API call

post/files

Request

Headers

X-Attr-OCR'auto' | 'ocr' | 'msword' | 'text' | 'eocr'
Example:ocr

The type of OCR operation to perform on the file

X-Attr-MSWord-GenerateImagesstring

Indicates whether to generate page images for MS Word documents when performing OCR

Request body application/octet-stream

string binary required

Response

The file was uploaded successfully

expirationstring required

The file expiration in RFC3339 format

file_idstring required

The ID of the created file resource

permissionsstring[] required

Unused

sizeinteger required

The file size in bytes

Example response

{
  "attributes": {
    "content-type": "application/pdf",
    "sha-256": "8b9bff906445adb9925abca7c48954155b3bfc9b548163086f001fa6b25760aa"
  },
  "expiration": "2021-10-07T12:07:57Z",
  "file_id": "c5e407f1qk1er7odm6tg",
  "permissions": [
    ""
  ],
  "size": 23849850
}

Changes

    • breaking

      removed the media type plain/text from the request body

    • info

      added the new optional header request parameter X-Attr-MSWord-GenerateImages

    • info

      added the new optional header request parameter X-Attr-OCR

    • info

      added the media type application/msword to the request body

    • info

      added the media type application/vnd.openxmlformats-officedocument.wordprocessingml.document to the request body

    • info

      added the media type text/plain to the request body