VIN OCR
An API to detect vehicle VINs in images, and scanned documents.
VIN stands for Vehicle Identification Number. This API allows to detect valid VIN numbers within images and photographs. The VinOcr API also provides extra information about the VIN found in the document, such as the manufacturer, year and country of manufacture.
API connection
Server and protocols involved.
Server: | https://zpk.systems |
---|---|
Scheme: | HTTPS, secure connections only. |
Protocol: |
JSON recommended
Sending a JSON in the request body, and specifying a Content-Type: application/json header in the request Files should be sent encoded as a base64 string. Form-Data not recommended
Format used in web forms, not recommended. When sending a form_data request you can send all the fields separately. However if the request is very large we recommend that you send the content of the request in a single text field called _json (with an underscore). This special parameter will be processed by our backend as if it were a regular JSON request. |
The server to send the requests to is https://zpk.systems, using a secure HTTPS connection.
The recommended communication type is JSON, in which case we will specify in the connection a Content-Type: application/json, and we will send the request body as a valid JSON string.
Endpoint & parameters.
Parameter | Description |
---|---|
application_id |
string required An application id. You can get the id of an application by clicking on 'details' in your panel |
api_key |
string required The API KEY of the application that makes the call to this API, you can obtain it in your panel, by clicking on the 'details' button of an application |
image_file |
file required A jpg or png image to be scanned that may contain one or more VIN codes Required if you don't send the image_url parameter |
image_url |
string required An http or https address where the image to be scanned is available, and which may contain one or more VIN codes Required if you don't send the image parameter |
score_filters |
array optional When the image does not have a good quality, it is possible that there are confusions between different valid VIN codes, the score_filters array allows you to alter the internal score that different VIN codes receive based on data such as manufacturing area, country of manufacture, manufacturer or brand. score_filters must contain an array of elements, each of them indicating a filter and a score in case that filter is met In this example, three filters have been applied to alter the score, giving priority to vehicles manufactured in Africa, and penalizing those manufactured in America. Additionally, it is desired to filter out those manufacturers of tractors, and motorcycles.
Zones, Countries and ManufacturersYou can obtain a list of country zones with this API, check: Brands, Countries & Zones, Manufacturers, |
wildcard_at_end |
boolean optional, default: false If wildcard_at_end is specified, the VINS scanner will be allowed to add an asterisk* to those VINS that were found to be missing a character at the end of the code. For example, given the VIN code L6TCX2E70ME00515, where a character is missing, the API will determine that the missing character is the last one, and will return as the main VIN code: L6TCX2E70ME00515* This option can be used to try to determine the correct code in your own vehicle database if you have one. |
include_considered_vins |
boolean optional, default: false If set to true, the response will contain a new element considered_vins that will contain an array with all the VINS considered in the vision analysis and their scores. |
Responses
Success response
{
"success": true,
"results": [
{
"vin_number": "VSSZZZ5F216532078",
"dev_from_ocr": "SSZZZ5F216532078",
"valid": true,
"fixed": true,
"quality": 1,
"year": 2001,
"wmi": "VSS",
"vis": "16532078",
"serial": "16532078",
"manufacturer_name": "SEAT",
"uses_manufacturation_plant_code": false,
"manufacturation_plant_code": "6",
"manufacturer_code": "VSS",
"uses_check_digit": false,
"provided_check_digit": "2",
"expected_check_digit": "5",
"valid_check_digit": false,
"low_volume_manufacturer": false,
"brands": [
"seat"
],
"country_name": "Spain",
"country_zone": "Europe"
}
],
"costs": {
"total_cost": 0.005
}
}
Response structure
Parameter | Description |
---|---|
success |
boolean
A boolean with value true if your request could be processed. Or false, in case of errors. |
results |
array
An array that will contain all the VINs that have been sent, along with the extracted data and an analysis of the validity of each VIN code. See the following table for details on the elements of this array. |
costs |
associative : array
Detailed information on the cost of the request sent, where:
total_cost: Total cost of this API request.
|
Parameter | Description |
---|---|
vin_number |
string
The VIN that the API finally processed, this VIN could be corrected if a possible typing error was detected, or if there were any characters missing from the submitted code that could be automatically deduced. |
dev_from_ocr |
string
The number that was read by the OCR, unprocessed. Can match vin_number if no correction was necessary |
valid |
boolean
A boolean indicating whether the final VIN is considered correct or not. In those manufacturers or countries where a control digit is used, this is considered when determining if the VIN is correct or not. |
fixed |
boolean
In the event that the submitted VIN has been corrected by the API as it is considered incorrect, it will be true |
year |
integer
The year of manufacture of the vehicle if it can be calculated. |
wmi |
string
The WMI (World Merchant Identifier) code of the VIN. A manufacturer identifier. |
vis |
string
VIS Section (Vehicle Identification Section), the code that each manufacturer uses at its discretion internally to determine the vehicle and its characteristics. |
serial |
string
The manufacturer's serial number, used by manufacturers internally and at their discretion. |
manufacturer_name |
string
Manufacturer name. |
uses_manufacturation_plant_code |
boolean
If there is evidence that this manufacturer does or does not use the manufacturing plant code internally, true if so. |
manufacturation_plant_code |
string
A one-character code that identifies the vehicle's manufacturing plant. |
manufacturer_code |
string
Manufacturer code, usually the same as WMI, with exceptions for some countries and manufacturers. |
uses_check_digit |
boolean
Whether this manufacturer uses a check digit or not. Dependent on manufacturers, and geographical areas, with some exceptions. true if yes. For vehicles that use this digit, the API performs extra checks to better determine if the VIN code provided is correct or not. |
provided_check_digit |
string
The check digit extracted from the VIN that was provided to the API. Before possible corrections. |
expected_check_digit |
string
The check digit expected for this manufacturer. |
valid_check_digit |
boolean
Whether the provided check digit is correct or not. To determine the final vin code, this validation is ignored in case the manufacturer does not use a check digit. |
low_volume_manufacturer |
boolean
Indicates if it is a manufacturer with a low production volume. Multiple manufacturers of these vehicles are often grouped under the same manufacturer code. |
brands |
array : strings
An array of strings containing the names of the brands involved in the production and/or manufacturing of the vehicle. In most cases it usually contains a single element. |
country_name |
string
The country where the vehicle was manufactured or assembled. |
country_zone |
string
The geographic area where the vehicle was assembled or manufactured. Possible values: Africa, Asia, Europe, North America, South America y Oceania |
sent |
string
The VIN code as it was sent in your request, before it is corrected in case of detecting errors. |
considered_vins |
array
A list of the VINs that were considered during the autocorrection phase, in case the vin was considered correct as provided to the API will contain a single element. In the event that the API has considered several VINs, this list will contain those that it has considered together with a quality score). Each element of the considered_vins array contains:
vin_code: The considered VIN code string
quality: The score that the API gave to that vin code, and which may be affected by scoring filters if provided. float
|
Response with errors
{
"success": false,
"errors": [
{
"id": "MISSING_REQUIRED_PARAMETER",
"image_file": "Specify an image with 'image_file' or 'image_url'",
"on": "image_file"
}
]
}
Response without detectable VINs
{
"results": [],
"found_vins": 0,
"success": true
}
Images without detectable VINs and Billing
When no VIN code can be found, the application will contain no errors in the errors array, success will be true, and the results array will be not set.
This allows you to use the API to ensure that the image does not contain any detectable VIN.
All those in which the image can be scanned and do not return errors in the errors array will be billed as valid requests.
A request whose image does not contain detectable VINS has its usual cost and will be invoiced.
Getting all manufacturers.
To get all the vehicle manufacturers that the API can return to prepare your database or to create your filters, you can use the following endpoint.
Parameter | Description |
---|---|
application_id |
string required An application id. You can get the id of an application by clicking on 'details' in your panel |
api_key |
string required The API KEY of the application that makes the call to this API, you can obtain it in your panel, by clicking on the 'details' button of an application |
A list containing all possible manufacturers will be returned::
{
"success": true,
"manufacturers": [
{
"code": "LDC",
"name": "Dongfeng Peugeot-Citroën",
"zone": "Europe",
"country": "Slovenia",
"brands": ["Peugeor","Citroën"]
}
]
}
Getting all countries.
If you want to get all the countries where the vehicle manufacturers operate to prepare your database, or to create filters, you can use the following endpoint.
Parameter | Description |
---|---|
application_id |
string required An application id. You can get the id of an application by clicking on 'details' in your panel |
api_key |
string required The API KEY of the application that makes the call to this API, you can obtain it in your panel, by clicking on the 'details' button of an application |
A list with all the countries and the zone to which they belong will be returned.
{
"success": true,
"countries": [
{
"code": "KA-KE",
"name": "Sri Lanka",
"zone": "Asia"
}
]
}
Obtaining all commercial brands.
If you need to get all the vehicle commercial brands that the API can return to prepare your database, or to create filters, you can use the following endpoint.
Parameter | Description |
---|---|
application_id |
string required An application id. You can get the id of an application by clicking on 'details' in your panel |
api_key |
string required The API KEY of the application that makes the call to this API, you can obtain it in your panel, by clicking on the 'details' button of an application |
A list with all commercial brands will be returned.
{
"success": true,
"brands": [
"opel","peugeot","sundiro","..."
]
}
PHP Integration
ZPK-PHP is an open source composer-installable library that will allow you to integrate our APIs into your PHP project with minimal effort.
Installing ZPK-PHP with composer
composer require zpksystems/phpzpk
Example request
<?php
// Initialize ZPK application
$zpk = new PHPZPK(APPLICATION_ID,API_KEY);
// Initialize VinOcr
$vinOcr = new VinOcr($zpk);
$vinOcr->setImageFile('test_vin_image.png');
// Make a request
$response = $vinOcr->fetch();
// Dump the response as array
var_dump($response);
Pricing
VinOCR has a cost per number of requests, the price of a request is 0.003 € which will be deducted from your current credit.
If you do not have credit in your account when making a request, the VinOCR API will return an error.