South African Driving Licence OCR API

Read the South African driving licence from a photo and get the licence number, name, dates and classes as structured JSON. Upload an image below to test it free.

200 free credits = 100 Driver License scans, no credit card. Then from $5 for 500 credits, pay as you go. See pricing

Diagram of the API reading a South African driving licence and returning the fields as JSON.

What Makes the South African driving licence Hard to Parse

The South African driving licence is issued by the Department of Transport, through driving licence testing centres. The South African credit-card driving licence prints the holder's 13-digit ID number next to the licence number, along with licence codes such as A1, A, B, EB, C1, C, EC1 and EC and the card's validity dates (cards are renewed every five years). The PDF417 barcode on the back is encrypted, so it cannot be read like a North American licence barcode; reading the printed front is the practical way to capture the data.

One API Call, Named Fields

The StructOCR Driver License OCR API returns the licence number, the holder's name, ID number (returned as personal_number), date of birth, card validity dates and licence codes. Dates are returned as YYYY-MM-DD. Send a JPG, PNG, WebP or PDF as Base64 JSON or as a multipart upload; there is no SDK to embed in your app, although official Python and Node.js SDKs are available. Step-by-step code is in the Python guide. Usage is billed per successful scan with pay-as-you-go pricing.

Live Demo: Driver License 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 · PDF · TIFF  ·  up to 500 files · max 4.5 MB each

No document handy?

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

Where Teams Use It in South Africa

Fleet and Logistics

Track each driver's licence codes and card expiry date and remind them before renewal.

Lending and Insurance

Prefill name, ID number and date of birth from the licence during onboarding.

Ride-hailing and Delivery

Collect licence details for new drivers and couriers in one step.

Technical Specs

  • Endpoint: POST https://api.structocr.com/v1/driver-license
  • Input: JPG, PNG, WebP or PDF up to 4.5 MB, as Base64 JSON or multipart upload
  • Price: 2 credits per successful scan; new accounts get 200 free credits (100 scans)
  • Retention: Images and results are kept for at most 24 hours for quality spot-checks, then deleted

Key Features

  • Named fields: The licence number, the holder's name, ID number (returned as personal_number), date of birth, card validity dates and licence codes.
  • Normalized dates: Dates are returned as YYYY-MM-DD.
  • Good to know: The barcode on the back is encrypted and is not decoded by the PDF417 API. Photograph the front of the card instead.

Integration & AI Prompts

Install the official SDK and pass a photo of the licence. Full request and response details are in the driver license API reference.

# pip install structocr
import os
from structocr import StructOCR

client = StructOCR(api_key=os.environ["STRUCTOCR_API_KEY"])
result = client.scan_driver_license("licence.jpg")

if result.get("success"):
    data = result["data"]
    print(data["document_number"], data["surname"], data["date_of_expiry"])

Standardized JSON Output

An illustrative response for a South African driving licence, with fictional values.

{
  "success": true,
  "data": {
    "type": "drivers_license",
    "country_code": "ZAF",
    "region": null,
    "document_number": "1234567890AB",
    "personal_number": "9001015009087",
    "surname": "DLAMINI",
    "given_names": "THABO",
    "sex": null,
    "date_of_birth": "1990-01-01",
    "place_of_birth": null,
    "date_of_issue": "2024-02-01",
    "date_of_expiry": "2029-01-31",
    "date_of_first_issue": null,
    "issuing_authority": null,
    "address": null,
    "vehicle_class": "B, EB"
  }
}

Frequently Asked Questions

Can I test the South African driving licence scan for free?

Yes. Upload a photo in the live demo on this page without an account, or create an account to get 200 free credits, enough for 100 licence scans through the API.

Can the API read the barcode on the back?

No. South African licence barcodes are encrypted. Send a photo of the front, and the API reads the printed fields.

Does the response include the ID number?

Yes, when it is printed and legible it is returned as personal_number.

Do I need an SDK?

No. It is a plain REST API that accepts Base64 JSON or a multipart upload. Official Python and Node.js SDKs are available if you prefer them.

Explore More Driver License OCR Solutions

SOLUTION

Retail Sportsbook ID Scanning with a PDF417 API

Scan US driver licenses and state ID cards for retail sportsbooks. Pre-fill AAMVA fields from the PDF417 barcode and route unreadable cards to a retake.

Driver License OCR
SOLUTION

Staffing Agency Worker Onboarding with ID Barcodes

Scan US driver licenses and state ID cards for staffing agencies. Pre-fill AAMVA fields from the PDF417 barcode and route unreadable cards to a retake.

Driver License OCR
SOLUTION

Tattoo and Piercing Studio ID Checks with PDF417

Scan US driver licenses and state ID cards for tattoo and piercing studios. Pre-fill AAMVA fields from the PDF417 barcode and route unreadable cards to a retake.

Driver License OCR
SOLUTION

Telecom Customer Onboarding with Driver License PDF417

Use PDF417 and AAMVA parsing for telecom account opening. Pre-fill given_names, surname, date_of_birth, handle unreadable barcodes, and keep API credentials server-side.

Driver License OCR
SOLUTION

UAE Driving Licence OCR API

Extract the licence number, the holder's name, nationality where printed, date of birth, issue and expiry dates, the issuing authority and the permitted vehicle categories from the UAE driving licence as JSON with one API call. Try it free in the browser; new accounts get 100 free licence scans.

Driver License OCR
SOLUTION

UK Driving Licence OCR API

Extract name, licence number (field 5), address (field 8), dates and categories from UK DVLA driving licences as JSON. Free upload test and 100 free API scans.

Driver License OCR
SOLUTION

US Driver License Scanner API & SDK

Scan US driver's licenses from all 50 states with a REST API or our Python and Node SDKs. Extract name, DOB, address and the Document Discriminator (DD). 100 free scans.

Driver License OCR
SOLUTION

Vape and Tobacco Shop ID Verification with PDF417

Scan US driver licenses and state ID cards for vape and tobacco retailers. Pre-fill AAMVA fields from the PDF417 barcode and route unreadable cards to a retake.

Driver License OCR
SOLUTION

Vehicle Test-Drive License Scanning with PDF417

Use PDF417 and AAMVA parsing for automotive dealerships. Pre-fill document_number, given_names, surname, handle unreadable barcodes, and keep API credentials server-side.

Driver License OCR
SOLUTION

Visitor Management with Driver License PDF417 Data

Use PDF417 and AAMVA parsing for visitor registration. Pre-fill given_names, surname, document_number, handle unreadable barcodes, and keep API credentials server-side.

Driver License OCR

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