Quickstart
Four calls: schema, encode, decode, print.
1. Read the schema
Required and optional elements differ per jurisdiction. Fetch the schema for the state you are issuing before you build a form.
curl -s "https://validpdf417.com/api/v1/jurisdictions?state=NY" \
-H "Authorization: Bearer $PDF417_KEY" | jq .requiredNew York returns DAH (county) in required. California does not. The schema is the contract: a field that is not in required or optional for that state is not encoded, even if you send it.
2. Encode
curl -s https://validpdf417.com/api/v1/aamva \
-H "Authorization: Bearer $PDF417_KEY" \
-H "Content-Type: application/json" \
-d '{"state":"NY","eclevel":5,"format":"png","dpi":600,"fields":{
"DAQ":"123456789","DCS":"SAMPLE","DAC":"JORDAN","DBB":"19900314",
"DBA":"20300115","DBC":"1","DAG":"1 BROADWAY","DAH":"ALBANY",
"DAI":"ALBANY","DAK":"12207","DCF":"DD123456789012",
"DCK":"123456789012","DCA":"D","DCB":"NONE","DCD":"NONE",
"DDB":"20220101"}}' -o dl.png3. Decode
Never trust an encode you have not decoded. zbarimg reads PDF417 and prints the raw payload.
zbarimg --raw -q dl.png | xxd -g1 | head -n 4Byte 0 must be 0x40 (@). Bytes 1–3 must be 0x0A 0x1E 0x0D. If they are not, the symbol is not AAMVA.
If the call returns 422
A 422 is a field problem, not a transport problem. The body lists every failure at once, so fix them in one pass rather than one request per field. The most common causes are a missing required element, a date that is not a real calendar date, a value outside its pattern, and a name longer than its cap. None of them is retried automatically: the same body will fail the same way.
A 400 is different. It means the JSON did not parse, usually a trailing comma or an unescaped quote in a field value. A 401 or 403 is the key. If the response is image bytes, the request was accepted and the remaining questions are about print, not data.
4. Print
600 DPI, no scaling, no resampling. Feed the PNG to the printer driver at its native pixel size.
"Native size" means one image pixel maps to one printer dot at the declared DPI. If the print dialog offers fit-to-page, scaling or shrink-to-fit, turn it off. A 600 DPI image printed at 300 DPI loses half the module resolution, and the error correction budget has to absorb the difference before the scanner sees a single scratch.
Keep the payload string next to the print file. If a card is questioned later, the string is what proves which data was encoded; a PNG alone cannot be audited without decoding it first.