The Best Go API for Global License Plate OCR (Free Image Testing)

Deploy automated license plate recognition (ALPR) built for global scale. Upload a vehicle image for a free test today and extract native scripts and multi-plate layouts seamlessly using Golang.

Global License Plate OCR extraction process diagram
StructOCR transforms raw vehicle images into validated JSON with native script retention.

The Problem with Global ALPR Parsers in Go

Enterprise Go applications excel at concurrency and microservices, but often struggle when forced to use complex CGO bindings for legacy C++ ALPR libraries. These traditional tools fail when encountering complex layouts from the Middle East or Asia, and struggle to accurately extract native scripts (Arabic, Cyrillic, Thai, Chinese). Furthermore, generic models often lack the ability to process multi-plate setups, like tractor-trailer configurations, or identify secondary data such as plate colors and vehicle types.

The StructOCR Solution

StructOCR allows your Go backend to offload complex vehicle image processing to our specialized deep learning models without heavy CGO dependencies. Our API transcends generic models by accurately extracting native scripts worldwide exactly as printed. By returning validated JSON directly to your Golang application, you can easily integrate multi-dimensional attributes—including plate numbers, vehicle types, and country inferences—into your global logistics and tolling workflows. Explore our flexible pricing to scale your production environment seamlessly.

Common Use Cases

  • Toll Collection & Parking: Automate entry and exit gates globally by capturing primary plate numbers and vehicle classifications instantly.
  • Global Logistics & Border Control: Track multi-plate configurations (e.g., stacked trailer and prime mover plates) simultaneously across international borders.
  • Law Enforcement: Cross-reference vehicle types and plate colors to detect unregistered or commercial vehicles dynamically.

Live Demo: License Plate 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 200 License Plate scans).

Implementation: Raw API Request

Complete, runnable Go code to encode a vehicle image in Base64 and extract license plate data. For other language examples and deep parameter explanations, visit the full License Plate OCR API Reference.

Prerequisite: Go 1.18+ (Standard Library only)

CODE EXAMPLE
// 💰 Save 30%+ vs competitors. Get 200 free credits instantly:
// 👉 https://structocr.com/register

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/vehicle_image.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/license-plate", 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 License Plate data
	if success, ok := result["success"].(bool); ok && success {
		data := result["data"].(map[string]interface{})
		plates := data["plates"].([]interface{})

		fmt.Println("✅ Extraction Successful!")
		fmt.Printf("Plates Detected: %d\n", len(plates))

		countryGuess := "N/A"
		if cg, ok := data["country_guess"].(string); ok && cg != "" {
			countryGuess = cg
		}

		fmt.Printf("Country Guess: %s\n", countryGuess)
		fmt.Printf("Confidence: %s\n", data["confidence"])
		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

  • Input format: application/json payload with Base64 encoded string
  • File Constraints: Max 4.5MB (decoded), compress to < 300KB for best speed
  • Supported Formats: Standard Data URI schemas, raw Base64 strings (JPG, PNG, WebP)
  • Language Support: Global scripts (Arabic, Chinese, Thai, Cyrillic, etc.)
  • Output: JSON (Multi-dimensional attributes)

Key Features

  • Global Coverage: Optimized for worldwide plates spanning the Middle East, Asia, Europe, and the Americas.
  • Native Script Retention: Extracts local scripts exactly as printed without translation or transliteration.
  • Multi-Plate Parsing: Natively handles extracting multiple plates from a single vehicle (e.g., stacked trailer plates).

Sample JSON Response

The API returns a clean JSON array with details on all detected plates, preserving native characters and strict enums.

{
  "success": true,
  "data": {
    "plates": [
      {
        "plate_number": "TRE 1631M",
        "plate_color": "yellow",
        "plate_type": "trailer"
      },
      {
        "plate_number": "XB 98X",
        "plate_color": "yellow",
        "plate_type": "commercial"
      }
    ],
    "region_text": null,
    "country_guess": "Singapore",
    "confidence": "High"
  }
}

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 FILE_TOO_LARGE error.

Can it read non-English characters?

Yes. Our engine natively retains and extracts local scripts like Arabic, Thai, and Cyrillic exactly as printed.

You May Also Like

Related tutorials, platform guides, and comparisons

Tutorial

Node.js License Plate OCR API

Node.js License Plate OCR SDK tutorial. Upload an image for a free test! Accurately extract global license plates, native scripts, colors, and vehicle types.

Node.js · License Plate
Tutorial

C# License Plate OCR API

C# License Plate OCR tutorial. Upload an image for a free test! Accurately extract global license plates, native scripts, colors, and vehicle types.

C# · License Plate
Tutorial

Java License Plate OCR API

Java License Plate OCR tutorial. Upload an image for a free test! Accurately extract global license plates, native scripts, colors, and vehicle types.

Java · License Plate
Tutorial

Python License Plate OCR API

Python License Plate OCR SDK tutorial. Upload an image for a free test! Accurately extract global license plates, native scripts, colors, and vehicle types.

Python · License Plate
Tutorial

PHP License Plate OCR API

PHP License Plate OCR tutorial. Upload an image for a free test! Accurately extract global license plates, native scripts, colors, and vehicle types.

PHP · License Plate
Tutorial

Go National ID OCR API

Upload an image for a free test! High-accuracy National ID data extraction for Go developers. Get structured JSON output via a simple API call, replacing unreliable open-source tools.

Go · National ID
Country Tutorial

Czech Republic Passport OCR with Python SDK

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

Python · Passport
Country Tutorial

Czech Republic 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 Czech Republic passports.

Node.js · Passport
Country Tutorial

Czech Republic Občanský průkaz OCR Python SDK

Python Tutorial: Automate KYC in the Czech Republic. Extract Czech text with diacritics, Rodné číslo, and validate TD1 MRZ from Občanský průkaz.

Python · občanský průkaz
Country Tutorial

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

Node.js · Passport

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