Line Item Extraction

Capture individual products or services from a receipt or invoice — name, quantity, unit price, total price, and optional custom fields.

Taggun's line item extraction can capture individual products or services on a receipt or invoice — name, quantity, unit price, total price, and optional custom fields. Use it when you need per-item data: promotions that check purchased products, expense tools that itemise spending, or analytics on shopping baskets.

Compatible Endpoints

The productLineItems feature is available on the verbose endpoints:

📘

Receipt Validation response shape

The two receipt-validation submission operations can return productLineItems and matchedProductLineItems at the response root. Either property may be omitted or, when present, be an array or null. Returned items use the flattened validation shape, with name, unitPrice, totalPrice, quantity, and sku when present. See Validating Receipts.

The entities.productLineItems[].data... paths and examples below apply to verbose receipt and invoice extraction responses.

Validation fieldTypeNotes
productLineItemsoptional arraynull
matchedProductLineItemsoptional arraynull
[].namestringnull
[].unitPricenumbernull
[].totalPricenumbernull
[].quantitynumbernull
[].skustringnull

Requesting Line Items

Line items are extracted by default on verbose endpoints (extractLineItems defaults to true). Set the parameter explicitly so the behaviour is deliberate — and set it to false for faster responses when you don't need product-level data (see Performance & Response Times):

curl --request POST \
  --url https://api.taggun.io/api/receipt/v1/verbose/file \
  --header 'accept: application/json' \
  --header 'apikey: YOUR_API_KEY' \
  --header 'content-type: multipart/form-data' \
  --form 'file=@/path/to/your/receipt.jpg' \
  --form 'extractLineItems=true'

Replace YOUR_API_KEY with your API key and update the file path to your receipt image.

Understanding the Verbose Extraction Response

On verbose extraction endpoints, extracted line items are returned in the productLineItems array inside the entities object.

Line-item arrays may be omitted or empty. Within a returned line-item object, properties and nested data values may be absent or null where the schema permits. Guard each property before use.

Default line item fields

FieldTypeDescriptionAccess Path
Product/Service NameStringThe name of the itementities.productLineItems[].data.name.data
QuantityNumberHow many of the item were purchasedentities.productLineItems[].data.quantity.data
Unit PriceNumberThe price of a single itementities.productLineItems[].data.unitPrice.data
Total PriceNumberThe total price for this line itementities.productLineItems[].data.totalPrice.data

Note: itemsCount.data is the total quantity across extracted line items (the sum of each productLineItems[].data.quantity), not the count of line-item records — and it's distinct from entities.additionalReceiptProperties.numberOfItems. When you need the actual records, iterate over entities.productLineItems[].

Product Identifier / SKU Extraction

Product identifier / SKU extraction captures printed product identifiers such as SKU, UPC/barcode, PLU, item/model codes, or item numbers when available in line-item extraction. It is a Startup+ account capability. If a Product Identifier/SKU control is not visible in Feature Settings, contact support for the account's current configuration path. See Plans & Feature Access.

FieldTypeDescriptionAccess Path
Product Identifier / SKUStringA printed SKU, UPC/barcode, PLU, item/model code, or similar product identifier, when availableentities.productLineItems[].data.sku.data
Item NumberStringAn item number printed for the line item, when availableentities.productLineItems[].data.itemNumber.data

These values are nested within each line item. The public response schema does not contain a standalone serialNumber field.

Other optional line item fields

These fields are optional. category depends on Product Categories being enabled and configured. discountAmount may be returned when detected; no separate discount control is documented.

FieldTypeDescriptionAccess Path
Discount AmountNumberDiscount applied to the itementities.productLineItems[].data.discountAmount.data
CategoryStringItem category or classificationentities.productLineItems[].data.category.data

Additional line item properties

Each entry in productLineItems[] also carries the standard response envelope:

FieldDescription
dataDetailed information about the item
textThe raw text detected for this line item
indexA numeric extraction index associated with the item; it is not the item's zero-based position in productLineItems[]. Do not rely on it for sorting until Engineering confirms its ordering semantics
confidenceLevelNumeric response field when returned; see Understanding Your Results
regionsThe location of the text on the image

Example

Example input

This worked example focuses on three receipt rows: sparkling water, two fresh juices, and scrambled eggs with mushrooms.

Restaurant receipt with the line-item section outlined

Illustrative receipt rows corresponding to the products represented in the response excerpt.

Example response

The request includes --form 'extractLineItems=true'. The response is trimmed to three items, with regions coordinates removed for readability:

{
  "entities": {
    "productLineItems": [
      {
        "data": {
          "quantity": { "data": 1, "text": "1" },
          "unitPrice": { "data": 8, "text": "8.00" },
          "totalPrice": { "data": 8, "text": "8.00" },
          "name": {
            "data": "Sparkling Mineral Water - San Pellegrino 1ltr",
            "text": "Sparkling Mineral Water - San Pellegrino 1ltr"
          }
        },
        "confidenceLevel": 0.65,
        "text": "- San Pellegrino 1ltr",
        "index": 13
      },
      {
        "data": {
          "quantity": { "data": 2, "text": "2" },
          "unitPrice": { "data": 9, "text": "9.00" },
          "totalPrice": { "data": 18, "text": "18.00" },
          "name": {
            "data": "Fresh juice - Orange",
            "text": "Fresh juice - Orange"
          }
        },
        "confidenceLevel": 0.65,
        "text": "2 x Fresh juice $9.00",
        "index": 26
      },
      {
        "data": {
          "quantity": { "data": 1, "text": "1" },
          "unitPrice": { "data": 21.5, "text": "21.50" },
          "totalPrice": { "data": 21.5, "text": "21.50" },
          "name": {
            "data": "Chilli Scrambled Eggs with Mushrooms",
            "text": "Chilli Scrambled Eggs with Mushrooms"
          }
        },
        "confidenceLevel": 0.65,
        "text": "1 x Chilli Scrambled Eggs with",
        "index": 22
      }
    ]
  }
}

Categorising Line Items

Taggun can automatically categorise extracted items — "Flat White" under Beverages, "Chilli Scrambled Eggs" under Food — at both receipt and product level. See Purchase Categorisation.

Need something not covered here? Contact [email protected] — see Contacting Support.


Did this page help you?