The Best Java API for Global Vehicle Registration OCR (Free Image Testing)
Extract text from worldwide vehicle registration documents using Java. Upload a document image for a free test today and get standardized VINs and dynamically localized fields for SA, AE, VN, and DE seamlessly.
The Problem with Parsing Global Registrations in Java
Enterprise Java applications, especially those built on frameworks like Spring Boot or Jakarta EE, 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 Java 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 Java 11+'s native `HttpClient`, 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.
Implementation: Raw API Request
Complete, runnable Java 11+ code to encode a vehicle document image in Base64 and extract registration data.
Prerequisite: JDK 11+ and Gson library
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Base64;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
public class VehicleRegistrationOcr {
public static void main(String[] args) throws IOException, InterruptedException {
String apiKey = "YOUR_API_KEY"; // Replace with your actual API key
String imagePath = "path/to/your/document.jpg"; // Replace with the path to your image
// 1. Read image and encode to Base64
byte[] fileContent = Files.readAllBytes(Path.of(imagePath));
String base64Img = Base64.getEncoder().encodeToString(fileContent);
// 2. Create JSON payload
JsonObject payload = new JsonObject();
payload.addProperty("img", base64Img);
String jsonPayload = new Gson().toJson(payload);
// 3. Build the HTTP request (Requires application/json)
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.structocr.com/v1/vehicle-registration"))
.header("x-api-key", apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
System.out.println("Uploading Base64 image to StructOCR API...");
// 4. Send the request and receive the response
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
// 5. Parse the JSON response
Gson gson = new Gson();
JsonObject jsonResponse = gson.fromJson(response.body(), JsonObject.class);
// 6. Extract the Registration data
if (jsonResponse.has("success") && jsonResponse.get("success").getAsBoolean()) {
JsonObject data = jsonResponse.getAsJsonObject("data");
System.out.println("✅ Extraction Successful!\n");
System.out.println("--- Raw Data ---");
System.out.println(new Gson().toJson(data));
} else {
String errorCode = jsonResponse.has("code") ? jsonResponse.get("code").getAsString() : "Unknown Code";
String errorMsg = jsonResponse.has("message") ? jsonResponse.get("message").getAsString() : "Unknown Error";
System.out.println("❌ Error [" + 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.99
},
"standardized": {
"vin": "FAKE0000000005555",
"plate": {
"number": "8899",
"letters_normalized": "J K L",
"formatted": "8899 JKL"
},
"make_raw": "نيسان",
"make_normalized": "Nissan",
"model_raw": "سيدان",
"model_normalized": "Sedan",
"year": 2019,
"color_raw": "أخضر",
"color_normalized": "Green"
},
"localized": {
"saudi": {
"tga_plate_details": {
"sequence_number": "6677889900",
"letter_right": "ي",
"letter_middle": "ك",
"letter_left": "ل",
"number": "8899",
"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
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.
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.
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.
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.
Go Vehicle Registration OCR API
Golang 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 Passport OCR API
Extract passport MRZ and VIZ data in Java. Upload an image for a free test! Our API provides structured JSON output, handling glare and blur automatically.
Japan 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 Japan passports.
Italy Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Italy passports with a server-side integration.
Italy Carta di Identità OCR Python SDK
Python Tutorial: Automate KYC in Italy. Extract data from Carta di Identità Elettronica (CIE) using StructOCR Python SDK. Supports native text, Codice Fiscale, and MRZ extraction.
Italy 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 Italy passports.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
Add Passport OCR to Your Bolt.new App in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API into a Bolt.new app. Build travel, hospitality, and global KYC flows right in your browser.
Add Receipt OCR to Your Bolt.new App in 5 Minutes
Step-by-step guide to integrating the StructOCR receipt API into a Bolt.new app. Build expense tracking and receipt scanning tools right in your browser.
Add VIN OCR to Your Bolt.new App in 5 Minutes
Step-by-step guide to integrating the StructOCR VIN scanner API into a Bolt.new app. Build automotive and fleet tools right in your browser.
Add Container OCR using Cursor in 5 Minutes
Step-by-step guide to integrating the StructOCR shipping container API using the Cursor AI code editor. Build logistics and yard management tools rapidly.
Add Driver's License OCR using Cursor in 5 Minutes
Step-by-step guide to integrating the StructOCR Driver's License scanner API using the Cursor AI code editor. Build car rental and mobility onboarding flows rapidly.
Add HIN OCR using Cursor in 5 Minutes
Step-by-step guide to integrating the StructOCR HIN (Hull Identification Number) scanner API using the Cursor AI code editor. Build marine and boat management tools rapidly.
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.