Introduction

The PDF417.PRO API lets you automate barcode creation from your own tools. Language bindings are available for Shell, Python and JavaScript — switch examples with the tabs below.

API requests must include your key in the AUTH-TOKEN header. Obtain a key from your profile page. This demo reference uses the placeholder 6c1a0f0f-ce4e-4c73-8f97-31484ce8551e.

https://pdf417.pro/api/

Authentication

Include the header on every request:

AUTH-TOKEN: 6c1a0f0f-ce4e-4c73-8f97-31484ce8551e

Get account info

GET /api/get_account_info/

curl -X GET "https://pdf417.pro/api/get_account_info/" \
  -H "AUTH-TOKEN: YOUR_API_KEY"

Example response:

{
  "username": "api@demo",
  "available_barcodes": 0,
  "barcodes_limit": 0,
  "barcodes_created": 0,
  "api_token": "6c1a0f0f-ce4e-4c73-8f97-31484ce8551e"
}

Get available states

GET /api/get_available_states/

Returns supported jurisdictions, their two-letter codes and AAMVA revision.

curl "https://pdf417.pro/api/get_available_states/" \
  -H "AUTH-TOKEN: YOUR_API_KEY"
{
  "available_states": [
    { "state": "California", "code": "CA", "revision": "08/29/2017" },
    { "state": "Colorado",  "code": "CO", "revision": "10/30/2015" }
  ]
}

Get brief barcode fields information

GET /api/get_barcode_fields_brief_info/?state=CA

Returns the default values for every field of the selected state. Modify them and post to the generation endpoint.

{
  "NUMBER": "D1234567", "FIRSTNAME": "John", "LASTNAME": "Doe",
  "ADDRESS": "516", "CITY": "Ronhert", "ZIP": "875420000",
  "CLASS": "C", "DOB": "01151970", "DOI": "08262021", "DOE": "01152026",
  "DD": "08/25/202165508/AAFD/26", "ICN": "21237D12345670401",
  "RESTRICTIONS": "NONE", "ENDORSEMENT": "NONE",
  "HEIGHT": "69", "WEIGHT": "160", "EYE": "BLK", "HAIR": "BLK"
}

Query parameter: state — two-letter state code.

Get full barcode fields information

GET /api/get_barcode_fields_full_info/?state=CA

Returns field metadata: display name, internal code, placeholder, type, pattern and whether the field is required.

{
  "fields": [
    { "name": "DL Number", "input_id": "inputDocumentNumber",
      "code": "NUMBER", "placeholder": "D1234567",
      "type": "text", "pattern": "[a-zA-Z][0-9]{7}", "required": false }
  ]
}

Create barcode

POST /api/generate_barcode/

Post the state code plus all fields. One barcode credit is consumed per successful call.

import requests

headers = { 'AUTH-TOKEN': 'YOUR_API_KEY' }
data = {
  'STATE': 'CA', 'NUMBER': 'D1234567', 'FIRSTNAME': 'John', 'LASTNAME': 'Doe',
  'ADDRESS': '516', 'CITY': 'Ronhert', 'ZIP': '875420000', 'CLASS': 'C',
  'DOB': '01151970', 'DOI': '08262021', 'DOE': '01152026'
}
r = requests.post('https://pdf417.pro/api/generate_barcode/',
                  headers=headers, json=data).json()
print(r)
# { "status": "SUCCESS", "message": "DONE",
#   "file_png": "/media/barcodes/…png", "file_svg": "/media/barcodes/…svg" }

Errors

CodeMeaning
WRONG_REQUEST_TYPEOnly GET and POST requests are accepted.
AUTHTOKEN_NOT_FOUNDNo AUTH-TOKEN header in the request.
WRONG_AUTHTOKEN_FORMATAPI key has an invalid format.
WRONG_AUTHTOKENAPI key is not valid.
STATE_PARAMETER_NOT_FOUNDNo state code was supplied.
INVALID_STATE_CODEThe state code does not exist.
BARCODE_LIMITNot enough available barcodes on the account.
CONFIG_ERRORInternal error — contact support.

Examples

A complete Python flow: get defaults → change fields → generate → download.

import requests

BASE = 'https://pdf417.pro'
headers = { 'AUTH-TOKEN': 'YOUR_API_KEY' }
data = requests.get(BASE + '/api/get_barcode_fields_brief_info/',
                    params={'state': 'CA'}, headers=headers).json()
data['FIRSTNAME'] = 'JOHN'
data['LASTNAME'] = 'TEST'
result = requests.post(BASE + '/api/generate_barcode/',
                       headers=headers, json=data).json()
if result['status'] == 'SUCCESS':
    png = requests.get(BASE + result['file_png']).content
    open('barcode.png', 'wb').write(png)

You can also use the local, browser-only generator — no API key required.