How does InstantDrive read Emirates ID, TRN, Ejari and IBAN documents?
InstantDrive reads standard UAE formats with a pattern engine, runs local OCR on scans and photos, and calls Google Gemini vision only when OCR confidence is below 90 percent, no text was read, or an unknown scan stays unrecognised. In those cases the image is sent to Google.
What does document reading do?
When a file is uploaded, InstantDrive reads it to decide what kind of document it is and to pull out the fields that matter: an entity name, an identifier, an issue or expiry date and, for invoices and statements, amounts. Those fields drive the file name, the vault folder, search and the expiry tools.
Reading happens in layers. A pattern engine handles text that is already readable. Local OCR turns images into text first. A vision model from Google is the last layer, used only for scans the earlier layers cannot read well. This page explains each layer, when the last one runs, what leaves InstantDrive when it does, and why you should still check the result.
Which formats does the pattern engine read?
The pattern engine uses fixed rules, not a language model. It looks for known number shapes and keywords in the text and assigns a type. It costs nothing per document and gives the same answer for the same text each time.
The engine also recognises many date layouts, including labels in Arabic such as the Arabic words for expiry date and issue date, and currency codes such as AED, USD and SAR.
| Document type | What the engine looks for | Fields it can fill |
|---|---|---|
| Emirates ID | A number in the shape 784-YYYY-NNNNNNN-C, or the words Emirates ID | ID number, name, nationality, dates |
| Passport | Machine-readable lines starting P<, a passport number, or the word passport | Passport number, name, dates |
| Residence visa | A visa file number or words such as residence permit | File or UID number, name, dates |
| Tax invoice or receipt | A tax registration number (100 followed by 12 digits, or 15 digits after a TRN label), or words such as invoice and receipt | TRN, invoice number, vendor, totals, 5 percent VAT, dates |
| Ejari or tenancy contract | The words Ejari, tenancy contract or lease agreement, and an Ejari number | Ejari number, parties, premises, dates |
| Bank statement | A UAE IBAN (AE plus 21 characters, checked for validity) or the words bank statement | IBAN, bank name |
| MOHRE labour contract | A contract number starting MB- or MOHRE wording | Contract number, dates |
| Trade licence | Numbers starting CN, DMCC, DED, DIFC, CL, ADGM, RAKEZ or IFZA, or licence wording | Licence number, jurisdiction, legal form, dates |
| Commercial contract | Wording such as service agreement or master services agreement | Parties, dates |
Why does the order of the checks matter?
The engine tests document types in a fixed order and stops at the first match: Emirates ID, passport, visa, tax invoice, Ejari, bank statement, labour contract, trade licence, commercial contract. The tax invoice test is broad. A single word such as receipt, bill or invoice, or a valid tax registration number, is enough to place a document there.
So a lease agreement that mentions the word invoice in a payment clause, or a licence that carries a supplier TRN, can be classified earlier in the list than you expect. A trade licence number can also be matched by any plain number of six to eight digits. When a document is labelled with an unexpected type, correct the category in the document panel. Do not assume the type is always right just because the identifier looked valid.
How does local OCR work?
Photos and scanned pages have no text to match, so InstantDrive runs optical character recognition on its own server with RapidOCR. This step does not call an outside service. For speed, the image is shrunk so that its longest side is at most 800 pixels before recognition, which can lose small print on large pages.
PDFs are treated in two ways. A PDF with a text layer is read directly from that layer, using the first five pages and also the last page when the file is longer than five pages. A PDF with no text layer, such as a scan, is rendered as an image and only its first page is passed through OCR. Pages after the first are not read in that case. Each recognised line gets a confidence score, and the average of those scores is used in the next step.
When exactly does the Gemini vision fallback run?
The vision fallback runs only for images and scanned PDFs, meaning files that went through OCR. It never runs for PDFs with a text layer, email files or text files. For a scan, it runs when at least one of these conditions is true.
A clean photo of an Emirates ID that OCR reads with high confidence and that matches the pattern does not reach the fallback. A blurred photo of the same card can. The fallback depends on a Google API key being configured on the server. If the call fails or times out after 15 seconds, InstantDrive keeps what OCR and the pattern engine found.
| Condition | Meaning |
|---|---|
| Average OCR confidence below 0.90 | The text recognition is not sure of what it read |
| No text was read | OCR returned nothing, for example from a blurred or very dark photo |
| Pattern confidence below 0.90 and the type is unknown | Text was read but matched no known UAE document type |
What is sent to Google when the fallback runs?
The uploaded image, or the scanned PDF, is sent to Google Gemini together with an instruction to return the document type, entity, identifier, dates and amounts as structured data, and to return null for anything illegible. The code names Gemini 1.5 Flash for this call. This is a transfer of the document to a third party, so state it plainly in your own policies: documents that take the fallback path leave InstantDrive and go to Google.
Documents that read cleanly stay on InstantDrive and Cloudflare storage and do not take this path. You cannot choose per document to block the fallback from the app. If your company has documents that must never go to an outside AI service, ask InstantDrive how to handle them before you upload.
Values returned by Google replace the values found earlier for the same fields, when Google returns a value. Fields that Google leaves empty keep the earlier result.
What are the confidence thresholds?
There are two kinds of score. The pattern engine assigns a fixed score to each type it matches, and OCR gives a score per line. The fallback threshold is 0.90 for both.
A fixed score says the pattern matched, not that the value is correct. A tax invoice scores 0.98 whether the OCR read the TRN digit by digit correctly or swapped a character.
| Source | Score | Notes |
|---|---|---|
| Emirates ID, passport, valid IBAN | 0.99 | Fixed score for a pattern match |
| Tax invoice | 0.98 | Fixed score |
| Residence visa | 0.97 | Fixed score |
| Ejari, trade licence | 0.96 | Fixed score |
| MOHRE contract | 0.95 | Fixed score |
| Commercial contract | 0.92 | Fixed score |
| No type recognised | 0.85 | Starting value, below the threshold |
| Gemini result | Between 0.90 and 1.00 | The model reports its own score, so it is not an independent measure |
What happens when confidence is low?
Nothing blocks the upload. The document is stored, named and filed with the best fields found. The score is saved with the document and shown as a percentage in the vault and in the document panel, and the vault list can be ordered by it. There is no review queue and no alert that tells someone to look at a low score.
The practical step is yours. Open documents with a low score, compare the fields with the image and correct them in the document panel. An unrecognised document is filed in the Admin Vault with a generic name until you correct its category. A password-protected or damaged PDF is stored with a score of 0.5 and no extracted fields.
What does a fictional example look like from upload to result?
Al Noor Trading LLC is a fictional Dubai company. An employee photographs a supplier invoice from Gulf Fresh Supplies LLC on a phone. The photo is converted to WebP and read by local OCR. The average line confidence is 0.93, the text contains a tax registration number starting 100 and the word invoice, so the pattern engine classifies it as a tax invoice with a score of 0.98. The fallback does not run and the image stays on InstantDrive.
The next day the employee uploads a photo of a handwritten delivery note taken in poor light. OCR reads little text and its average confidence is 0.71. The fallback runs, the image goes to Google, and the note returns as a general document with a supplier name and a date. The finance clerk opens the record, sees the lower score, compares the fields with the photo and fixes the date.
What does document reading not do?
It does not read archives, audio, video, CAD files or encrypted PDFs. It reads only the first page of a scanned PDF, so a scanned contract of twenty pages is classified from page one. It does not verify anything with a government service. A valid-looking Emirates ID number is not checked against the Federal Authority for Identity, Citizenship, Customs and Port Security. A tax registration number is not checked against the Federal Tax Authority, and an Ejari number is not looked up with the Dubai Land Department.
It does not understand context in the way a person does. It can confuse an issue date with a due date, read a similar-looking character wrongly and choose the wrong entity from a page with several company names. It also does not guarantee that HEIC or AVIF photos are read as well as common formats.
Why should you check the extracted fields?
Extracted fields feed the file name, the vault search and the expiry tracking, so a wrong digit or date spreads into all of them. Check the identifier, the entity name and above all the expiry date on identity documents, licences and contracts. For invoices, check the totals and the VAT amount before you use them in any filing. The finance tools compute from these fields, and they are estimates until a person has confirmed them.
A good routine is to open each new identity or licence document once, confirm the three fields against the image, and correct any mistake in the document panel. After that, the stored values are the ones you verified.
Keep these documents in one drive
InstantDrive stores your licences, Emirates IDs, tenancy contracts and invoices, reads the numbers and dates, and names every file in one pattern.
Open the appPricing