The Best Node.js Library for Shipping Container OCR

Stop using regex. Extract structured data from shipping containers using Node.js.

The Problem with Shipping Container Parsing

Shipping container parsing is notoriously difficult. Challenges include container numbers printed vertically, extreme rust and wear, skewed angles from terminal cameras, low-light conditions, and physical damage. Traditional methods relying on regex or standard text recognition libraries fail to handle these severe environmental variations, resulting in low accuracy and automated gate bottlenecks.

The StructOCR Solution

StructOCR leverages advanced AI and deep learning models specifically trained on shipping container data, offering a robust ISO 6346 compliant extraction. Our solution automatically deskews images, isolates the container ID, and intelligently extracts data, even from challenging vertical text, to optimize logistics workflows. We handle rust, glare, and non-standard layouts with ease, returning validated JSON in seconds.

Common Use Cases

  • Terminal Automation: Speed up gate operations and yard management by instantly capturing container numbers.
  • Customs & Compliance: Automate cross-border document verification and manifesting.
  • Asset Tracking: Monitor shipping container movements across the global supply chain with real-time data.
Need more testing? Create a free account to get 200 free credits (equals 200 Container scans).

Implementation: Using the SDK

Complete, runnable Node.js code to extract data from a Shipping Container.

Prerequisite: npm install structocr

NODE EXAMPLE
// Get 200 free credits:
// 👉 https://structocr.com/register

const StructOCR = require('structocr');

async function scanShippingContainer(imagePath) {
  // Initialize the SDK with your API Key
  const client = new StructOCR('YOUR_API_KEY');

  try {
    console.log(`Scanning container image: ${imagePath}...`);
    
    // The SDK handles file reading and API communication
    const result = await client.scanContainer(imagePath);

    if (result.success) {
      console.log('✅ Extraction Successful!\n');
      
      const { data } = result;
      console.log('Container Number:', data.container_number);
      console.log('Is Valid (ISO 6346):', data.is_valid);
      console.log('Confidence:', data.confidence, '\n');

      const parsed = data.parsed;
      console.log('--- Parsed Details ---');
      console.log('Owner Code:', parsed.owner_code);
      console.log('Category:', parsed.category);
      console.log('Serial Number:', parsed.serial_number);
      console.log('Check Digit:', parsed.check_digit);

    } else {
      console.error('❌ Extraction Failed:', result.error);
    }
  } catch (error) {
    console.error('SDK Error:', error.message);
    if (error.cause) {
      console.error('Underlying Error:', error.cause);
    }
  }
}

// Example usage:
scanShippingContainer('path/to/your/container_image.jpg');

Technical Specs

  • •Latency: < 4s (Average)
  • •Availability: Served from Cloudflare's global edge network
  • •Security: AES-256 Encryption & SOC2 Compliant
  • •Input: JPG, PNG, WebP (Max 4.5MB)
  • •Output: JSON (Structured Data)

Key Features

  • •Smart Crop: Auto-detects container boundaries.
  • •ISO 6346 Validation: Cross-validates owner codes and checksums automatically.
  • •Specialized Models: Trained specifically on vertical and degraded Shipping Container text.

Sample JSON Response

The API returns a clean JSON object with normalized, parsed container fields.

{
  "success": true,
  "data": {
    "container_number": "TTNU5194822",
    "is_valid": true,
    "confidence": "High",
    "parsed": {
      "owner_code": "TTN",
      "category": "U",
      "serial_number": "519482",
      "check_digit": "2"
    }
  }
}

Frequently Asked Questions

What file formats are supported?

JPG, PNG, and WebP images up to 4.5MB.

Is data stored?

Only briefly. Uploaded images and results are kept for at most 24 hours for quality spot-checks, then deleted.

How to handle errors?

Check the 'success' flag and 'error' message in the response.

You May Also Like

Related tutorials, platform guides, and comparisons

Tutorial

Python Shipping Container OCR API

Tutorial: Learn how to use the StructOCR Python SDK for shipping container OCR. Upload an image for a free test! Extract ISO 6346 container numbers and check them against the ISO check digit. Includes code samples and JSON schemas.

Python · Container
Tutorial

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 and check them against the ISO check digit. Includes code samples and JSON schemas.

C# · Container
Tutorial

PHP Shipping Container OCR API

Tutorial: Learn how to use the StructOCR PHP Client via cURL for shipping container OCR. Upload an image for a free test! Extract ISO 6346 container numbers and check them against the ISO check digit. Includes code samples and JSON schemas.

PHP · Container
Tutorial

Java Shipping Container OCR API

Upload an image for a free test! Tutorial: Learn how to use the StructOCR Java Client to extract data from Shipping Containers. Extract ISO 6346 container numbers and check them against the ISO check digit.

Java · Container
Tutorial

Go Shipping Container OCR API

Upload an image for a free test! Tutorial: Learn how to use the StructOCR Go Client to extract data from Shipping Containers. Extract ISO 6346 container numbers and check them against the ISO check digit. Includes code samples and JSON schema.

Go · Container
Country Tutorial

Kenya 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 Kenya passports.

Node.js · Passport
Country Tutorial

Kazakhstan 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 Kazakhstan passports.

Node.js · Passport
Country Tutorial

Japan Passport OCR with Python SDK

Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Japan passports with a server-side integration.

Python · Passport
Country Tutorial

Kazakhstan Passport OCR with Python SDK

Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Kazakhstan passports with a server-side integration.

Python · Passport
Country Tutorial

Kazakhstan Identity Card (Udostoverenie) OCR Python SDK

Python Tutorial: Automate KYC in Kazakhstan. Extract dual-script data, the 12-digit IIN, and validate TD1 MRZ from Identity Card (Udostoverenie) using StructOCR Python SDK.

Python · identity card (udostoverenie)

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 No Credit Card