Canada Provincial ID Card PDF417 Barcode API
Parse AAMVA-compliant barcodes on Canadian provincial ID cards and driver licences with the same API used for US cards.
Canadian Records Differ in Small but Important Ways
Canadian jurisdictions that follow the AAMVA card standard print a PDF417 barcode on the back of licences and many provincial photo ID cards. The records use year-first dates, six-character postal codes, metric heights, and the CAN country code. A parser tuned only to US samples can misread dates or postal codes and silently store wrong values.
Normalized Output for Canadian Cards
Send the card back to the PDF417 API. StructOCR parses the AAMVA DL/ID record, normalizes dates to YYYY-MM-DD whichever order the issuer used, keeps postal codes as encoded, and returns document_kind so ID cards are not mistaken for licences. Cards without an AAMVA barcode return a clear 422 error instead of guessed fields.
Where ID Card Barcodes Show Up
- Cross-border onboarding: Serve US and Canadian customers with one integration and one JSON schema.
- Age-gated sales: Read date of birth from provincial ID cards and licences at cannabis and alcohol retail.
- Rental and travel: Use document_kind to require a licence for vehicle rental while accepting ID cards for other check-ins.
Decode a Canadian Card Back
Upload a JPG, PNG, or WebP image with the full barcode visible. Check country_code and document_kind in the response.
Prerequisite: A server-side StructOCR API key and a clear image of the complete card back
curl -X POST https://api.structocr.com/v1/driver-license-pdf417 \
-H "x-api-key: $STRUCTOCR_API_KEY" \
-F "file=@provincial-id-back.jpg"Technical Specs
- •Endpoint: POST https://api.structocr.com/v1/driver-license-pdf417 (same endpoint for driver licenses and ID cards)
- •Authentication: x-api-key request header
- •Inputs: JPG, PNG, or WebP; Base64 JSON or multipart upload
- •Maximum file size: 4.5MB
- •Price: 2 credits for a successful decode; processing failures are refunded
- •Document kind: `document_kind` is `id_card` for identification-card records and `driver_license` for licenses
- •Country output: country_code is CAN and region is the province code when encoded in the record
- •Important: Parsing barcode data does not by itself authenticate the credential or the person presenting it
Key Features
- •One integration for both cards: Licenses and non-driver ID cards share the AAMVA PDF417 layout, so the same request handles both.
- •Explicit document kind: Branch on `document_kind` instead of guessing from missing license class fields.
- •Date normalization: Year-first Canadian dates and month-first US dates both return as YYYY-MM-DD.
- •Retake-safe errors: PDF417_NOT_DECODED returns HTTP 422 with an optional `capture_issue` hint such as `out_of_focus` or `image_too_small`.
Illustrative Canadian ID Card Response
This response uses wholly fictional data. Available optional elements depend on what the issuing province encodes.
{
"success": true,
"data": {
"type": "drivers_license",
"document_kind": "id_card",
"source": "pdf417",
"country_code": "CAN",
"region": "AB",
"document_number": "SAMPLEID123",
"surname": "SAMPLE",
"given_names": "ALEX MORGAN",
"first_name": "ALEX",
"middle_name": "MORGAN",
"name_suffix": null,
"sex": "F",
"date_of_birth": "1990-01-15",
"date_of_issue": "2025-01-15",
"date_of_expiry": "2033-01-15",
"address": "100 EXAMPLE AVE",
"city": "SAMPLE CITY",
"postal_code": "T5J 0A1",
"vehicle_class": null,
"restrictions": null,
"endorsements": null,
"height": null,
"eye_color": null,
"document_discriminator": "SAMPLE-DISCRIMINATOR",
"issuer_identification_number": "636000",
"aamva_version": 10,
"jurisdiction_version": 0
}
}Frequently Asked Questions
Do all Canadian ID cards have a PDF417 barcode?
No. Barcode use varies by province and card generation. The API supports cards whose back carries an AAMVA-compliant PDF417 record; other cards return a 422 error so your flow can fall back to manual review or front-side OCR.
Are Canadian dates and postal codes handled?
Yes. Dates are normalized to YYYY-MM-DD whether the record is year-first or month-first, and Canadian postal codes are returned as encoded.
Does a successful decode verify the cardholder?
No. It proves a usable barcode payload was decoded and parsed. Identity, authenticity, and eligibility decisions require separate controls.
You May Also Like
Related tutorials, platform guides, and comparisons
Arkansas Driver License OCR: Extract Fields with Python
Extract visible fields from Arkansas driver license images into JSON. Map identifiers, names and dates, with a review workflow for incomplete results.
PHP Driver License OCR SDK
Struggling with manual driver's license data entry? Our PHP OCR SDK provides AES-256 encrypted data extraction in seconds, backed by SOC 2 Type II. Upload an image for a free test!
Hawaii Driver License OCR: Extract Fields with Python
Extract visible fields from Hawaii driver license images into JSON. Map identifiers, names and dates, with a review workflow for incomplete results.
Python Driver License OCR SDK & API
Stop struggling with manual data entry. Integrate our driver license OCR SDK (Python wrapper) to extract structured JSON in <3s. Upload an image for a free test! Secure, accurate, and developer-friendly.
Nigeria Driver License OCR: Extract Fields with Python
Extract visible fields from Nigeria driver license images into JSON. Map identifiers, names and dates, with a review workflow for incomplete results.
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.
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.
Brazil Driver License OCR with Node.js SDK
Extract structured fields from a Brazil Carteira Nacional de Habilitação (CNH) with the StructOCR Node.js SDK and TypeScript + Express.
Cloudflare Workers PDF417 Driver License API
Build an edge API proxy that decodes US driver license PDF417 barcodes and returns normalized AAMVA JSON with safe retake handling.
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.
Go State ID Card PDF417 API Tutorial
Decode US state and Canadian provincial ID card PDF417 barcodes with Go. Parse AAMVA fields and tell ID cards from driver licenses.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
Add Driver's License OCR to Your Bolt.new App in 5 Minutes
Step-by-step guide to integrating the StructOCR Driver's License scanner API into a Bolt.new app. Build car rental and mobility onboarding flows right in your browser.
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 Driver's License OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR Driver's License scanner API into a Lovable.dev app. Build car rental and mobility onboarding flows with zero backend.
Add Driver's License OCR to Your Replit App in 5 Minutes
Step-by-step guide to integrating the StructOCR Driver's License scanner API into a Replit application. Build car rental and mobility onboarding flows using Replit Agent and Secrets.
Add Driver's License OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR Driver's License scanner API into a v0 by Vercel app. Build car rental and mobility onboarding flows with zero backend.
AWS Textract vs. StructOCR API for Indian Passport Back Page Extraction
Why generic OCR fails at parsing the back page of Indian passports, and how a dedicated KYC API instantly extracts structured addresses, PIN codes, and family details.
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.