Extract Weighbridge Tickets with Node.js

Use the official StructOCR Node.js SDK to return typed operational data from weighbridge tickets and validate gross, tare, and net weight.

Weighbridge ticket OCR workflow mapping ticket number, vehicle, gross, tare, and net weight into structured JSON
StructOCR converts a photographed weighbridge ticket into normalized JSON and validates gross minus tare against the printed net weight.

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 Node.js 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 Node.js.

Where Node.js 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.

1
Upload
2
Results

Drop files here or click to browse

JPG · PNG · WebP  ·  up to 500 files · max 4.5 MB each

No files selected
Need more testing? Create a free account to get 200 free credits (equals 100 Weighbridge Ticket scans).

Implementation: Node.js SDK

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: Node.js 18+ and `npm install structocr`

const StructOCR = require('structocr');

const client = new StructOCR(
  'YOUR_API_KEY',
  'https://api.structocr.com/v1',
  60000
);

const result = await client.scanWeighbridgeTicket('weighbridge-ticket.jpg');

if (result.success && result.data?.is_valid) {
  const { ticket_number, vehicle, material, weights, validation } = result.data;

  console.log('Ticket:', ticket_number);
  console.log('Vehicle:', vehicle?.registration);
  console.log('Material:', material?.description);
  console.log('Gross:', weights?.gross?.value, weights?.gross?.unit);
  console.log('Tare:', weights?.tare?.value, weights?.tare?.unit);
  console.log('Net:', weights?.net?.value, weights?.net?.unit);
  console.log('Weight check:', validation?.weight_check_passed);
} else {
  console.log('Review required:', result.data?.validation_error);
}

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

Tutorial

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.

Python · Weighbridge Ticket
Tutorial

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.

PHP · Weighbridge Ticket
Tutorial

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.

Java · Weighbridge Ticket
Tutorial

C# Weighbridge Ticket OCR API Tutorial

Integrate weighbridge ticket OCR in C# and .NET. Send a Base64 image and extract vehicle, material, gross, tare, net, and validation fields as JSON.

C# · Weighbridge Ticket
Tutorial

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.

Go · Weighbridge Ticket
Country Tutorial

Algeria Passport OCR with Node.js SDK

Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Algeria passports.

Node.js · Passport
Country Tutorial

Pakistan Passport OCR with Node.js SDK

Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Pakistan passports.

Node.js · Passport
Country Tutorial

Uzbekistan Passport OCR with Node.js SDK

Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Uzbekistan passports.

Node.js · Passport
Country Tutorial

Philippines Driver License OCR with Node.js SDK

Extract structured fields from a Philippines LTO driver's license with the StructOCR Node.js SDK and TypeScript + Express.

Node.js · Driver License
Tutorial

Node.js Driver License Verification API

Stop manual driver license checks. Our Node.js API delivers verified data in JSON within <4s, secured by AES-256 encryption and SOC2 compliance. Achieve 98.5% uptime. Upload an image for a free test!

Node.js · Driver License

Technical Comparisons & Integrations

Explore platform integrations and competitive analysis

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.

Instant Access Cancel Anytime 99.9% Uptime