Strict Zero Data Retention · Pay-As-You-Go

Driver License Verify API

Verify the front and back of a US or Canadian driver license or State ID in a single request. StructOCR deterministically decodes the back AAMVA PDF417 barcode first, extracts the printed front fields, and returns field-by-field cross-check results (including Document Discriminator DD vs DCF), expiration status, and age checks (is_over_18, is_over_21, optional min_age).

API Quick Facts

Strict Zero Data Retention
Endpoint
POSThttps://api.structocr.com/v1/driver-license-verify
Authentication
x-api-key HTTP header (auto-created on signup)
Pricing & Free Tier
4 credits per verified request (full refund on 422 back-side failure) ($0.0232–$0.04 / check). Prepaid packs from $5, no subscription, credits never expire. 200 free credits on signup.
Data Retention
Strict Zero Data Retention — images and JSON results are never stored
Supported Inputs
Multipart (`front`, `back`) or JSON Base64: JPG, PNG, WebP, native iPhone HEIC/HEIF (up to 4.5 MB/side)
Structured Output
Deterministic back AAMVA PDF417 decode (US 50 states + Canada 13 provinces) + front OCR + 7-field match, printed DD vs. barcode DCF, UTC expiry & 18+/21+/min_age checks
Scope Boundary
Card-level consistency verification only; does not query state DMV or AAMVA DLDV registries.

Endpoint

POSThttps://api.structocr.com/v1/driver-license-verify

Price: 4 credits per completed verification ($0.0232–$0.04/check; 200 free sign-up credits = 50 checks). Unreadable back barcodes or processing failures are automatically refunded in full. Data retention: Strict zero data retention — images and extracted payloads are never stored on disk or in database logs.

Request Parameters

Send both front and back images as multipart/form-data or Base64 JSON. Native iPhone HEIC/HEIF, JPG, PNG, and WebP photos are supported up to 4.5 MB per image.

ParameterInRequiredDescription
x-api-keyHeaderRequiredYour StructOCR API key.
frontMultipart / JSONRequiredFront photo of the driver license (file upload or Base64 / data URI, max 4.5 MB).
backMultipart / JSONRequiredBack photo containing the full AAMVA PDF417 barcode (file upload or Base64 / data URI, max 4.5 MB).
min_ageMultipart / JSONOptionalInteger between 1 and 120 (for example 21 or 25). Adds verification.meets_min_age.

Response Schema

Middle-name abbreviations (such as JOHN A on the front vs JOHN ALLEN in the barcode) are reported as partial_match rather than a false mismatch. States that do not print a Document Discriminator on the front return dd_dcf_match: "unavailable".

FieldDescription
verification.overall_statusstring — One of verified_match, expired, mismatch, or inconclusive.
verification.front_back_matchboolean — true when zero fields mismatched and all core identity fields (document_number, surname, given_names, date_of_birth) matched or partially matched.
verification.dd_dcf_matchstring — Document Discriminator check comparing front card_security_number against back AAMVA DCF: matched, mismatched, or unavailable.
verification.is_expiredboolean | null — true if date_of_expiry is strictly before today (UTC); false if valid through today.
verification.is_over_18boolean | null — true if cardholder is at least 18 years old based on the authoritative AAMVA date of birth.
verification.is_over_21boolean | null — true if cardholder is at least 21 years old based on the authoritative AAMVA date of birth.
verification.age_yearsnumber | null — Exact UTC age in completed years.
verification.meets_min_ageboolean | null — Included only when min_age is passed in the request; true if age_years >= min_age.
verification.mismatchesstring[] — List of field keys whose front and back values contradicted each other.
verification.field_checksobject — Per-field status (matched, partial_match, mismatched, or unavailable) for document_number, surname, given_names, date_of_birth, date_of_expiry, region, and document_discriminator.
verification.scope_noticestring — Explicit boundary notice: card-level front/back consistency check only; does not query DMV or government registries.
frontobject — Normalized front OCR JSON fields (same schema as POST /v1/driver-license).
backobject — Normalized deterministic AAMVA PDF417 JSON fields (same schema as POST /v1/driver-license-pdf417).

Code Examples

Request Implementation

curl -X POST https://api.structocr.com/v1/driver-license-verify \
  -H "x-api-key: YOUR_API_KEY" \
  -F "[email protected]" \
  -F "[email protected]" \
  -F "min_age=21"

Success Response (200 OK)

JSON EXAMPLE
{
  "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": {
      "type": "drivers_license",
      "country_code": "USA",
      "region": "CA",
      "document_number": "F1234567",
      "surname": "SMITH",
      "given_names": "JESSICA LYNN",
      "sex": "F",
      "date_of_birth": "1992-04-12",
      "date_of_issue": "2023-08-15",
      "date_of_expiry": "2031-04-12",
      "address": "1234 SUNSET BLVD, LOS ANGELES, CA 90026",
      "vehicle_class": "C",
      "extra_details": {
        "card_security_number": "08/15/2023612345/AAFD/31"
      }
    },
    "back": {
      "type": "drivers_license",
      "document_kind": "driver_license",
      "source": "pdf417",
      "country_code": "USA",
      "region": "CA",
      "document_number": "F1234567",
      "surname": "SMITH",
      "given_names": "JESSICA LYNN",
      "date_of_birth": "1992-04-12",
      "date_of_issue": "2023-08-15",
      "date_of_expiry": "2031-04-12",
      "document_discriminator": "08/15/2023612345/AAFD/31",
      "issuer_identification_number": "636014",
      "aamva_version": 9,
      "jurisdiction_version": 0
    }
  }
}

Unreadable Back Barcode Response (422 · Auto-Refunded)

JSON EXAMPLE
{
  "success": false,
  "error": "PDF417_NOT_DECODED",
  "message": "The barcode in the photo is out of focus. Hold the camera closer to the PDF417 barcode, tap on it to focus, and retake the photo.",
  "failed_side": "back",
  "capture_issue": "out_of_focus"
}

Status Codes & Refund Semantics

HTTPError CodeBehavior
200SUCCESSBoth sides extracted and cross-checked (4 credits billed, including mismatch and expired outcomes).
400MISSING_FRONT_IMAGE / MISSING_BACK_IMAGE / INVALID_MIN_AGE / INVALID_IMAGERequest payload or image is invalid. No credits charged.
401AUTH_FAILEDMissing x-api-key header.
402INSUFFICIENT_CREDITSAccount balance is below the 4 credits required.
403INVALID_KEY / KEY_SUSPENDED / ACCESS_RESTRICTEDAPI key is invalid, inactive, or restricted.
413FILE_TOO_LARGEEither front or back image exceeds 4.5 MB (check failed_side).
415UNSUPPORTED_FILE_FORMATOnly JPG, PNG, WebP, and HEIC images are accepted (check failed_side).
422PDF417_NOT_DETECTED / PDF417_NOT_DECODED / AAMVA_NOT_VALIDBack barcode could not be decoded or validated as AAMVA. Returns failed_side: "back" and capture_issue; all 4 credits automatically refunded.
502 / 503PDF417_UPSTREAM_ERROR / PDF417_SERVICE_UNAVAILABLE / SYSTEM_BUSYTemporary upstream failure (check failed_side). All 4 credits automatically refunded; retry with backoff.

Try Front + Back Verification Live

Test a synthetic matching California driver license pair or upload your own front and back images in the interactive demo or Dashboard Playground.