Extracting Line Items


The goal of this tutorial is show a complete example on extracting line items from a document. This can correspond to table like data, or more complex structured data. To do this we'll be using the following dummy file:

The objective is to create an API being able to accurately extract:

  • the description of each products,
  • the number of units,
  • the unit price,
  • the total price.

Create Your Line Items Expense API

  1. Log into your Mindee account. You'll land on the My APIs page.
  2. Click the docTI tab.
  3. Click the Create a new API button.
  • On the Set up your API section, fill in the required information. Give the API a name, a description (optional), and a cover image(optional) and click on Next.

  • Next, Define your data model by defining the different items within the Object field.
  • Click on the Object field
  • In the popup, click on the button Add a new item to to add a new line in your Items definition, then complete each line with a Type, a Field Name and an Example. You can refer to this page to help you complete the form.

Use the API

Your API is now ready to be used in your coding environment. Once your first model is deployed you can test it right away with new data.

Hit the Live interface button on the sidebar, drag and drop a document. You should see something like this:

Creating the following API Response:

  "extras": {},
  "finished_at": "2024-02-05T14:02:23.410000",
  "is_rotation_applied": null,
  "pages": [
      "extras": {},
      "id": 0,
      "orientation": {
        "value": null
      "prediction": {}
  "prediction": {
    "line_items": [
        "product_description": "ANANAS",
        "quantity": 0.265,
        "total_price": 10.28,
        "unit_price": 38.8
        "product_description": "BAIE DE GOGI",
        "quantity": 0.08,
        "total_price": 5.49,
        "unit_price": 68.6
  "processing_time": 3,
  "product": {
    "features": [
    "name": ****/expense_line_items",
    "type": "generated",
    "version": "1.0"
  "started_at": "2024-02-05T14:02:19.625312"

You can then click the Documentation button in the sidebar. And follow these steps to integrate your API in your application.

Slack Logo Icon  Join our Slack