> For the complete documentation index, see [llms.txt](https://docs.mindee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mindee.com/v1/docti/extracting-line-items.md).

# Extracting Line Items

## Overview

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:

<figure><img src="/files/SKpQN9TjkgUQV8xnIstd" alt=""><figcaption></figcaption></figure>

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](https://platform.mindee.com/login). You'll land on the My APIs page.
2. Click the docTI tab.
3. Click the **Create a new API** button.

<figure><img src="/files/sgbh7nriHVJP3OTQT7eA" alt=""><figcaption></figcaption></figure>

* 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.

<figure><img src="/files/MrjATHroG68PsF06d7uu" alt=""><figcaption></figcaption></figure>

* Next, Define your data model by defining the different items within the Object field.

<figure><img src="/files/U0BIAS0rFpHGWYOIop49" alt=""><figcaption></figcaption></figure>

* Click on the Object field

<figure><img src="/files/zkyJGaODBSFt912BSaN8" alt=""><figcaption></figcaption></figure>

* 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.

<figure><img src="/files/hEpoIkxBLmT6qVgN9aM7" alt=""><figcaption></figcaption></figure>

## 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:

<figure><img src="/files/Zn7N7h7GFH5LHzsDa1ow" alt=""><figcaption></figcaption></figure>

Creating the following API Response:

```json
{
  "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": [
      "line_items"
    ],
    "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 ](/v1/get-started/make-your-first-request.md#get-your-sample-code)to integrate your API in your application.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mindee.com/v1/docti/extracting-line-items.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
