Last active
May 7, 2026 01:38
-
-
Save symisc/c6e2dd6207dbc63d449b1ac265b6263a to your computer and use it in GitHub Desktop.
Scan over 11K ID Documents from over 197 countries using the PixLab DOCSCAN API Endpoint documented at: https://pixlab.io/id-scan-api/docscan
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import json | |
| # Scan over 11K ID Documents from over 197 countries using the PixLab DOCSCAN API Endpoint | |
| # documented at: https://pixlab.io/id-scan-api/docscan | |
| # | |
| # Refer to the official documentation at: https://pixlab.io/id-scan-api/docscan | |
| # You can switch to GET if your input ID DOCUMENT image URL is publicly available. | |
| req = requests.post( | |
| 'https://api.pixlab.io/docscan', | |
| files={ | |
| 'file': open('./local_id_card_image.png', 'rb') | |
| }, | |
| data={ | |
| 'type': 'passport', # Or: "idcard", "driver_license", "passport", etc. or set to "unknown". | |
| 'key': 'PIXLAB_API_KEY' | |
| } | |
| ) | |
| reply = req.json() | |
| if reply['status'] != 200: | |
| print(reply['error']) | |
| else: | |
| # Dump everything the scanner returned to us | |
| print(json.dumps(reply, indent=4)) | |
| # Typical JSON output using specimen data: | |
| # | |
| # { | |
| # "type": "DRIVER LICENSE", | |
| # "face_url": false, | |
| # "fields": { | |
| # "documentNumber": "99 999 999", | |
| # "fullName": "JANICE ANN SAMPLE", | |
| # "issuingDate": "2016-10-05", | |
| # "expiryDate": "2020-08-05", | |
| # "dateOfBirth": "1969-08-04", | |
| # "address": "123 MAIN STREET APT. 1 HARRISBURG, PA 17101-0000", | |
| # "issuingCountry": "USA", | |
| # "gender": "female", | |
| # "issuingState": "PA" | |
| # }, | |
| # "status": 200 | |
| # } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Scan over 11K ID Documents from over 197 countries using the PixLab DOCSCAN API Endpoint documented at: https://pixlab.io/id-scan-api/docscan
Given a government issued passport document, extract the user face and parse all MRZ fields.
PixLab recommend that you connect your AWS S3 bucket via the dashboard at https://console.pixlab.io/ so that any extracted face or MRZ crop is automatically stored on your S3 bucket rather than the PixLab one. This feature should give you full control over your analyzed media files.
Refer to the official documentation at: https://pixlab.io/id-scan-api/docscan for the API reference guide and more code samples.