The Best Go API for Global Vehicle Registration OCR (Free Image Testing)

Extract text from worldwide vehicle registration documents using Golang. Upload a document image for a free test today and get standardized VINs and dynamically localized fields for SA, AE, VN, and DE seamlessly.

Global Vehicle Registration OCR extraction process diagram
StructOCR extracts standardized universal fields and dynamically mounts localized nodes based on the detected country.

The Problem with Parsing Global Registrations in Go

Enterprise Go applications excel at concurrency, but often struggle to parse vehicle registration documents across different international borders. Traditional tools lack the ability to handle both standard global fields, like a 17-character VIN, and unique localized fields specific to countries like Saudi Arabia or the UAE. Furthermore, generic OCR models often destroy native scripts during extraction rather than preserving them.

The StructOCR Solution

Our API allows your Go backend to automate data extraction from global vehicle registration documents effortlessly. It features a robust Standardized + Localized structure that unifies essential information like VIN, Make, and Model across all regions, while preserving native scripts in `_raw` fields. By sending a simple Base64 string via Go's native `net/http` package, you receive validated JSON with dynamically mounted region-specific data nodes and strictly enforced ISO 3779 VIN validation.

Common Use Cases

  • Global Fleet Management: Extract standardized VIN, make, and model to onboard fleet vehicles instantly across different countries.
  • Border Control & Logistics: Process region-specific documents like Saudi Istimara or UAE Mulkiya at borders with specialized localized schemas.
  • Insurance Verification: Safely validate 17-character VINs automatically by relying on enforced ISO 3779 rules that correct common OCR mistakes.

Live Demo: Passport 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 Passport scans).

Implementation: Raw API Request

Complete, runnable Go code to encode a vehicle document image in Base64 and extract registration data.

Prerequisite: Go 1.18+ (Standard Library only)

CODE EXAMPLE
package main

import (
	"bytes"
	"encoding/base64"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	apiKey := "YOUR_API_KEY" // Replace with your actual API key
	imagePath := "path/to/your/document.jpg" // Replace with the path to your image

	// 1. Read image and encode to Base64
	fileBytes, err := os.ReadFile(imagePath)
	if err != nil {
		fmt.Println("Error reading file:", err)
		return
	}
	base64Img := base64.StdEncoding.EncodeToString(fileBytes)

	// 2. Create JSON payload
	payload := map[string]string{"img": base64Img}
	jsonPayload, err := json.Marshal(payload)
	if err != nil {
		fmt.Println("Error marshaling JSON:", err)
		return
	}

	// 3. Build the HTTP request (Requires application/json)
	req, err := http.NewRequest("POST", "https://api.structocr.com/v1/vehicle-registration", bytes.NewBuffer(jsonPayload))
	if err != nil {
		fmt.Println("Error creating request:", err)
		return
	}
	req.Header.Set("x-api-key", apiKey)
	req.Header.Set("Content-Type", "application/json")

	fmt.Println("Uploading Base64 image to StructOCR API...")

	// 4. Send the request and receive the response
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Println("Error sending request:", err)
		return
	}
	defer resp.Body.Close()

	// 5. Parse the JSON response
	body, _ := io.ReadAll(resp.Body)
	var result map[string]interface{}
	if err := json.Unmarshal(body, &result); err != nil {
		fmt.Println("Error parsing response JSON:", err)
		return
	}

	// 6. Extract the Registration data
	if success, ok := result["success"].(bool); ok && success {
		data := result["data"].(map[string]interface{})
		fmt.Println("✅ Extraction Successful!")
		fmt.Println("\n--- Raw Data ---")
		prettyJSON, _ := json.MarshalIndent(data, "", "  ")
		fmt.Println(string(prettyJSON))
	} else {
		errorCode := "Unknown Code"
		if code, ok := result["code"].(string); ok { errorCode = code }
		errorMsg := "Unknown Error"
		if msg, ok := result["message"].(string); ok { errorMsg = msg }
		fmt.Printf("❌ Error [%s]: %s\n", errorCode, errorMsg)
	}
}

Technical Specs

  • Endpoint: POST https://api.structocr.com/v1/vehicle-registration
  • Input format: application/json payload with Base64 encoded string
  • File Constraints: Max 4.5MB (decoded). Compress to under 500 KB for best response time.
  • Supported Formats: Standard Data URI schemas, raw Base64 strings (JPG, PNG, WebP)
  • Output: JSON categorized into document, standardized, and localized nodes.

Key Features

  • Standardized + Localized Schema: Unifies universal specs while dynamically mounting localized fields for countries like SA, AE, VN, and DE.
  • Raw vs Normalized: Retains native language text in `_raw` fields and provides English standard terms in `_normalized` fields.
  • VIN Validation: Strictly enforces ISO 3779 rules for 17-character VIN extraction, safely correcting common OCR mistakes like 'O' to '0'.

Sample JSON Response

The API returns categorized data. This example shows a Saudi Arabia registration with standardized vehicle specs (using real brand and color entities) alongside purely structural mock data for local fields.

{
  "success": true,
  "data": {
    "document": {
      "country_code": "SA",
      "document_type": "VEHICLE_REGISTRATION",
      "confidence_score": 0.98
    },
    "standardized": {
      "vin": "FAKE0000000008888",
      "plate": {
        "number": "2468",
        "letters_normalized": "D E F",
        "formatted": "2468 DEF"
      },
      "make_raw": "هوندا",
      "make_normalized": "Honda",
      "model_raw": "سيدان",
      "model_normalized": "Sedan",
      "year": 2024,
      "color_raw": "أبيض",
      "color_normalized": "White"
    },
    "localized": {
      "saudi": {
        "tga_plate_details": {
          "sequence_number": "5566778899",
          "letter_right": "د",
          "letter_middle": "هـ",
          "letter_left": "و",
          "number": "2468",
          "plate_type_raw": "نقل خاص",
          "plate_type_normalized": "Private Transport"
        }
      }
    }
  }
}

Frequently Asked Questions

How should I encode the image?

Send the image as a Base64 encoded string wrapped in a JSON payload. The Base64 string must not contain any internal whitespaces or newlines.

What is the maximum file size?

The maximum decoded payload restriction is 4.5MB. Exceeding this will trigger a 413 Payload Too Large error.

What happens if a country isn't explicitly supported?

For countries without specific strict schemas, the engine automatically extracts key-value pairs into a generic `unmapped_fields` dictionary.

You May Also Like

Related tutorials, platform guides, and comparisons

Tutorial

PHP Vehicle Registration OCR API

PHP Vehicle Registration OCR API tutorial. Upload an image for a free test! Accurately extract standardized fields like VIN, make, and model, along with dynamically localized data for global documents.

PHP · Vehicle Reg.
Tutorial

Java Vehicle Registration OCR API

Java Vehicle Registration OCR API tutorial. Upload an image for a free test! Accurately extract standardized fields like VIN, make, and model, along with dynamically localized data for global documents.

Java · Vehicle Reg.
Tutorial

Node.js Vehicle Registration OCR API

Node.js Vehicle Registration OCR API tutorial. Upload an image for a free test! Accurately extract standardized fields like VIN, make, and model, along with dynamically localized data for global documents.

Node.js · Vehicle Reg.
Tutorial

Python Vehicle Registration OCR API

Python Vehicle Registration OCR API tutorial. Upload an image for a free test! Accurately extract standardized fields like VIN, make, and model, along with dynamically localized data for global documents.

Python · Vehicle Reg.
Tutorial

C# Vehicle Registration OCR API

C# Vehicle Registration OCR API tutorial. Upload an image for a free test! Accurately extract standardized fields like VIN, make, and model, along with dynamically localized data for global documents.

C# · Vehicle Reg.
Tutorial

Go VIN OCR API

Upload an image for a free test! Tutorial: How to use the StructOCR Go Client to extract data from VIN (Vehicle Identification Number)s. Includes code samples and JSON schema.

Go · VIN
Country Tutorial

France Passport OCR with Python SDK

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

Python · Passport
Country Tutorial

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

Node.js · Passport
Country Tutorial

Estonia ID-kaart OCR Python SDK

Python Tutorial: Automate KYC in Estonia. Extract data from the Estonian Identity Card (ID-kaart) using StructOCR Python SDK. Supports native text, Isikukood, and MRZ extraction.

Python · id-kaart
Country Tutorial

Ethiopia Fayda ID OCR Python SDK

Python Tutorial: Automate KYC in Ethiopia. Extract data from Fayda ID using StructOCR Python SDK. Supports native text.

Python · fayda id

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