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 shapeThe two receipt-validation submission operations can return
productLineItemsandmatchedProductLineItemsat the response root. Either property may be omitted or, when present, be an array ornull. Returned items use the flattened validation shape, withname,unitPrice,totalPrice,quantity, andskuwhen present. See Validating Receipts.The
entities.productLineItems[].data...paths and examples below apply to verbose receipt and invoice extraction responses.
| Validation field | Type | Notes |
|---|---|---|
productLineItems | optional array | null |
matchedProductLineItems | optional array | null |
[].name | string | null |
[].unitPrice | number | null |
[].totalPrice | number | null |
[].quantity | number | null |
[].sku | string | null |
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
| Field | Type | Description | Access Path |
|---|---|---|---|
| Product/Service Name | String | The name of the item | entities.productLineItems[].data.name.data |
| Quantity | Number | How many of the item were purchased | entities.productLineItems[].data.quantity.data |
| Unit Price | Number | The price of a single item | entities.productLineItems[].data.unitPrice.data |
| Total Price | Number | The total price for this line item | entities.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.
| Field | Type | Description | Access Path |
|---|---|---|---|
| Product Identifier / SKU | String | A printed SKU, UPC/barcode, PLU, item/model code, or similar product identifier, when available | entities.productLineItems[].data.sku.data |
| Item Number | String | An item number printed for the line item, when available | entities.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.
| Field | Type | Description | Access Path |
|---|---|---|---|
| Discount Amount | Number | Discount applied to the item | entities.productLineItems[].data.discountAmount.data |
| Category | String | Item category or classification | entities.productLineItems[].data.category.data |
Additional line item properties
Each entry in productLineItems[] also carries the standard response envelope:
| Field | Description |
|---|---|
data | Detailed information about the item |
text | The raw text detected for this line item |
index | A 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 |
confidenceLevel | Numeric response field when returned; see Understanding Your Results |
regions | The 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.
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.
Updated 9 days ago