API reference
Two endpoints. Both JSON in, one binary out.
GET /api/v1/jurisdictions
Returns the field schema. Without ?state= it returns all 51 US jurisdictions and 12 experimental Canadian provinces plus the element registry. Experimental entries carry "experimental": true and each one is also served as a page.
| Param | Type | Notes |
|---|---|---|
state | 2-letter code | Optional. Narrows to one jurisdiction. |
{
"state": "NY",
"name": "New York",
"required": ["DAQ", "DCS", "DAH", ...],
"optional": ["DAD", "DAU", ...],
"iins": { "NY": "636001", ... }
}POST /api/v1/aamva
Encodes a payload and returns the image. Content type is image/png or image/svg+xml.
| Field | Type | Default |
|---|---|---|
state | 2-letter code | required |
fields | object, element IDs to values | required |
eclevel | 0–8 | 5 |
columns | 1–30 | derived for 3:1 |
format | png · svg | png |
dpi | 72–1200 | 600 |
aamva_version | 2 digits | jurisdiction default |
jurisdiction_version | 2 digits | 00 |
Omit columns and the encoder derives it from the codeword count, solving
for a 3:1 symbol. Fewer columns make a narrower, taller symbol; more columns make a
wider, shorter one. Send columns only to pin a specific label geometry.
The X dimension comes from dpi and is never below the 0.0067 in ISO
minimum: at 600 DPI one module is 0.00833 in, and row height is three modules.
Canonical URL
The encode endpoint is POST /api/v1/aamva with no trailing slash, and the
schema endpoint is GET /api/v1/jurisdictions, also without one. Page routes
on this site end in a slash; the two API routes do not. A request to
/api/v1/aamva/ returns 308 with a Location header
pointing at the canonical form, so the method and body survive the redirect and a client
that follows it still encodes. Only the canonical URL is documented here.
Validation
Fields are validated before encoding. A failure returns 422 with every problem listed, not just the first.
{
"error": "validation failed",
"details": [
"DAH (County / line 2) is required for New York",
"DBB is not a real calendar date"
]
}Status codes and bodies
Success is a 200 with image bytes and no JSON envelope. Errors are JSON with an
error string, and validation errors add a details array. There is
no 201: encoding does not create a stored resource. There is no 204: a successful request
always has a body, because the body is the symbol.
A 422 can carry more than one detail. The encoder validates every field before building the payload, so a form with three mistakes returns three lines in one response. A 404 is reserved for an unknown jurisdiction on the schema endpoint; an unknown state in an encode request is a 422, because the body was well formed and the value was not valid.
A 402 means the key is valid but the plan has expired and the credit balance is zero. The
body carries a buy_url, and the Link header points at the same
page. One symbol costs one credit; a live plan is never debited against the balance.
Idempotency and retries
Encoding is deterministic for the same inputs: the same state, EC level, columns, DPI and fields produce the same payload and the same symbol. That makes a retry safe after a timeout, as long as the fields have not changed. The one variable is the bitmap encoder's compression, which can differ by a byte without changing the decoded payload.
Retry a network failure or a 5xx once, then stop and report. Do not retry a 4xx. Do not
use a retry to work around a 429 without honouring Retry-After, because the
next attempt will land in the same window.
Response headers
| Header | Meaning |
|---|---|
X-Symbol-Bytes | Payload length before encoding |
X-EC-Level | Error correction actually applied |
X-Quota-Remaining | Symbols left this period |