Call a Weighbridge Ticket OCR API from C#
Send Base64 ticket images from .NET and map normalized weights, vehicle data, and validation signals into your transport application.

Why Weighbridge Tickets Need More Than Plain OCR
A scale ticket may place the same three measurements in different rows, reverse the order of the first and second weighing, abbreviate units, or mix ticket, vehicle, job, and material identifiers. A generic OCR engine returns text but leaves your application to decide which value is gross, tare, or net. That brittle parsing becomes harder across quarry, waste, grain, logistics, and recycling layouts.
A Structured C# / .NET Workflow
The StructOCR Weighbridge Ticket OCR API returns a stable schema for ticket, facility, vehicle, material, and weight data. It preserves each printed value, normalizes supported units to kilograms, and runs deterministic gross-minus-tare validation. Test a sample first with the free weighbridge ticket scanner, then use the same endpoint in C# / .NET.
Where C# / .NET Teams Use Weighbridge OCR
- Transport and Dispatch: Match ticket numbers and vehicle registrations to loads without retyping paper tickets.
- Quarry and Waste Operations: Capture material, customer, job, gross, tare, and net values for downstream reconciliation.
- Exception Review: Route missing weights, unit issues, or printed net mismatches to a human using machine-readable review reasons.
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
Implementation: C# with HttpClient
The request uses POST /v1/weighbridge-ticket. Send one Base64-encoded JPG, PNG, WebP, or PDF in the img property and allow a 60-second client timeout. See the complete API reference for the full response and error contract.
Prerequisite: .NET 8+ and `System.Net.Http.Json`
using System.Net.Http.Json;
using System.Text.Json;
using var http = new HttpClient { Timeout = TimeSpan.FromSeconds(60) };
http.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY");
var bytes = await File.ReadAllBytesAsync("weighbridge-ticket.jpg");
var payload = new { img = Convert.ToBase64String(bytes) };
using var response = await http.PostAsJsonAsync(
"https://api.structocr.com/v1/weighbridge-ticket",
payload
);
response.EnsureSuccessStatusCode();
using var result = JsonDocument.Parse(await response.Content.ReadAsStringAsync());
var data = result.RootElement.GetProperty("data");
Console.WriteLine($"Ticket: {data.GetProperty("ticket_number").GetString()}");
Console.WriteLine($"Net kg: {data.GetProperty("weights").GetProperty("net").GetProperty("normalized_kg")}");
Console.WriteLine($"Needs review: {data.GetProperty("validation").GetProperty("needs_review")}");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
- •Raw plus normalized weights: Preserve printed text while receiving numeric values and normalized_kg.
- •Transparent arithmetic: calculated_net_kg, difference_kg, and weight_check_passed explain the validation result.
- •Review routing: needs_review and review_reasons identify missing fields, unit problems, and mismatches.
- •Wrong-document handling: Unrelated documents return is_weighbridge_ticket false instead of a forced ticket result.
Example Validated JSON Response
The API separates extracted fields from deterministic validation so your application can store the record and make an explicit review decision.
{
"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"
},
"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_error": null,
"validation": {
"calculated_net_kg": 18560,
"difference_kg": 0,
"weight_check_passed": true,
"needs_review": false,
"review_reasons": []
}
}
}Frequently Asked Questions
Which weighbridge ticket layouts are supported?
The endpoint handles general weighbridge and scale tickets, weighment slips, quarry load tickets, dump or disposal tickets, and grain scale tickets. Unknown but valid layouts use a generic weighbridge ticket classification.
Does the model calculate net weight?
The model only extracts printed values. Application code separately calculates gross minus tare, compares it with the printed net value, and returns the difference and review reasons.
Can I upload a file directly to the REST endpoint?
The REST endpoint currently accepts JSON containing a Base64 value or data URI in the img property. The official Python and Node.js SDKs read local files and perform that encoding for you.
How should I handle a low-confidence result?
Check is_valid, confidence, validation.needs_review, and validation.review_reasons before posting the record into an operational system. Retain a human review path for flagged tickets.
You May Also Like
Related tutorials, platform guides, and comparisons
PHP Weighbridge Ticket OCR API Tutorial
Integrate weighbridge ticket OCR in PHP. Extract ticket number, vehicle, material, gross, tare, net, and validation data from Base64 images.
Python Weighbridge Ticket OCR API Tutorial
Build a Python weighbridge ticket OCR workflow. Extract ticket, vehicle, material, gross, tare, and net weights into validated JSON with the StructOCR SDK.
Node.js Weighbridge Ticket OCR API Tutorial
Build a Node.js weighbridge ticket OCR integration. Extract ticket, vehicle, material, gross, tare, and net weights with the official StructOCR SDK.
Go Weighbridge Ticket OCR API Tutorial
Build a Go weighbridge ticket OCR client. Send Base64 images and parse vehicle, material, gross, tare, net, and weight validation results.
Java Weighbridge Ticket OCR API Tutorial
Integrate a weighbridge ticket OCR API in Java. Extract ticket, vehicle, material, gross, tare, net, and review signals from images or PDFs.
C# HIN (Hull Identification Number) OCR API
Upload an image for a free test! Tutorial: How to use the StructOCR C# Client to extract structured data from Hull Identification Numbers (HIN). Includes complete code samples, JSON schema, and marine-optimized solutions.
C# Receipt OCR API
Upload an image for a free test! Integrate a robust Receipt OCR API into your C# .NET app. Accurately extract merchants, line items, taxes, and tips from crumpled thermal receipts.
C# Driver's License OCR API
Upload an image for a free test! High-accuracy C# Driver's License OCR API. Get structured JSON output from images, parse PDF417 barcodes, and eliminate manual entry errors.
C# National ID OCR API
Upload an image for a free test! Eliminate manual data entry for national IDs. Integrate hybrid VIZ + MRZ validation into your .NET apps. This C# OCR API delivers structured JSON in <5s average latency, backed by 98.5% uptime SLA and AES-256 encryption.
C# Shipping Container OCR API
Upload an image for a free test! Tutorial: Learn how to use the StructOCR C# Client to extract data from Shipping Containers. Extract ISO 6346 container numbers with 99% accuracy. Includes code samples and JSON schemas.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
AWS Textract vs. StructOCR API for Indian Passport Back Page Extraction
Why generic OCR fails at parsing the back page of Indian passports, and how a dedicated KYC API instantly extracts structured addresses, PIN codes, and family details.
AWS Textract & Google Vision vs. StructOCR Passport API
Why generic cloud OCR APIs fail at structured KYC automation, and why developers choose specialized Passport APIs instead.
Add Container OCR to Your Bolt.new App in 5 Minutes
Step-by-step guide to integrating the StructOCR shipping container API into a Bolt.new app. Build logistics and yard management tools right in your browser.
Add Driver's License OCR to Your Bolt.new App in 5 Minutes
Step-by-step guide to integrating the StructOCR Driver's License scanner API into a Bolt.new app. Build car rental and mobility onboarding flows right in your browser.
Add HIN OCR to Your Bolt.new App in 5 Minutes
Step-by-step guide to integrating the StructOCR HIN (Hull Identification Number) scanner API into a Bolt.new app. Build marine and boat management tools right in your browser.
Invoice OCR API Integration for Bolt.new
Learn how to integrate our Invoice OCR API into a Bolt.new app in under 5 minutes. Extract structured JSON effortlessly. Try our free live test now.
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.