n8n Workflow10 min setupNo code required

Automate US & Canadian Driver License Verification in n8n

Send front and back driver's license photos (including native iPhone HEIC) from an n8n Form or Webhook to POST /v1/driver-license-verify, cross-check printed text against the back AAMVA PDF417 barcode, and route Approved, Retake (422 auto-refunded), or Manual Review decisions automatically.

US driver license back PDF417 barcode decoded and cross-checked with front printed identity fields in an automated n8n verification workflow.
One n8n HTTP Request node sends both front and back license photos and routes Approved, Retake (auto-refunded 422), or Manual Review outcomes.

Why pair n8n with StructOCR POST /v1/driver-license-verify

n8n is great for orchestrating onboarding forms, Slack alerts, and CRM records, but it cannot decode dense AAMVA PDF417 barcodes or reconcile front-side OCR with back-side barcode fields across 50 US states and 13 Canadian provinces. StructOCR's zero-retention POST /v1/driver-license-verify endpoint runs deterministic back-side PDF417 decoding first, extracts printed front fields, compares core identity fields plus Document Discriminator (DD vs. DCF), and returns a single decision payload. Want to skip manual wiring? Download the ready-to-import n8n workflow JSON (n8n: Workflows → Import from File) with dual-file Form Trigger, HTTP Request node, outcome Code node, and 3-way Switch router.

Why front-only ID OCR breaks automated onboarding in n8n

Reading only the front photo of a driver's license inside an automation workflow cannot catch an edited date of birth or altered license number when the back AAMVA PDF417 barcode was never re-encoded. Conversely, wiring two separate OCR and barcode services in n8n forces you to maintain fragile state-by-state normalization rules for middle initials, suffixes, and Document Discriminators across 63 US and Canadian jurisdictions—while mobile-SDK vendors require sales-gated annual contracts.

One zero-retention endpoint built for n8n Switch routing

StructOCR's Driver License Verification API (POST /v1/driver-license-verify) combines deterministic back-side AAMVA PDF417 decoding, front-side OCR, and deterministic cross-checking in a single REST request. Back barcode decoding runs first so blurry uploads return HTTP 422 with a full 4-credit refund and zero wasted spend. Review every response field in the API reference, test a single barcode first in our free PDF417 scanner, or compare pay-as-you-go pricing against enterprise SDKs in our 9-vendor pricing comparison matrix.

Build the n8n verification workflow (5 nodes)

  1. Capture front and back photos in a Form or Webhook trigger

    Add an n8n Form Trigger (or a Webhook node accepting multipart uploads from your web/mobile app) with two required file fields named front and back, plus an optional numeric field min_age (for example 21 for alcohol/cannabis delivery or 25 for car rentals).

    Supported formats: JPG, PNG, WebP, and native iPhone HEIC/HEIF (up to 4.5 MB per image). Do not downsample or JPEG-recompress back barcode photos before upload—sharp barcode edges minimize 422 retakes.
  2. Store your StructOCR API key using Header Auth

    In n8n Credentials, create a Header Auth credential with Name x-api-key and Value set to your StructOCR API key. Using credentials keeps secrets out of exported workflow JSON files.

    New accounts include 200 permanent free credits (50 full front+back verifications at 4 credits each) with no credit card required at structocr.com/register.
    Credential type: Header Auth Name: x-api-key Value: <your StructOCR API key>
  3. Configure the HTTP Request node for POST /v1/driver-license-verify

    Add an HTTP Request node set to POST https://api.structocr.com/v1/driver-license-verify with Body Content Type Form-Data. Attach two n8n Binary File parameters named front and back mapped to your trigger's binary keys, plus an optional Form Data parameter min_age.

    Enable Options → Response → Never Error. When a back PDF417 barcode is too blurry or glared to read, StructOCR returns HTTP 422 with failed_side: "back" and capture_issue and automatically refunds all 4 credits—with Never Error enabled, your workflow routes directly to a clean retake prompt instead of crashing.
    Method: POST URL: https://api.structocr.com/v1/driver-license-verify Authentication: Generic Credential Type → Header Auth Send Body: On Body Content Type: Form-Data Parameter 1: n8n Binary File | Name: front | Input Data Field: front Parameter 2: n8n Binary File | Name: back | Input Data Field: back Parameter 3: Form Data | Name: min_age | Value: ={{ $json.min_age || '21' }} Options: Response → Never Error: On
  4. Normalize the verdict into 3 clean routes in a Code node

    Add a Code node (Run Once for All Items, JavaScript) right after the HTTP Request node. It checks res.success, data.verification.overall_status, is_expired, and meets_min_age to emit one flat record with route set to approved, retake_required, or manual_review.

    Prefer the authoritative AAMVA barcode values in data.back for canonical storage, while keeping dd_dcf_match and mismatches for auditability. Remember: StructOCR enforces strict Zero Data Retention and does not retain images or identity payloads.
  5. Branch with a Switch node to your CRM, Slack, or retake email

    Connect a built-in Switch node on {{ $json.route }} with three outputs: Approved (write verified fields to Postgres, HubSpot, Airtable, or your rental system), Retake Required (422) (send the actionable capture_issue message back to the applicant at 0 credit cost), and Manual Review (alert compliance in Slack when overall_status is mismatch, expired, or underage).

    Note the scope boundary: POST /v1/driver-license-verify verifies card-level front/back consistency, DD vs. DCF, expiration, and age thresholds—it does not query state DMV or AAMVA DLDV government databases.

Production n8n workflows you can launch without custom backend code

  • Car rental & peer-to-peer fleet onboarding (min_age=25): Verify driver license front/back consistency, expiration, and 25+ age requirements automatically before unlocking reservation confirmation or sending insurance addendums.
  • Age-gated e-commerce & local delivery compliance (min_age=21): Gate alcohol, tobacco, or regulated delivery orders from Shopify/WooCommerce webhooks by routing verified_match + is_over_21: true to fulfillment and flagging expired or mismatched IDs.
  • Property management & short-term rental guest screening: Collect iPhone HEIC license photos through a branded n8n Form, verify front/back fields with strict zero data retention on the OCR layer, and push only your approved status into your PMS.
  • KYC pre-screening before paid DMV or background checks: Filter out expired, underage, or front/back mismatched cards at $0.0232–$0.04/check before triggering expensive downstream background-check or authorized DMV/DLDV registry calls.

n8n Code node: classify Approved, Retake (422), and Manual Review

Paste this JavaScript snippet into a <strong>Code</strong> node (Run Once for All Items) right after the HTTP Request node. It produces a clean <code>route</code> key for n8n's built-in <strong>Switch</strong> node while preserving <code>dd_dcf_match</code>, <code>mismatches</code>, and 422 capture hints.

Prerequisite: n8n Cloud or self-hosted n8n + a free StructOCR API key (200 permanent credits = 50 full checks)

Method: POST
URL: https://api.structocr.com/v1/driver-license-verify

Authentication: Generic Credential Type
Generic Auth Type: Header Auth
  Name: x-api-key
  Value: <your StructOCR API key>

Send Body: on
Body Content Type: Form-Data
Body Parameters:
  1. Parameter Type: n8n Binary File
     Name: front
     Input Data Field Name: front
  2. Parameter Type: n8n Binary File
     Name: back
     Input Data Field Name: back
  3. Parameter Type: Form Data (optional)
     Name: min_age
     Value: ={{ $json.min_age || '21' }}

Options:
  Response → Never Error: on

Sample HTTP Request node output (Synthetic Example)

Fictional California driver's license verification payload returned by <code>POST /v1/driver-license-verify</code> before entering the n8n Code node.

{
  "success": true,
  "data": {
    "verification": {
      "overall_status": "verified_match",
      "front_back_match": true,
      "dd_dcf_match": "matched",
      "is_expired": false,
      "is_over_18": true,
      "is_over_21": true,
      "age_years": 34,
      "meets_min_age": true,
      "mismatches": [],
      "field_checks": {
        "document_number": "matched",
        "surname": "matched",
        "given_names": "matched",
        "date_of_birth": "matched",
        "date_of_expiry": "matched",
        "region": "matched",
        "document_discriminator": "matched"
      },
      "scope_notice": "Card-level front/back consistency check only; does not query DMV or government registries."
    },
    "front": {
      "country_code": "USA",
      "region": "CA",
      "document_number": "F1234567",
      "surname": "SMITH",
      "given_names": "JESSICA LYNN",
      "date_of_birth": "1992-04-12",
      "date_of_expiry": "2031-04-12",
      "extra_details": {
        "card_security_number": "08/15/2023612345/AAFD/31"
      }
    },
    "back": {
      "source": "pdf417",
      "country_code": "USA",
      "region": "CA",
      "document_number": "F1234567",
      "surname": "SMITH",
      "given_names": "JESSICA LYNN",
      "date_of_birth": "1992-04-12",
      "date_of_expiry": "2031-04-12",
      "document_discriminator": "08/15/2023612345/AAFD/31",
      "issuer_identification_number": "636014",
      "aamva_version": 9
    }
  }
}

Technical Specs

  • Endpoint: POST https://api.structocr.com/v1/driver-license-verify with x-api-key header
  • Upload format: Direct binary multipart/form-data (front + back + optional min_age) or Base64 JSON; max 4.5 MB per image
  • Accepted files: JPG, PNG, WebP, and native Apple iPhone HEIC/HEIF (with automatic EXIF orientation handling)
  • Privacy: Strict Zero Data Retention — images execute strictly in memory, raw_response: null in logs, zero AI training
  • Cost & Auto-Refund: 4 permanent credits per completed verification ($0.0232–$0.04/check; 200 free credits = 50 checks). Unreadable back PDF417 barcodes return HTTP 422 and automatically refund all 4 credits

Key Features

  • 100% Built-in n8n Nodes: Runs on both n8n Cloud and self-hosted Docker using only Form Trigger, HTTP Request, Code, Switch, and Set nodes.
  • Back-First Short-Circuit: Decodes the back AAMVA barcode before reading the front, returning structured failed_side and capture_issue retake prompts at 0 credit cost on unreadable photos.
  • Deterministic Cross-Check Rules: Normalizes middle initials (partial_match), suffixes (JR/SR/III), diacritics, and all 63 US/Canadian jurisdiction codes.
  • Explicit Scope Boundary: Verifies card-level consistency, DD vs. DCF, expiry, and age thresholds cleanly—without pretending to query state DMV registries.

Frequently Asked Questions

Does this n8n workflow require paid community nodes or a mobile SDK?

No. It uses only built-in n8n nodes (Form Trigger or Webhook, HTTP Request, Code, Switch, and Set) and works identically on n8n Cloud and self-hosted n8n without installing any browser or mobile SDK.

Can applicants upload raw iPhone HEIC photos directly through an n8n Form?

Yes. Both front and back inputs accept JPG, PNG, WebP, and native Apple HEIC/HEIF files up to 4.5 MB each, with automatic EXIF orientation correction on the server.

What happens in n8n if the back PDF417 barcode is blurry or has glare?

StructOCR decodes the back barcode first. If it cannot be decoded reliably, the API returns HTTP 422 with failed_side: "back" and a specific capture_issue (such as out_of_focus or glare) and automatically refunds all 4 credits. Because the HTTP Request node has Never Error enabled, the workflow routes cleanly to the Retake Required branch.

Does StructOCR store uploaded driver's license photos or identity data?

No. POST /v1/driver-license-verify enforces strict Zero Data Retention: uploaded images and extracted identity payloads are processed in memory only and are never saved to storage buckets or database audit logs. Note that if you turn on execution data saving inside your own n8n instance, configure n8n's execution pruning policy according to your compliance requirements.

Does this workflow check whether a license is suspended in a DMV database?

No. POST /v1/driver-license-verify performs card-level front/back consistency, Document Discriminator (DD vs. DCF), expiration, and age checks only. It does not query state DMV or AAMVA DLDV government databases; if your workflow needs live DMV status, pass the verified output from the Approved branch to an authorized records provider.

More Tutorials

Ready to Build with StructOCR?

Get your API key in under a minute. New users receive 200 free credits to test Passport, VIN, License Plate, Container, Receipt, HIN, Driver License, ID Card, Vehicle Registration, Weighbridge Ticket, ATM Cassette and Invoice OCR APIs.

✓ No credit card required · ✓ Instant API key · ✓ Full API access