Brazil Driver License OCR with Node.js SDK

Send a Carteira Nacional de Habilitação (CNH) to the official Node.js SDK and receive normalized identity, validity and licence fields.

Brazil driver license OCR workflow
A server-side Node.js SDK workflow for Brazil driver licence data.

Reading Brazil Driver Licenses

The CNH includes Brazilian identity references, licence category and first-licence information in a dense card layout. Manual transcription adds delays and creates avoidable formatting errors when a team needs to move licence data into onboarding, rental or mobility systems.

A Server-Side Node.js SDK Workflow

The StructOCR driver license endpoint accepts a Base64-encoded image or PDF and returns normalized fields that are visible on the document. Typical results include the document number, holder name, dates, issuing region, address and vehicle class; optional fields may be null when they are absent or unreadable.

Common Integration Scenarios

  • Vehicle rental: Pre-fill customer and licence details before a vehicle handover.
  • Driver onboarding: Move visible licence fields into a review queue without retyping the card.
  • Fleet operations: Capture licence classes and validity dates for internal driver records.

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 · 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 Driver License scans).

Brazil Driver License OCR with Node.js SDK

The official Node.js SDK reads a supported local file and calls /v1/driver-license. Open the TypeScript + Express tab for a server route using the same SDK method.

Prerequisite: `npm install structocr`; set the server-side `STRUCTOCR_API_KEY` environment variable.

Prefer another stack? Open the Python SDK + FastAPI integration.

const StructOCR = require("structocr");

const client = new StructOCR(process.env.STRUCTOCR_API_KEY);

async function main() {
  const result = await client.scanDriverLicense("driver-license.jpg");

  if (result.success) {
    const data = result.data;
    console.log(data.document_number);
    console.log(data.given_names, data.surname);
  } else {
    console.error(result.error);
  }
}

main().catch(console.error);

Technical Specs

  • Endpoint: POST /v1/driver-license
  • Input: Base64-encoded JPG, PNG, WebP, or PDF in JSON (Max 4.5MB)
  • Authentication: Server-side x-api-key header handled by the SDK
  • Cost: 2 credits per scan
  • Output: Structured JSON

Key Features

  • Regional output: Returns country and issuing region when visible.
  • Licence fields: Extracts document number, validity dates and vehicle class when present.
  • Identity fields: Returns the printed holder name, birth details and address when readable.
  • Optional details: Preserves supported country-specific fields under extra_details.

JSON Response Example

Fields are returned when present and legible on the submitted licence; country-specific details may appear in extra_details.

{
  "success": true,
  "data": {
    "type": "drivers_license",
    "country_code": "BRA",
    "region": "São Paulo",
    "document_number": "01234567890",
    "personal_number": "123.456.789-00",
    "surname": "SILVA",
    "given_names": "ANA PAULA",
    "sex": "F",
    "date_of_birth": "1991-03-12",
    "place_of_birth": "CAMPINAS SP",
    "date_of_issue": "2024-05-20",
    "date_of_expiry": "2034-05-20",
    "date_of_first_issue": "2010-07-15",
    "issuing_authority": "DETRAN SP",
    "address": null,
    "vehicle_class": "AB",
    "extra_details": {
      "fathers_name": "CARLOS SILVA",
      "mothers_name": "LUCIA SILVA",
      "rg_number": "12.345.678-9"
    }
  }
}

Frequently Asked Questions

Which fields can the Brazil driver license API return?

The response can include country_code, region, document_number, personal_number, surname, given_names, sex, birth details, issue and expiry dates, issuing_authority, address, vehicle_class and extra_details. Fields not present or not legible can be null.

Can I use the other SDK language?

Yes. This tutorial has a paired Python and FastAPI version linked in the integration section.

You May Also Like

Related tutorials, platform guides, and comparisons

Country Tutorial

Brazil Driver License OCR with Python SDK

Extract structured fields from a Brazil Carteira Nacional de Habilitação (CNH) with the StructOCR Python SDK and FastAPI.

Python · Driver License
Tutorial

Node.js Driver License Verification API

Stop manual driver license checks. Our Node.js API delivers verified data in JSON within <4s, secured by AES-256 encryption and SOC2 compliance. Achieve 98.5% uptime. Upload an image for a free test!

Node.js · Driver License
Country Tutorial

US Driver License OCR with Node.js SDK

Extract structured fields from a United States state-issued driver license with the StructOCR Node.js SDK and TypeScript + Express.

Node.js · Driver License
Country Tutorial

Philippines Driver License OCR with Node.js SDK

Extract structured fields from a Philippines LTO driver's license with the StructOCR Node.js SDK and TypeScript + Express.

Node.js · Driver License
Country Tutorial

Canada Driver License OCR with Node.js SDK

Extract structured fields from a Canada provincial driver licence with the StructOCR Node.js SDK and TypeScript + Express.

Node.js · Driver License
Country Tutorial

Australia Driver License OCR with Node.js SDK

Extract structured fields from a Australia state or territory driver licence with the StructOCR Node.js SDK and TypeScript + Express.

Node.js · Driver License
Country Tutorial

UK Driver License OCR with Node.js SDK

Extract structured fields from a United Kingdom photocard driving licence with the StructOCR Node.js SDK and TypeScript + Express.

Node.js · Driver License
Tutorial

C# Driver's License OCR API

Upload an image for a free test! High-accuracy C# Driver's License OCR API. Get structured JSON output from images, parse PDF417 barcodes, and eliminate manual entry errors.

C# · Driver License
Country Tutorial

Australia Driver License OCR with Python SDK

Extract structured fields from a Australia state or territory driver licence with the StructOCR Python SDK and FastAPI.

Python · Driver License
Country Tutorial

Canada Driver License OCR with Python SDK

Extract structured fields from a Canada provincial driver licence with the StructOCR Python SDK and FastAPI.

Python · Driver License

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