International ID
The Ruby Client Library supports the International ID API.
Product Specifications
Endpoint Name
international_id
Recommended Version
v2.2
Supports Polling/Webhooks
✔️ Yes
Support Synchronous HTTP Calls
❌ No
Geography
🌐 Global
Quick-Start
Using the sample below, we are going to illustrate how to extract the data that we want using the SDK.

Sample Code
#
# Install the Ruby client library by running:
# gem install mindee
#
require 'mindee'
# Init a new client
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
# Load a file from disk
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
# Parse the file
result = mindee_client.parse(
input_source,
Mindee::Product::InternationalId::InternationalIdV2
)
# Print a full summary of the parsed data in RST format
puts result.document
# Print the document-level parsed data
# puts result.document.inference.predictionSample Output (rST)
########
Document
########
:Mindee ID: cfa20a58-20cf-43b6-8cec-9505fa69d1c2
:Filename: default_sample.jpg
Inference
#########
:Product: mindee/international_id v2.0
:Rotation applied: No
Prediction
==========
:Document Type: IDENTIFICATION_CARD
:Document Number: 12345678A
:Surnames: MUESTRA
MUESTRA
:Given Names: CARMEN
:Sex: F
:Birth Date: 1980-01-01
:Birth Place: CAMPO DE CRIPTANA CIUDAD REAL ESPANA
:Nationality: ESP
:Personal Number: BAB1834284<44282767Q0
:Country of Issue: ESP
:State of Issue: MADRID
:Issue Date:
:Expiration Date: 2030-01-01
:Address: C/REAL N13, 1 DCHA COLLADO VILLALBA MADRID MADRID MADRID
:MRZ Line 1: IDESPBAB1834284<44282767Q0<<<<
:MRZ Line 2: 8001010F1301017ESP<<<<<<<<<<<3
:MRZ Line 3: MUESTRA<MUESTRA<<CARMEN<<<<<<<Standard Fields
These fields are generic and used in several products.
Basic Field
Each prediction object contains a set of fields that inherit from the generic Field class. A typical Field object will have the following attributes:
value (
String,Float,Integer,bool): corresponds to the field value. Can benilif no value was extracted.confidence (Float, nil): the confidence score of the field prediction.
bounding_box (
Mindee::Geometry::Quadrilateral,nil): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.polygon (
Mindee::Geometry::Polygon,nil): contains the relative vertices coordinates (Point) of a polygon containing the field in the image.page_id (
Integer,nil): the ID of the page, alwaysnilwhen at document-level.reconstructed (
bool): indicates whether an object was reconstructed (not extracted as the API gave it).
Aside from the previous attributes, all basic fields have access to a to_s method that can be used to print their value as a string.
Classification Field
The classification field ClassificationField does not implement all the basic Field attributes. It only implements value, confidence and page_id.
Date Field
Aside from the basic Field attributes, the date field DateField also implements the following:
date_object (
Date): an accessible representation of the value as a JavaScript object.
String Field
The text field StringField only has one constraint: it's value is a String (or nil).
Attributes
The following fields are extracted for International ID V2:
Address
address (StringField): The physical address of the document holder.
puts result.document.inference.prediction.address.valueBirth Date
birth_date (DateField): The date of birth of the document holder.
puts result.document.inference.prediction.birth_date.valueBirth Place
birth_place (StringField): The place of birth of the document holder.
puts result.document.inference.prediction.birth_place.valueCountry of Issue
country_of_issue (StringField): The country where the document was issued.
puts result.document.inference.prediction.country_of_issue.valueDocument Number
document_number (StringField): The unique identifier assigned to the document.
puts result.document.inference.prediction.document_number.valueDocument Type
document_type (ClassificationField): The type of personal identification document.
Possible values include:
'IDENTIFICATION_CARD'
'PASSPORT'
'DRIVER_LICENSE'
'VISA'
'RESIDENCY_CARD'
'VOTER_REGISTRATION'
puts result.document.inference.prediction.document_type.valueExpiration Date
expiry_date (DateField): The date when the document becomes invalid.
puts result.document.inference.prediction.expiry_date.valueGiven Names
given_names (Array<StringField>): The list of the document holder's given names.
result.document.inference.prediction.given_names do |given_names_elem|
puts given_names_elem.value
endIssue Date
issue_date (DateField): The date when the document was issued.
puts result.document.inference.prediction.issue_date.valueMRZ Line 1
mrz_line1 (StringField): The Machine Readable Zone, first line.
puts result.document.inference.prediction.mrz_line1.valueMRZ Line 2
mrz_line2 (StringField): The Machine Readable Zone, second line.
puts result.document.inference.prediction.mrz_line2.valueMRZ Line 3
mrz_line3 (StringField): The Machine Readable Zone, third line.
puts result.document.inference.prediction.mrz_line3.valueNationality
nationality (StringField): The country of citizenship of the document holder.
puts result.document.inference.prediction.nationality.valuePersonal Number
personal_number (StringField): The unique identifier assigned to the document holder.
puts result.document.inference.prediction.personal_number.valueSex
sex (StringField): The biological sex of the document holder.
puts result.document.inference.prediction.sex.valueState of Issue
state_of_issue (StringField): The state or territory where the document was issued.
puts result.document.inference.prediction.state_of_issue.valueSurnames
surnames (Array<StringField>): The list of the document holder's family names.
result.document.inference.prediction.surnames do |surnames_elem|
puts surnames_elem.value
endLast updated
Was this helpful?

