Product Types¶
Manual categorization of expenses is one of the most repetitive tasks in accounting. Product Types is an AI-powered classification service for categorizing transactions into 74 standardized categories/product types.
Given free-text descriptions, the service returns ranked candidates with confidence scores.
Why use Product Types?¶
Whether you are processing a bank statement or a complex invoice, the Product Types feature reads the free-text descriptions and maps it to a label.
Product Types dives into the line items
- Standardized data: Map messy descriptions like "Printer paper A4" to standardized identifiers like
OFFICE_SUPPLIES. - Confidence scores: Every suggestion comes with a confidence score (
VERY_HIGHtoVERY_LOW)
How to use Product Types¶
The service can be used with input from multiple sources:
-
Purchase Lines: Simply request the
PRODUCT_TYPESfeature inside Smartscan. We'll automatically extract your purchase lines and categorize each one for you in a single request. -
Autosuggest models - text from Autosuggest input data such as
bank(bank statement transactions),scanned-invoice(OCR text from scanned invoices), orelectronic-invoice-line(e-invoice line items). See more here on the input data.
Getting Started¶
Access to the API¶
-
Demo Access Token
The shared
demotoken is not available for Product Types — it is scoped to Smartscan prediction endpoints only (see Authentication). Generate a staging token to try Product Types. -
Staging Access Token (Recommended)
For more extensive testing and integration purposes, we recommend generating a staging access token through our Staging portal. Follow the steps in the Quick Start Guide for generating a staging or production access tokens. Refer to the Authentication for more information on the server-to-server token method.
Product Types is part of Autosuggest and is served on the Autosuggest host - https://api.stag.asgt.visma.ai/ for staging and https://api.prod.asgt.visma.ai/ for production. See the endpoints section for the full list.
Example Request¶
POST v2/models/product-types:batchSuggest
https://api.stag.asgt.visma.ai/v2/models/product-types:batchSuggest
Authorization - Bearer Token¶
Token: [API token]
Body - raw (json)¶
Body
{ "texts": [ "Office supplies and printer paper", "Diesel fuel for company vehicles" ] }
The request body contains a single field:
| Field | Type | Required | Description |
|---|---|---|---|
| texts | string[] | Yes | List of text descriptions to classify (max 128). Each text is classified independently. |
Example Response¶
Body - raw (json)¶
Body
{ "suggestions": [ { "candidates": [ { "type": "OFFICE_SUPPLIES", "label": "Office supplies", "confidence": 0.9942, "confidenceLevel": "VERY_HIGH" }, { "type": "ELECTRONICS", "label": "Computer and consumer electronics", "confidence": 0.0005, "confidenceLevel": "VERY_LOW" }, { "type": "PACKAGING", "label": "Packaging", "confidence": 0.0004, "confidenceLevel": "VERY_LOW" }, { "type": "PERSONAL_CARE", "label": "Personal care products", "confidence": 0.0004, "confidenceLevel": "VERY_LOW" }, { "type": "DECORATIONS_ART", "label": "Decorations and art supplies", "confidence": 0.0003, "confidenceLevel": "VERY_LOW" } ] }, { "candidates": [ { "type": "FUEL_LUBRICANTS", "label": "Fuel, fuel additives, lubricants and anti corrosives", "confidence": 0.9958, "confidenceLevel": "VERY_HIGH" }, { "type": "VEHICLES", "label": "Vehicles and related accessories and components", "confidence": 0.0003, "confidenceLevel": "VERY_LOW" }, { "type": "RESEARCH_TECH_CONSULTING", "label": "Research and technological consultation services", "confidence": 0.0003, "confidenceLevel": "VERY_LOW" }, { "type": "CHEMICALS", "label": "Chemicals and chemical products", "confidence": 0.0002, "confidenceLevel": "VERY_LOW" }, { "type": "ENERGY", "label": "Energy utilities", "confidence": 0.0002, "confidenceLevel": "VERY_LOW" } ] } ] }
The response contains one suggestion per input text, in the same order. Each suggestion includes up to 5 ranked candidates.
Response Structure¶
Suggestion¶
Each element in the suggestions array corresponds to one input text.
| Field | Type | Description |
|---|---|---|
| candidates | candidate[] | Ranked list of product type candidates, most confident first. |
Candidate¶
| Field | Type | Description | Example |
|---|---|---|---|
| type | string | Machine-readable product type identifier | OFFICE_SUPPLIES |
| label | string | Human-readable product type name | Office supplies |
| confidence | number | Confidence score between 0 and 1 | 0.9942 |
| confidenceLevel | string | Discretized confidence level | VERY_HIGH |
Confidence Levels¶
Product Types uses the same confidence levels as Smartscan:
VERY_HIGH, HIGH, MID, LOW, VERY_LOW
Results are sorted by confidence, from most to least confident.
Supported Product Types¶
The service classifies text into one of 74 product type categories:
ACCOUNTING_AUDIT ACCOUNTING_SOFTWARE ADVERTISING
AGRICULTURE ALCOHOL_TOBACCO BANKING_INVESTMENT
BOOKS BUSINESS_CONSULTING CHEMICALS
CLEANING_SERVICES CLEANING_SUPPLIES CLOTHING
CONSTRUCTION_MATERIALS DECORATIONS_ART DEFENSE_SECURITY
DEPOSITS DOMESTIC_APPLIANCES EDUCATION_TRAINING
ELECTRONICS ENERGY FACILITY_MAINTENANCE
FEES FINES FITNESS_CLUBS
FOOD_BEVERAGES FUEL_LUBRICANTS FURNITURE
GIFTS GLASS_CERAMICS GOVERNMENT_SERVICES
GRAPHIC_DESIGN HEALTHCARE HOTELS
INDUSTRIAL_MACHINERY INSURANCE INTERNET_MEDIA
JEWELRY LEGAL LOGISTICS
MACHINERY_LEASING MANUFACTURING MARKETING
MEDIA_SERVICES MEDICAL_LAB_EQUIPMENT MEETINGS
MUSIC OFFICE_SUPPLIES PACKAGING
PARKING PASSENGER_TRANSPORT PAYMENTS
PAYROLL PERSONAL_CARE PERSONAL_SERVICES
PHARMACEUTICALS PLANTS_ANIMALS PROPERTY_RENTAL
RECREATIONAL_SERVICES RESEARCH_TECH_CONSULTING RESTAURANTS
RETIREMENT SOFTWARE SPORTS_EQUIPMENT
STORAGE TAXATION TELEPHONY
TEXTILES TOLLS TOYS
TRADE_REPAIR VEHICLE_RENTALS VEHICLES
WATER_WASTE WEBSITE
Feedback¶
The Feedback endpoint allows you to submit ground-truth labels for model evaluation and improvement.
POST v2/models/product-types:feedback
https://api.stag.asgt.visma.ai/v2/models/product-types:feedback
Body - raw (json)¶
Body
{ "texts": [ "Office supplies and printer paper", "Diesel fuel for company vehicles" ], "trueCategories": [ "OFFICE_SUPPLIES", "FUEL_LUBRICANTS" ] }
| Field | Type | Required | Description |
|---|---|---|---|
| texts | string[] | Yes | The same text descriptions that were classified. |
| trueCategories | string[] | Yes | The correct product type for each text. Must be valid values from the supported types. Must have the same length as texts. |
Error Handling¶
| gRPC Code | HTTP Code | Description |
|---|---|---|
| InvalidArgument | 400 | On feedback: texts is empty, texts and trueCategories have different lengths, or a value in trueCategories is not a supported product type. |
| Internal | 500 | Internal server error during prediction or storage. Also returned by batchSuggest when texts is empty. |
Integration with Smartscan¶
Product Types is also available as a Smartscan feature. When requesting the PRODUCT_TYPES feature in a Smartscan request, product type predictions are automatically added to each purchase line in the response.
Information
Requesting PRODUCT_TYPES automatically enables PURCHASE_LINES - there is no need to request it separately. It classifies based on the description field of each line item.
Example Smartscan Request¶
{
"document": {
"source": {
"httpUri": "https://example.com/invoice.pdf"
}
},
"features": [
{ "type": "PRODUCT_TYPES" }
],
"tier": "PREMIUM"
}