Verify Documents

SwiftDil offers an extensive array of out-of-the-box document verifications such as authenticity and integrity analysis for passports. Before you can verify a document, you need to create it using the Document API.

Create Document

Documents can be created for a given customer using the following cURL sample code:

Example request:

curl -X POST https://sandbox.swiftdil.com/v1/customer/{customer_id}/documents \
    -H 'Authorization: Bearer your_token' \
    -F 'front_image=@foo.jpg' \
    -F 'back_image=@bar.jpg' \
    -F 'type=PASSPORT' \
    -F 'document_name=Customer passport' \
    -F 'document_description=Primary ID document' \
    -F 'document_number=N1234567890' \
    -F 'issuing_country=GBR' \
    -F 'issue_date=2010-01-01' \
    -F 'expiry_date=2020-01-01' \
    -F 'mrz_line1=IDGBRDOE<<<<<<<<<<<<<<<<<<<<<<<<<<<<' \
    -F 'mrz_line2=N1234567890JOHN<<<<<<<<<<<<6512068F4'

Example response:

{
    "id": "d78913a9-7dcd-46c8-a8fc-91b4f85329f5",
    "type": "PASSPORT",
    "document_name": "Customer passport",
    "document_description": "Primary ID document",
    "document_number": "N1234567890",
    "issuing_country": "GBR",
    "issue_date": "2010-01-01",
    "expiry_date": "2020-01-01",
    "created_at": "2017-06-28T08:04:32Z",
    "updated_at": "2017-06-28T08:04:32Z",
    "front_side": {
        "id": "cb3673b1-003d-49e4-ac49-3462bf704232",
        "name": "foo.jpg",
        "content_type": "image/jpeg",
        "size": 15
    },
    "back_side": {
        "id": "6aa4d0c6-d7d4-4dbd-8a04-ad2491d0cef6",
        "name": "bar.jpg",
        "content_type": "image/jpeg",
        "size": 15
    },
    "mrz_line1": "IDGBRDOE<<<<<<<<<<<<<<<<<<<<<<<<<<<<",
    "mrz_line2": "N1234567890JOHN<<<<<<<<<<<<6512068F4"
}

Verify Document

Two verification types exist:

1. MRZ verification performs analysis checks on the Machine Readable Zone (MRZ) values specified by the user.
2. Image verification performs image, Optical Character Recognition (OCR), and MRZ analysis on the attachments associated with the supplied document.

If you would like to know more the underlying document checks performed by our API, head over to our API reference.

Example request:

curl -X POST https://sandbox.swiftdil.com/v1/customer/{customer_id}/verifications \
    -H 'Authorization: Bearer your_token' \
    -d '{
        "document_id": "d78913a9-7dcd-46c8-a8fc-91b4f85329f5",
        "type": "IMAGE"
        }'

Example response:

{
    "created_at": "2017-11-10T22:54:17Z",
    "updated_at": "2017-11-10T22:54:17Z",
    "document_id": "c29ed1c4-59ee-4b8f-ab9c-4829fabaffd5",
    "customer_id": "b19872d0-07ea-4d04-84eb-eb7758869b28",
    "entity_name": "John Doe",
    "type": "IMAGE",
    "outcome": {
        "authenticity_analysis": {
            "status": "ERROR",
            "breakdown": [
                {
                    "type": "MRZ_MATCHING_TYPE",
                    "status": "NOT_APPLICABLE"
                },
                {
                    "type": "MRZ_VISUAL_FORMAT",
                    "status": "NOT_APPLICABLE"
                },
                {
                    "type": "PHOTO_LOCATION",
                    "status": "NOT_APPLICABLE"
                },
                {
                    "type": "DAYLIGHT_COLOUR_ANALYSIS",
                    "status": "NOT_APPLICABLE"
                },
                {
                    "type": "DOCUMENT_SPECIMEN",
                    "status": "ERROR"
                },
                {
                    "type": "VISUAL_SECURITY_ELEMENTS",
                    "status": "NOT_APPLICABLE"
                }
            ]
        },
        "integrity_analysis": {
            "status": "CLEAR",
            "breakdown": [
                {
                    "type": "ISSUE_COUNTRY",
                    "status": "CLEAR"
                },
                {
                    "type": "DOCUMENT_TYPE_EXPIRATION",
                    "status": "CLEAR"
                },
                {
                    "type": "VALIDITY_OUT_OF_COUNTRY",
                    "status": "NOT_APPLICABLE"
                },
                {
                    "type": "NATIONALITY_MATCH",
                    "status": "CLEAR"
                },
                {
                    "type": "DOCUMENT_RECOGNISED",
                    "status": "CLEAR"
                },
                {
                    "type": "ISSUE_DATE",
                    "status": "CLEAR"
                }
            ]
        },
        "content_analysis": {
            "status": "NOT_APPLICABLE",
            "breakdown": [
                {
                    "type": "DOC_NUMBER_RECOGNISED",
                    "status": "NOT_APPLICABLE"
                },
                {
                    "type": "LAST_NAME_RECOGNISED",
                    "status": "NOT_APPLICABLE"
                },
                {
                    "type": "FIRST_NAME_RECOGNISED",
                    "status": "NOT_APPLICABLE"
                },
                {
                    "type": "BIRTH_DATE_RECOGNISED",
                    "status": "NOT_APPLICABLE"
                }
            ]
        },
        "mrz_analysis": {
            "status": "CLEAR",
            "breakdown": [
                {
                    "type": "MRZ_FIELDS_FORMAT",
                    "status": "CLEAR"
                },
                {
                    "type": "MRZ_CHECKSUM",
                    "status": "CLEAR"
                }
            ]
        },
        "consistency_analysis": {
            "status": "ATTENTION",
            "breakdown": [
                {
                    "type": "CUSTOMER_DOB",
                    "status": "ATTENTION"
                },
                {
                    "type": "CUSTOMER_BIRTH_PLACE",
                    "status": "NOT_APPLICABLE"
                },
                {
                    "type": "CUSTOMER_NATIONALITY",
                    "status": "ATTENTION"
                },
                {
                    "type": "CUSTOMER_LAST_NAME",
                    "status": "ATTENTION"
                },
                {
                    "type": "CUSTOMER_GENDER",
                    "status": "NOT_APPLICABLE"
                },
                {
                    "type": "CUSTOMER_FIRST_NAME",
                    "status": "ATTENTION"
                }
            ]
        },
        "expiration_check": {
            "status": "ATTENTION",
            "breakdown": [
                {
                    "type": "DOCUMENT_EXPIRATION",
                    "status": "ATTENTION"
                }
            ]
        }
    },
    "properties": {
        "document_type": "NATIONAL_IDENTITY_CARD",
        "document_data": {
            "document_number": "GZ000030E",
            "mrz_line1": "IDGIBGZ000030E2Q15000174<<<<<<",
            "mrz_line2": "7402061M2501280GBR<<<<<<<<<<<0",
            "mrz_line3": "FREEMAN<<PAUL<JAMES<<<<<<<<<<<",
            "issuing_country": "GIB",
            "expiry_date": {
                "day": 28,
                "month": 1,
                "year": 2025
            }
        },
        "holder_data": {
            "first_name": [
                "PAUL",
                "JAMES"
            ],
            "last_name": [
                "FREEMAN"
            ],
            "dob": {
                "day": 6,
                "month": 2,
                "year": 1974
            },
            "nationality": "GBR",
            "gender": "MALE"
        },
        "extracted_images": []
    },
    "status": "DONE",
    "id": "42583ade-f2b9-4bed-903a-bc46a215040c"
}

Test Data

Use the following sample documents to test the various API responses:

Document Type Country Front Side Back Side
Resident Permit UK UK Resident Permit (Front Side) UK Resident Permit (Back Side)
Visa UK UK Visa N/A
National ID Card France France National ID (Front Side) France National ID (Back Side)
Driving Licence France France Driving Permit (Front Side) France Driving Licence (Back Side)
Passport China China Passport N/A
National ID Card Poland Poland National ID (Front Side) Poland National ID (Back Side)
Passport Poland Poland Passport N/A
National ID Card Slovakia Slovakia ID Card (Front Side) Slovakia ID Card (Back Side)