Introduction
This documentation aims to provide all the information you need to work with our API.
<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>
Authenticating requests
This API is not authenticated.
Debug
Debug a barcode payload
Accepts the same base64-encoded barcode as /api/decode-licence and
returns a detailed binary analysis: full hex dump, magic-byte locations,
E0-delimited field slices, entropy windows, and a brute-force RSA key
skip search. Intended for development and reverse-engineering use only.
Warning: Remove or protect this endpoint behind authentication before deploying to production.
How to prepare the barcode value — same as /api/decode-licence:
- Scan the PDF417 barcode on the back of the SA driver's licence.
- Take the raw binary bytes from the scanner output.
- Base64-encode those bytes (standard or URL-safe base64 accepted).
- Send the base64 string as the
barcodefield.
Example request:
curl --request POST \
"http://localhost/api/debug-barcode" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"barcode\": \"`SGVsbG8gV29ybGQ=`\"
}"
const url = new URL(
"http://localhost/api/debug-barcode"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"barcode": "`SGVsbG8gV29ybGQ=`"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200, Successful analysis):
{
"total_bytes": 720,
"magic_searches": {
"WI\\x04 (SA DL WSQ header)": [
456
],
"FF D8 (JPEG SOI)": []
},
"e0_field_slices": [
{
"start": 0,
"end": 11,
"length": 12,
"hex": "41424344...",
"ascii": "ABCD....",
"e0_at": 12,
"after_e0_hex": "E00102"
}
],
"entropy_windows": [
{
"offset": 0,
"entropy": 7.82
}
],
"brute_force_skip": [],
"full_hex_dump": [
"0000 41 42 43 44 ... ABCD...."
]
}
Example response (200, Invalid base64):
{
"error": "base64_decode failed"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Licence Decoding
Decode a SA driver's licence barcode
Decodes a South African driver's licence PDF417 barcode and returns all structured fields including identity, personal details, vehicle classes, and a base64-encoded photo.
How to prepare the barcode value:
- Scan the PDF417 barcode on the back of the SA driver's licence card.
- Obtain the raw binary bytes from the scanner (do not convert to hex or string).
- Base64-encode those raw bytes (standard or URL-safe base64 both accepted).
- Send the resulting base64 string as the
barcodefield.
The decoded byte length must be at least 720 bytes — this is the encrypted RSA payload size used on SA driver's licences.
Example request:
curl --request POST \
"http://localhost/api/decode-licence" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"barcode\": \"`SGVsbG8gV29ybGQ=`\"
}"
const url = new URL(
"http://localhost/api/decode-licence"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"barcode": "`SGVsbG8gV29ybGQ=`"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());Example response (200, Successful decode):
{
"status": "success",
"result": {
"identity_document": {
"number": "8001015009087",
"type": "ID",
"country_of_issue": "ZA"
},
"person": {
"surname": "SMITH",
"initials": "JA",
"driver_restrictions": "00",
"date_of_birth": "1980/01/01",
"gender": "M"
},
"driving_license": {
"certificate_number": "DP-123456",
"country_of_issue": "ZA"
},
"card": {
"issue_number": "01",
"date_valid_from": "2020/01/01",
"date_valid_until": "2025/01/01"
},
"professional_driving_permit": null,
"vehicle_classes": [
{
"code": "B",
"vehicle_restrictions": "00",
"first_issue_date": "2000/06/15"
}
],
"photo_base64": "data:image/png;base64,iVBORw0KGgo..."
}
}
Example response (422, Invalid base64 or payload too short):
{
"success": false,
"error": "Invalid base64 barcode data (expected ≥720 decoded bytes)."
}
Example response (422, Decryption or parse failure):
{
"success": false,
"error": "RSA decryption failed: ..."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.