Gross, Tare & Net Weight Extraction
Read the printed weight values, normalize their units, and make an explicit review decision using deterministic arithmetic.

A Recognized Number Is Not Necessarily the Right Weight
Tickets may print the first and second weighing instead of labeling rows consistently, use commas or periods in numeric formats, abbreviate kilograms or tonnes, or omit one value. Treating the largest number as gross and the smallest as tare is unsafe. A production workflow must retain what was printed, understand the unit, and explain any difference between printed net and gross minus tare.
Keep Extraction and Arithmetic Separate
The OCR model extracts only visible gross, tare, and net fields; it does not invent or calculate missing values. Deterministic application code then normalizes supported units to kilograms and checks gross − tare = net within a small tolerance. The response includes calculated net, difference, pass/fail state, needs_review, and review reasons. Use the full weighbridge OCR product for the surrounding ticket fields.
Live Demo: Weighbridge Ticket OCR Scanner
No registration required. Upload a file to test the extraction.
Drop files here or click to browse
JPG · PNG · WebP · up to 500 files · max 4.5 MB each
Practical Workflows
Automated Acceptance
Continue only when the ticket is valid and the printed weight calculation passes.
Mismatch Review
Show the calculated difference and source values to an operator.
Cross-Unit Reporting
Use normalized_kg while retaining the original printed value and unit.
Missing-Field Control
Identify incomplete gross, tare, or net rows before posting a record.
Technical Specs
- Endpoint: POST /v1/weighbridge-ticket
- Authentication: x-api-key request header
- Input: Base64 or data URI in JSON; JPG, PNG, WebP, or PDF
- Maximum decoded size: 4.5MB
- Cost: 2 credits per successful request
- Output: Structured JSON with deterministic weight validation
Key Features
- No model arithmetic: Prevents a generated calculation from being mistaken for printed evidence.
- Unit normalization: Supports kg, metric tonnes, and pounds with normalized_kg output.
- Tolerance-based comparison: Avoids false mismatches caused by insignificant rounding differences.
- Machine-readable reasons: Explains missing values, unknown units, reversed weights, and net mismatches.
Send a Ticket to the OCR API
The REST endpoint accepts one Base64-encoded JPG, PNG, WebP, or PDF in the JSON img property. Allow a 60-second client timeout and inspect the validation object before accepting a record.
import base64
import requests
with open("weighbridge-ticket.jpg", "rb") as file:
image = base64.b64encode(file.read()).decode("ascii")
response = requests.post(
"https://api.structocr.com/v1/weighbridge-ticket",
headers={"x-api-key": "YOUR_API_KEY", "Content-Type": "application/json"},
json={"img": image},
timeout=60,
)
response.raise_for_status()
result = response.json()
data = result["data"]
print("weights.gross.raw:", data["weights"]["gross"]["raw"])
print("weights.gross.normalized_kg:", data["weights"]["gross"]["normalized_kg"])
print("weights.tare.normalized_kg:", data["weights"]["tare"]["normalized_kg"])
print("weights.net.normalized_kg:", data["weights"]["net"]["normalized_kg"])
print("validation.calculated_net_kg:", data["validation"]["calculated_net_kg"])
print("validation.difference_kg:", data["validation"]["difference_kg"])
print("validation.weight_check_passed:", data["validation"]["weight_check_passed"])Validated JSON Response
A successful response contains extracted evidence and a separate validation decision for downstream automation.
{
"success": true,
"data": {
"is_weighbridge_ticket": true,
"document_type": "generic_weighbridge_ticket",
"ticket_number": "1042",
"facility": {
"name": "North Yard Scale",
"address": null,
"scale_id": "SCALE-2"
},
"parties": {
"supplier": null,
"customer": "Example Customer"
},
"job": {
"job_number": "JOB-88",
"order_number": null
},
"vehicle": {
"registration": "AB12 CDE",
"trailer_registration": null,
"fleet_number": null,
"driver_name": null
},
"material": {
"description": "Recycled aggregate",
"code": "RA20"
},
"weights": {
"gross": {
"value": 25330,
"unit": "kg",
"raw": "25,330 kg",
"normalized_kg": 25330
},
"tare": {
"value": 6770,
"unit": "kg",
"raw": "6,770 kg",
"normalized_kg": 6770
},
"net": {
"value": 18560,
"unit": "kg",
"raw": "18,560 kg",
"normalized_kg": 18560
}
},
"confidence": "high",
"is_valid": true,
"validation": {
"calculated_net_kg": 18560,
"difference_kg": 0,
"weight_check_passed": true,
"needs_review": false,
"review_reasons": []
}
}
}Frequently Asked Questions
Does net weight always equal gross minus tare?
That is the expected relationship for standard weighbridge tickets. The API reports the calculated value and difference but does not overwrite the printed net value.
What happens when gross is lower than tare?
The result is flagged for review with gross_weight_is_less_than_tare_weight. Your application should not accept it automatically.
Which files can I submit?
The endpoint accepts Base64-encoded JPG, PNG, WebP, and PDF content up to 4.5MB. Public URLs and multipart uploads are not currently accepted by the REST endpoint.
How much does one successful request cost?
A successful weighbridge ticket extraction costs 2 credits. New accounts receive 200 free credits, enough for up to 100 initial scans.
When is it safe to accept a ticket automatically?
Define the rule in your own workflow. A conservative starting point is to require is_weighbridge_ticket and is_valid to be true, confidence to meet your threshold, and validation.needs_review to be false. Keep a human review route for all other results.
Should I use the REST API or an SDK?
Use the REST API from any backend that can send Base64 JSON. The official Python and Node.js SDKs are convenient when you want local file validation, Base64 encoding, and consistent request handling without writing that plumbing yourself.
Explore More Weighbridge Ticket OCR Solutions
Quarry Load Ticket OCR
Extract quarry load ticket data including material, customer, vehicle, job, gross, tare, and net weight. Return validated JSON for aggregate operations.
Scale Ticket OCR API
Extract ticket, vehicle, material, gross, tare, and net weight from scale tickets. Validate weight calculations and return structured JSON through one API.
Convert a Weighbridge Slip to JSON
Convert weighbridge slips and scale tickets to structured JSON. Extract nested vehicle, material, gross, tare, net, timestamp, and validation fields.
Weight Ticket Data Extraction
Automate weight ticket data extraction for ERP and transport workflows. Capture vehicle, material, job, gross, tare, net, timestamps, and validation data.
Dump Ticket OCR API
Extract dump and disposal ticket fields including facility, vehicle, material, gross, tare, net weight, fee, and timestamps into validated JSON.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
Add Driver's License OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR Driver's License scanner API into a Lovable.dev app. Build car rental and mobility onboarding flows with zero backend.
Add HIN OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR HIN (Hull Identification Number) scanner API into a Lovable.dev app. Build marine and boat management tools with zero backend required.
Add Invoice OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR invoice API into a Lovable.dev app. No backend required — just paste a prompt and add your API key.
Add National ID OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API into a Lovable.dev app. Build KYC and identity verification flows with zero backend.
Add Passport OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API into a Lovable.dev app through a secure server-side function for travel and KYC flows.
Add Receipt OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR receipt API into a Lovable.dev app. No backend required — just paste a prompt and add your API key.
From tutorial to production in 5 minutes.
You've seen the code. Now get your API key, grab your 200 free credits, and see it work with your own images. No credit card required.