File Uploads

Upload PDF to Book

Upload a PDF file to a <glossary:Book> for processing.


You can upload a file to this endpoint as a multipart/form-data encoded payload. To learn more, see multipart/form-data guide.

Direct document upload is not permitted for Books configured with the Classify-only processing type. Attempting to upload to such a Book returns an error indicating that direct document upload is not allowed for that Book type.

For all Documents except bank statements, the optional form_type parameter can be used to specify the type of <glossary:Document>. You can see form types we support in our forms directory.

For more information, please contact your Account Executive or Customer Success Executive to discuss other options for your organization.

📘 > The maximum file size for upload is 200 MB.

post/v1/book/upload

Request

  • Base URL
    https://api.ocrolus.com
  • URL
    https://api.ocrolus.com/v1/book/upload
  • Auth
    OAuth 2
    Client credentials
    Token URL: https://auth.ocrolus.com/oauth/token

Request body multipart/form-data

uploadstring binary required

One or more PDF files to upload. Each file should be attached as its own part in the multipart/form-data body. When multiple files are uploaded together, each is processed independently and the response contains one entry per file in uploaded_docs. A partial failure, such as one duplicate file among several, does not prevent the other files from uploading successfully.

book_uuidstring

The unique identifier of the <glossary:Book> that the uploaded <glossary:Document> will be saved to. Mutually exclusive with pk.

pkinteger

A unique primary key <glossary:PK> of the <glossary:Book> that the uploaded <glossary:Document> will be saved to. Mutually exclusive with book_uuid.

form_typestring

The code identifying the type of <glossary:Document> that you're uploading.

doc_namestring

The name of the <glossary:Document> that will be created from the imported file. Defaults to the name of the file if not given.

Example request

{
  "pk": 30219565,
  "book_uuid": "19aab921-25a5-4beb-a59e-ac72320061d6",
  "form_type": "PAYSTUB",
  "doc_name": "example_document"
}

Response

200

OR
OR

Example response

{
  "status": 200,
  "response": {
    "uploaded_docs": [
      {
        "pk": 51542103,
        "id": 51542103,
        "uuid": "05afcf59-cd34-44a6-a8e3-efaa6de24512",
        "name": "bank-statement.pdf",
        "page_count": 4,
        "checksum": "716a9e2119b197fc8fed9e2ca3e56cae",
        "created_ts": "2023-02-09T10:47:40Z"
      }
    ]
  },
  "message": "OK"
}

Changes

No recorded changes to this operation across all 1 revision of this API.