Purchase invoice automation with UiPath - video tutorial

Purchase invoices processing is a prime use case for intelligent automation. It is well proven within many organisations, and is shown to deliver automation rates of up to 80%! By automating the steps in the journey of an invoice, companies do not only save on repetitive tasks, but they also improve the correctness of information and speed up the payment times.

This step-by-step video tutorial takes you through building a robot that predicts and assigns general ledger (GL) codes to the incoming invoices using aito.ai and UiPath.

Jump right in, and also check out the resources below the video in this article!

What do you build with this tutorial?

The tutorial takes a simplistic view, and only focuses on one part of the purchase processing automation: predicting and assigning the GL code for each invoice based on it's details and aito.ai's prediction (that uses historic invoices as training data).

The steps your robot will complete:

  1. Open an excel file that contains 100 new invoices as rows

  2. Loops through each invoice row one by one

    1. Predicts the most likely GL code using aito.ai

    2. Checks if the prediction confidence is above or below selected threshold

    3. Writes results back to each row in the same excel

    4. Colours the "low confidence" predictions in red for easy review

  3. Closes the excel workbook and writes a log line of automation rate

Here is an extract of how the completed predictions will look, once added to your source excel:\

In a real life setting the predictions like this would happen as part of the larger workflow that takes in invoices one by one from OCR or electronic invoices source, and in the end adds the invoice in to an ERP or accounting system.

This tutorial also does not cover the data input part, but uses already populated aito.ai dataset of historic invoices. In real life there is usually another robot workflow that adds invoices in to aito.ai to keep the training data up to date.

What is needed?

  • UiPath Studio. Community edition is enough, the tutorial was built with version 2020.10.2.

  • Microsoft Excel (you'll need a version that can edit files, not just view)

  • Incoming invoices file, available here:


New UiPath version available!

Please note that UiPath published a new 21.04 version of the Studio soon after this tutorial was made. There should be no reason why the tutorial would not work with the new version, but the video is made with the 2020.10.2, and no further testing with new version has been yet completed.

Copy-pasteable resources

We have included the critical parts that are hard or long to type in to your robot here as copy-pasteable text. Be extra diligent with all the quotes, things will not work if you get just one thing wrong!

aito.ai EndPoint for the HTTP call:


aito.ai x-api-keyvalue for HTTP call headers:


aito.ai query for HTTP call body:

"{ ""from"": ""invoices-uipath"", ""where"": {""Product_Category"": """+inputProductCategory+""",""Item_Description"":  """+inputItemDescription+""",""Vendor_Code"":  """+inputVendorCode+""",""Inv_Amt"": { ""$numeric"" : "+inputInvAmt.ToString+ "} },""predict"": ""GL_Code"",""limit"": 1}"

aito.ai query

Below is a clean version of aito.ai _predict query, that is explained in the video.

  "from": "invoices-uipath",
  "where": {
    "Product_Category": "CLASS-1758",
    "Item_Description": "Travel and Entertainment Miscellaneous Company Car (Field Only) Akorn Inc Ground Transportation Miscellaneous Company Car (Field Only) May-2018",
    "Vendor_Code": "VENDOR-1065",
    "Inv_Amt": { "$numeric" : 27.55 }
  "predict": "GL_Code",
  "limit": 1

Above query results in the following prediction response from aito.ai.

  "offset": 0,
  "total": 9,
  "hits": [
      "$p": 0.9999999512520671,
      "field": "GL_Code",
      "feature": "GL-6050310"

Last updated