Extract Indian Vehicle RC Data with n8n: Drive to Fleet Sheets
Watch Google Drive for RC front/back scans, call Cryvis POST /v1/documents/indian-vehicle-rc with multipart front/back binaries, and append registration and chassis fields to a fleet Google Sheet.
Fleet ops still retype Registration Certificate (RC) fields into spreadsheets. This n8n workflow watches a Drive folder for Indian RC front and/or back images, calls Cryvis POST /v1/documents/indian-vehicle-rc, and appends structured vehicle rows to Google Sheets for fleet inventory.
Related: Automate KYC, Convert PDFs to JSON. Hub: /blog/n8n.
Architecture
Google Drive
/fleet-rc/inbox/
KA01AB1234_front.jpg
KA01AB1234_back.jpg
|
v
n8n: pair front/back by prefix
|
v
POST https://api.cryvis.com/v1/documents/indian-vehicle-rc
-F front=@... ($binary.front)
-F back=@... ($binary.back)
-H "Authorization: Bearer ..."
|
v
Google Sheets: Fleet registryAPI contract
| Item | Value |
|---|---|
| URL | https://api.cryvis.com/v1/documents/indian-vehicle-rc |
| Auth | Authorization: Bearer YOUR_API_KEY |
| Multipart | front and/or back — at least one required |
| Not used | Do not send a generic file part for this endpoint |
cURL:
curl -X POST https://api.cryvis.com/v1/documents/indian-vehicle-rc \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "front=@rc-front.jpg" \
-F "back=@rc-back.jpg"Docs: /docs/api/extractIndianVehicleRc · /apis/indian-vehicle-rc.
Step 1: Drive naming convention
{registration_guess}_front.jpg
{registration_guess}_back.jpgExamples: KA01AB1234_front.jpg, KA01AB1234_back.jpg. Registration guess is only for pairing — trust Cryvis registration_number in the Sheet.
Folders:
/fleet-rc/inbox
/fleet-rc/done
/fleet-rc/failedStep 2: Watch and pair
Google Drive Trigger on inbox.
Set (or Code) to derive pair key and side:
pair_key = {{ $json.name.replace(/_front|_back/gi, '').replace(/\.[^.]+$/, '') }}
side = {{ $json.name.toLowerCase().includes('_front') ? 'front' : 'back' }}When a pair_key has front only, back only, or both, proceed — Cryvis accepts any non-empty combination of front/back. Waiting for both improves completeness (source often becomes front_and_back).
Pairing strategies in n8n
- Static Data / Data Store — on first side, write
pair_key→{ frontId, backId }. On second side, merge and only then call Cryvis; clear the entry after success. - Wait — after seeing one side, Wait 60–120s, re-list folder for the sibling file, then proceed with whatever exists (front-only still valid).
- Manual batch — ops drops both files, then moves a
READYmarker that triggers the workflow.
Prefer (1) for production fleets; (3) for low volume.
Step 3: Download binaries into named properties
Download available sides. Assign binary property names explicitly:
| Condition | Binary properties |
|---|---|
| Both | $binary.front, $binary.back |
| Front only | $binary.front |
| Back only | $binary.back |
If Drive Download always writes $binary.data, use a Code or Move Binary Data step to rename:
const items = [];
const item = $input.first();
const side = item.json.side; // 'front' | 'back'
const binary = {};
binary[side] = item.binary.data;
items.push({ json: item.json, binary });
return items;When both sides are ready, Merge the two items into one item that carries both binary keys before HTTP.
Step 4: HTTP Request
HTTP Request → multipart:
| Part name | Type | When |
|---|---|---|
front | Binary | if $binary.front exists |
back | Binary | if $binary.back exists |
Use IF branches or two HTTP node variants if your n8n version cannot conditionally omit multipart parts — never send an empty file part.
Response data example:
{
"success": true,
"data": {
"registration_number": "KA01AB1234",
"registration_date": "2019-06-15",
"owner_name": "RAHUL SHARMA",
"address": "12 MG Road, Bengaluru, Karnataka 560001",
"vehicle_class": "LMV",
"manufacturer": "MARUTI SUZUKI",
"model": "SWIFT",
"chassis_number": "MA3EJLF1S00123456",
"engine_number": "K12MN1234567",
"fuel_type": "Petrol",
"insurance_valid_upto": "2025-06-14",
"fitness_valid_upto": "2026-06-14",
"financier": "HDFC BANK LTD",
"source": "front_and_back"
}
}Map with expressions:
{{ $json.data.registration_number }}
{{ $json.data.chassis_number }}
{{ $json.data.engine_number }}
{{ $json.data.insurance_valid_upto }}
{{ $json.data.source }}source tells you whether extraction used front, back, or both — useful when chassis is missing (often on the side you did not upload).
Step 5: Fleet Sheet columns
| Column | Field |
|---|---|
| processed_at | {{ $now.toISO() }} |
| registration_number | {{ $json.data.registration_number }} |
| registration_date | {{ $json.data.registration_date }} |
| owner_name | {{ $json.data.owner_name }} |
| address | {{ $json.data.address }} |
| vehicle_class | {{ $json.data.vehicle_class }} |
| manufacturer | {{ $json.data.manufacturer }} |
| model | {{ $json.data.model }} |
| chassis_number | {{ $json.data.chassis_number }} |
| engine_number | {{ $json.data.engine_number }} |
| fuel_type | {{ $json.data.fuel_type }} |
| insurance_valid_upto | {{ $json.data.insurance_valid_upto }} |
| fitness_valid_upto | {{ $json.data.fitness_valid_upto }} |
| financier | {{ $json.data.financier }} |
| source | {{ $json.data.source }} |
| drive_pair_key | from Set |
| status | ok / error |
Google Sheets → Append Row. Optionally look up registration_number first and Update instead of Append to keep one row per vehicle.
Steps 6–8: Completeness, move, errors
IF empty chassis_number or engine_number → status_note=incomplete_identifiers (+ optional Slack). Still write the Sheet row. Success → done/{pair_key}/; error → failed/. Preserve Drive file ids with Set + Merge before HTTP.
| Cause | Fix |
|---|---|
No front or back | At least one required |
Used file like PAN | Wrong field names |
| 401 / unreadable | Bearer token / re-shoot |
Error Trigger: error row + Slack with pair_key.
Upsert and credits
Search Sheets on normalized registration_number (toUpperCase().replace(/\s+/g, '')): Update if found, Append if new. 1 credit per image (front+back = two). Prefer source=front_and_back. Never send file or first_page — only front and/or back.
Related reading
CTA
Extract Indian RC front/back to JSON: /apis/indian-vehicle-rc. Docs: /docs/api/extractIndianVehicleRc. In n8n, POST multipart front and/or back from $binary to https://api.cryvis.com/v1/documents/indian-vehicle-rc with Bearer auth and write {{ $json.data.registration_number }}, {{ $json.data.chassis_number }}, and insurance dates into your fleet Sheet.