{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.tabscanner.com/schemas/result.schema.json",
  "title": "Tabscanner result object",
  "type": "object",
  "description": "Structured data extracted from the receipt. Scalar fields are `null` when not found. Amounts are decimal\nnumbers in the receipt's currency. Confidence values range from 0 (no confidence) to 1 (certain).\n",
  "additionalProperties": true,
  "properties": {
    "establishment": {
      "type": [
        "string",
        "null"
      ],
      "description": "Name of the merchant. Detected by machine learning and, where configured, custom establishment lookups."
    },
    "establishmentConfidence": {
      "type": [
        "number",
        "null"
      ],
      "description": "Confidence that `establishment` is correct, 0 to 1.",
      "minimum": 0,
      "maximum": 1
    },
    "validatedEstablishment": {
      "type": "boolean",
      "description": "`true` when the establishment was cross-referenced with the phone number or address on the receipt and confirmed in Tabscanner's database."
    },
    "date": {
      "type": [
        "string",
        "null"
      ],
      "description": "Purchase date and time as `YYYY-MM-DD hh:mm:ss`. Time is `00:00:00` when not printed.",
      "examples": [
        "2026-03-14 12:41:00"
      ]
    },
    "dateISO": {
      "type": [
        "string",
        "null"
      ],
      "description": "Purchase date and time as ISO 8601 `YYYY-MM-DDThh:mm:ss`.",
      "examples": [
        "2026-03-14T12:41:00"
      ]
    },
    "dateConfidence": {
      "type": [
        "number",
        "null"
      ],
      "description": "Confidence that `date` is correct, 0 to 1.",
      "minimum": 0,
      "maximum": 1
    },
    "total": {
      "type": [
        "number",
        "null"
      ],
      "description": "Grand total paid."
    },
    "totalConfidence": {
      "type": [
        "number",
        "null"
      ],
      "description": "Confidence that `total` is correct and is the total, 0 to 1.",
      "minimum": 0,
      "maximum": 1
    },
    "validatedTotal": {
      "type": "boolean",
      "description": "`true` when `totalConfidence` is at least 0.99."
    },
    "subTotal": {
      "type": [
        "number",
        "null"
      ],
      "description": "Amount before tax, tip and service charges."
    },
    "subTotalConfidence": {
      "type": [
        "number",
        "null"
      ],
      "description": "Confidence that `subTotal` is correct, 0 to 1.",
      "minimum": 0,
      "maximum": 1
    },
    "validatedSubTotal": {
      "type": "boolean",
      "description": "`true` when `subTotalConfidence` is at least 0.99."
    },
    "tax": {
      "type": [
        "number",
        "null"
      ],
      "description": "Total tax amount."
    },
    "taxes": {
      "type": "array",
      "description": "Each tax amount found, in receipt order.",
      "items": {
        "type": "number"
      }
    },
    "taxesConfidence": {
      "type": "array",
      "description": "Confidence for each entry of `taxes`, same order.",
      "items": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "tip": {
      "type": [
        "number",
        "null"
      ],
      "description": "Tip or gratuity amount."
    },
    "tipConfidence": {
      "type": [
        "number",
        "null"
      ],
      "description": "Confidence that `tip` is correct, 0 to 1.",
      "minimum": 0,
      "maximum": 1
    },
    "serviceCharges": {
      "type": "array",
      "description": "Each service charge amount found.",
      "items": {
        "type": "number"
      }
    },
    "serviceChargeConfidences": {
      "type": "array",
      "description": "Confidence for each entry of `serviceCharges`, same order.",
      "items": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "discount": {
      "type": [
        "number",
        "null"
      ],
      "description": "Total discount applied to the receipt."
    },
    "discounts": {
      "type": "array",
      "description": "Each discount amount found.",
      "items": {
        "type": "number"
      }
    },
    "discountConfidences": {
      "type": "array",
      "description": "Confidence for each entry of `discounts`, same order.",
      "items": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "rounding": {
      "type": [
        "number",
        "null"
      ],
      "description": "Cash rounding applied to the total, if any."
    },
    "roundingConfidence": {
      "type": [
        "number",
        "null"
      ],
      "description": "Confidence that `rounding` is correct, 0 to 1.",
      "minimum": 0,
      "maximum": 1
    },
    "cash": {
      "type": [
        "number",
        "null"
      ],
      "description": "Cash tendered."
    },
    "cashConfidence": {
      "type": [
        "number",
        "null"
      ],
      "description": "Confidence that `cash` is correct, 0 to 1.",
      "minimum": 0,
      "maximum": 1
    },
    "change": {
      "type": [
        "number",
        "null"
      ],
      "description": "Change returned to the customer."
    },
    "changeConfidence": {
      "type": [
        "number",
        "null"
      ],
      "description": "Confidence that `change` is correct, 0 to 1.",
      "minimum": 0,
      "maximum": 1
    },
    "currency": {
      "type": [
        "string",
        "null"
      ],
      "description": "Detected ISO 4217 currency code. Known values include USD, EUR, GBP, AED, CHF, AUD, HKD, JPY, KRW, RMB, BRL, CAD, ZAR."
    },
    "paymentMethod": {
      "type": [
        "string",
        "null"
      ],
      "description": "Payment method as printed. Known values include VISA, Mastercard, American Express, Discover, ALIPAY, WE CHAT, CASH, Debit."
    },
    "address": {
      "type": [
        "string",
        "null"
      ],
      "description": "Merchant address text exactly as extracted, not normalised."
    },
    "addressNorm": {
      "type": [
        "object",
        "null"
      ],
      "description": "The merchant address split into components. Any component may be `null`.",
      "properties": {
        "building": {
          "type": [
            "string",
            "null"
          ],
          "description": "Building name or unit."
        },
        "number": {
          "type": [
            "string",
            "null"
          ],
          "description": "Street number."
        },
        "street": {
          "type": [
            "string",
            "null"
          ],
          "description": "Street name."
        },
        "suburb": {
          "type": [
            "string",
            "null"
          ],
          "description": "Suburb or district."
        },
        "city": {
          "type": [
            "string",
            "null"
          ],
          "description": "City or town."
        },
        "state": {
          "type": [
            "string",
            "null"
          ],
          "description": "State, province or region."
        },
        "postcode": {
          "type": [
            "string",
            "null"
          ],
          "description": "Postal code."
        },
        "country": {
          "type": [
            "string",
            "null"
          ],
          "description": "Country."
        }
      }
    },
    "phoneNumber": {
      "type": [
        "string",
        "null"
      ],
      "description": "Merchant phone number as printed, not normalised."
    },
    "url": {
      "type": [
        "string",
        "null"
      ],
      "description": "Website address printed on the receipt."
    },
    "barcodes": {
      "type": "array",
      "description": "Barcodes found on the receipt. Each entry is a two-element array of `[data, type]`. Types include EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, Interleaved 2 of 5 and QR Code.",
      "items": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "minItems": 2,
        "maxItems": 2
      }
    },
    "expenseType": {
      "type": [
        "string",
        "null"
      ],
      "description": "Beta. Expense classification, for example `Meals/Individual Meals while Traveling`, `Transportation-Rideshare/Uber/Lyft/Taxi`, `Travel Expenses/Hotel`."
    },
    "documentType": {
      "type": [
        "string",
        "null"
      ],
      "description": "Detected document type when `documentType=auto` was sent. `Receipt` or `Invoice`."
    },
    "customFields": {
      "type": "object",
      "description": "Account-specific extracted fields, for example `Country`, `CardLast4Digits`, `ReceiptNumber`, `VATNumber`. Keys depend on your configuration.",
      "additionalProperties": true
    },
    "lineItems": {
      "type": "array",
      "description": "Product lines found on the receipt, top to bottom.",
      "items": {
        "type": "object",
        "description": "One line of the receipt, either a product (`lineItems`) or a summary line (`summaryItems`).",
        "additionalProperties": true,
        "properties": {
          "desc": {
            "type": [
              "string",
              "null"
            ],
            "description": "Text found on the same printed line as `lineTotal`."
          },
          "descClean": {
            "type": [
              "string",
              "null"
            ],
            "description": "Consolidated, cleaned description including text from adjacent lines that belong to this item, with prices and discounts removed."
          },
          "lineTotal": {
            "type": [
              "number",
              "null"
            ],
            "description": "Amount at the end of the line."
          },
          "price": {
            "type": [
              "number",
              "null"
            ],
            "description": "Unit price when printed separately from `lineTotal`."
          },
          "qty": {
            "type": [
              "number",
              "null"
            ],
            "description": "Quantity when printed. Defaults to `0` when no quantity is found; a value of `1` means a `1` was actually printed."
          },
          "unit": {
            "type": [
              "number",
              "null"
            ],
            "description": "Unit measure amount when printed, for example weight or volume."
          },
          "productCode": {
            "type": [
              "string",
              "null"
            ],
            "description": "SKU, PLU or barcode number found on the line."
          },
          "symbols": {
            "type": "array",
            "description": "Symbols printed after the amount, typically tax codes such as `A`, `B`, `*`.",
            "items": {
              "type": "string"
            }
          },
          "supplementaryLineItems": {
            "type": [
              "object",
              "null"
            ],
            "description": "Present only when text above or below the line could not be resolved into `descClean`. Contains the unresolved text.",
            "properties": {
              "above": {
                "type": "array",
                "description": "Unresolved lines printed above this item.",
                "items": {
                  "type": "string"
                }
              },
              "below": {
                "type": "array",
                "description": "Unresolved lines printed below this item.",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "lineType": {
            "type": [
              "string",
              "null"
            ],
            "description": "Classification of the line. For `summaryItems` one of `Total`, `SubTotal`, `Tax`, `TotalTax`, `Cash`, `Change`, `Tip`, `ServiceCharge`. For product lines this is `Product` or `null`."
          }
        }
      }
    },
    "summaryItems": {
      "type": "array",
      "description": "Non-product lines such as Total, Sub Total, Tax, Cash, Change, Tip and Service Charge, as `LineItem` objects with `lineType` set.",
      "items": {
        "type": "object",
        "description": "One line of the receipt, either a product (`lineItems`) or a summary line (`summaryItems`).",
        "additionalProperties": true,
        "properties": {
          "desc": {
            "type": [
              "string",
              "null"
            ],
            "description": "Text found on the same printed line as `lineTotal`."
          },
          "descClean": {
            "type": [
              "string",
              "null"
            ],
            "description": "Consolidated, cleaned description including text from adjacent lines that belong to this item, with prices and discounts removed."
          },
          "lineTotal": {
            "type": [
              "number",
              "null"
            ],
            "description": "Amount at the end of the line."
          },
          "price": {
            "type": [
              "number",
              "null"
            ],
            "description": "Unit price when printed separately from `lineTotal`."
          },
          "qty": {
            "type": [
              "number",
              "null"
            ],
            "description": "Quantity when printed. Defaults to `0` when no quantity is found; a value of `1` means a `1` was actually printed."
          },
          "unit": {
            "type": [
              "number",
              "null"
            ],
            "description": "Unit measure amount when printed, for example weight or volume."
          },
          "productCode": {
            "type": [
              "string",
              "null"
            ],
            "description": "SKU, PLU or barcode number found on the line."
          },
          "symbols": {
            "type": "array",
            "description": "Symbols printed after the amount, typically tax codes such as `A`, `B`, `*`.",
            "items": {
              "type": "string"
            }
          },
          "supplementaryLineItems": {
            "type": [
              "object",
              "null"
            ],
            "description": "Present only when text above or below the line could not be resolved into `descClean`. Contains the unresolved text.",
            "properties": {
              "above": {
                "type": "array",
                "description": "Unresolved lines printed above this item.",
                "items": {
                  "type": "string"
                }
              },
              "below": {
                "type": "array",
                "description": "Unresolved lines printed below this item.",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "lineType": {
            "type": [
              "string",
              "null"
            ],
            "description": "Classification of the line. For `summaryItems` one of `Total`, `SubTotal`, `Tax`, `TotalTax`, `Cash`, `Change`, `Tip`, `ServiceCharge`. For product lines this is `Product` or `null`."
          }
        }
      }
    }
  }
}
