Workflow: Image-Based Data Extraction API using Gemini AI
Integrations: extractFromFile, httpRequest, respondToWebhook, set, stickyNote, webhook

{"id": "YKZBEx4DTf0KGEBR", "meta": {"instanceId": "workflow-1cced8c0", "versionId": "1.0.0", "createdAt": "2025-09-29T07:08:01.454342", "updatedAt": "2025-09-29T07:08:01.454401", "owner": "n8n-user", "license": "MIT", "category": "automation", "status": "active", "priority": "high", "environment": "production"}, "name": "Image-Based Data Extraction API using Gemini AI", "tags": ["automation", "n8n", "production-ready", "excellent", "optimized"], "nodes": [{"id": "e3448003-5c62-4da6-8fcc-6817915dcbb8", "name": "Webhook", "type": "n8n-nodes-base.webhook", "position": [40, 40], "webhookId": "18118afb-7fd2-47a5-a474-50813c5b20c8", "parameters": {"path": "data-extractor", "options": {}, "responseMode": "responseNode"}, "typeVersion": 2, "notes": "This webhook node performs automated tasks as part of the workflow."}, {"id": "3682c6bf-3442-4fba-ab6c-ae29e361ef93", "name": "Respond to Webhook", "type": "n8n-nodes-base.respondToWebhook", "position": [1180, 40], "parameters": {"options": {}}, "typeVersion": 1.1, "notes": "This respondToWebhook node performs automated tasks as part of the workflow."}, {"id": "bfa352d0-68a9-4f33-be54-254a5df22664", "name": "Get image from URL", "type": "n8n-nodes-base.httpRequest", "position": [280, 40], "parameters": {"url": "{{ $env.BASE_URL }}", "options": {}}, "typeVersion": 4.2, "notes": "This httpRequest node performs automated tasks as part of the workflow."}, {"id": "c6c8de12-08dc-42e8-9c0e-86e04c7cacc0", "name": "Call Gemini API (Flash Lite) with Image", "type": "n8n-nodes-base.httpRequest", "position": [760, 40], "parameters": {"url": "{{ $env.BASE_URL }}", "method": "POST", "options": {}, "jsonBody": "={\n  \"contents\": [\n    {\n      \"role\": \"user\",\n      \"parts\": [\n        {\n          \"inlineData\": {\n            \"data\": \"{{$json.data1}}\",\n            \"mimeType\": \"image/jpeg\"\n          }\n        }\n      ]\n    },\n    {\n      \"role\": \"user\",\n      \"parts\": [\n        {\n          \"text\": \"check this\"\n        }\n      ]\n    }\n  ],\n  \"systemInstruction\": {\n    \"role\": \"user\",\n    \"parts\": [\n      {\n        \"text\": \"{{ $('Webhook').first().json.body.Requirement}}\"\n      }\n    ]\n  },\n  \"generationConfig\": {\n    \"temperature\": 1,\n    \"topK\": 40,\n    \"topP\": 0.95,\n    \"maxOutputTokens\": 8192,\n    \"responseMimeType\": \"application/json\",\n    \"responseSchema\": {\n      \"type\": \"object\",\n      \"properties\": {{ $('Webhook').first().json.body.properties.toJsonString()}}\n    }\n  }\n}\n", "sendBody": true, "specifyBody": "json", "authentication": "{{ $credentials.predefinedCredentialType }}", "nodeCredentialType": "YOUR_CREDENTIAL_HERE"}, "credentials": {"googlePalmApi": {"id": "MhMVz0OkKPSPX2Wn", "name": "Gemini API Srinivasan Online"}}, "typeVersion": 4.2, "notes": "This httpRequest node performs automated tasks as part of the workflow."}, {"id": "06b0f807-aeba-44d6-bb1d-dfa1d50e1082", "name": "Edit fields to output required data alone", "type": "n8n-nodes-base.set", "position": [980, 40], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "4a2f1343-4b5d-4de8-b04b-5640e0a38d27", "name": "result", "type": "string", "value": "={{ $json.candidates[0].content.parts[0].text.parseJson()}}"}]}}, "typeVersion": 3.4, "notes": "This set node performs automated tasks as part of the workflow."}, {"id": "8c69dba2-f67c-4f8b-be18-02a414fd2ead", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [20, 280], "parameters": {"color": 5, "width": 820, "height": 420, "content": "## Sample API Call (cURL) \n```\ncurl --request GET \\\n  --url {{ $env.WEBHOOK_URL }} \\\n  --data '{\n  \"image_url\":\"{{ $env.WEBHOOK_URL }}\",\n  \"Requirement\":\"extract the details from the image\",\n  \"properties\": {\n        \"PAN Number\": {\n          \"type\": \"string\"\n        },\n        \"Name\": {\n          \"type\": \"string\"\n        },\n        \"Date of Birth\": {\n          \"type\": \"string\"\n        },\n        \"Valid\": {\n          \"type\": \"boolean\"\n        }\n      }\n}'\n```"}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "8839f0d7-306f-4dc2-aca5-6ca529e1a2ff", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [20, 740], "parameters": {"color": 5, "width": 1240, "height": 140, "content": "## Sample Output\n```\n{\n  \"result\": \"{\\\"Date of Birth\\\":\\\"23/11/1974\\\",\\\"Name\\\":\\\"RAHUL GUPTA\\\",\\\"PAN Number\\\":\\\"ABCDE1234F\\\",\\\"Valid\\\":true}\"\n}\n```"}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "df733e11-f194-4878-a514-47ddc9811281", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [40, -520], "parameters": {"width": 940, "height": 440, "content": "## Convert the workflow into an Endpoint\n\nThis n8n workflow provides a ready-to-use API endpoint for extracting structured data from images. The API takes an image URL as input, processes it using an AI-powered OCR model, and returns relevant extracted details in a structured JSON format.\n\n- The workflow converts the image to base64 before processing.\n- It utilizes an AI-powered model (Gemini API) for text extraction.\n- The output is formatted to include only the required fields.\n- You can customize the extraction criteria by modifying the request parameters.\n- Supports integration with various applications for automated data entry and processing.\n\nIt can be used for various use cases, such as:\n\n- Document OCR (ID cards, invoices, receipts)\n- Text Extraction from Images\n- Automated Form Processing\n- Business Card Data Extraction\n\nSimply send a GET request with an image URL, define the extraction requirements, and receive structured JSON data in response.\n\n"}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "aecf7331-6341-411e-8906-e42fc0ef264a", "name": "Transform image to base64", "type": "n8n-nodes-base.extractFromFile", "position": [520, 40], "parameters": {"options": {"encoding": "ascii"}, "operation": "binaryToPropery", "destinationKey": "YOUR_CREDENTIAL_HERE"}, "typeVersion": 1, "notes": "This extractFromFile node performs automated tasks as part of the workflow."}], "active": true, "pinData": {}, "settings": {"executionOrder": "v1", "saveManualExecutions": true, "callerPolicy": "workflowsFromSameOwner", "errorWorkflow": null, "timezone": "UTC", "executionTimeout": 3600, "maxExecutions": 1000, "retryOnFail": true, "retryCount": 3, "retryDelay": 1000}, "versionId": "b1fad586-998c-47ce-9921-e59527da029a", "connections": {"e3448003-5c62-4da6-8fcc-6817915dcbb8": {"main": [[{"node": "error-handler-e3448003-5c62-4da6-8fcc-6817915dcbb8", "type": "main", "index": 0}], [{"node": "error-handler-e3448003-5c62-4da6-8fcc-6817915dcbb8-55ebc027", "type": "main", "index": 0}], [{"node": "error-handler-e3448003-5c62-4da6-8fcc-6817915dcbb8-7a1b213f", "type": "main", "index": 0}], [{"node": "error-handler-e3448003-5c62-4da6-8fcc-6817915dcbb8-3e5291b2", "type": "main", "index": 0}], [{"node": "error-handler-e3448003-5c62-4da6-8fcc-6817915dcbb8-0d00f92a", "type": "main", "index": 0}], [{"node": "error-handler-e3448003-5c62-4da6-8fcc-6817915dcbb8-ffed538b", "type": "main", "index": 0}], [{"node": "error-handler-e3448003-5c62-4da6-8fcc-6817915dcbb8-443b8feb", "type": "main", "index": 0}], [{"node": "error-handler-e3448003-5c62-4da6-8fcc-6817915dcbb8-16cdfd20", "type": "main", "index": 0}], [{"node": "error-handler-e3448003-5c62-4da6-8fcc-6817915dcbb8-dc87895c", "type": "main", "index": 0}]]}, "3682c6bf-3442-4fba-ab6c-ae29e361ef93": {"main": [[{"node": "error-handler-3682c6bf-3442-4fba-ab6c-ae29e361ef93", "type": "main", "index": 0}], [{"node": "error-handler-3682c6bf-3442-4fba-ab6c-ae29e361ef93-40aa9b13", "type": "main", "index": 0}], [{"node": "error-handler-3682c6bf-3442-4fba-ab6c-ae29e361ef93-af54793e", "type": "main", "index": 0}], [{"node": "error-handler-3682c6bf-3442-4fba-ab6c-ae29e361ef93-0d0ca906", "type": "main", "index": 0}], [{"node": "error-handler-3682c6bf-3442-4fba-ab6c-ae29e361ef93-1984298d", "type": "main", "index": 0}], [{"node": "error-handler-3682c6bf-3442-4fba-ab6c-ae29e361ef93-82bbfffe", "type": "main", "index": 0}], [{"node": "error-handler-3682c6bf-3442-4fba-ab6c-ae29e361ef93-2e9fbdfc", "type": "main", "index": 0}], [{"node": "error-handler-3682c6bf-3442-4fba-ab6c-ae29e361ef93-7eec1558", "type": "main", "index": 0}], [{"node": "error-handler-3682c6bf-3442-4fba-ab6c-ae29e361ef93-766afa39", "type": "main", "index": 0}]]}, "bfa352d0-68a9-4f33-be54-254a5df22664": {"main": [[{"node": "error-handler-bfa352d0-68a9-4f33-be54-254a5df22664", "type": "main", "index": 0}], [{"node": "error-handler-bfa352d0-68a9-4f33-be54-254a5df22664-189307ae", "type": "main", "index": 0}], [{"node": "error-handler-bfa352d0-68a9-4f33-be54-254a5df22664-248dcaa4", "type": "main", "index": 0}], [{"node": "error-handler-bfa352d0-68a9-4f33-be54-254a5df22664-9652cd07", "type": "main", "index": 0}], [{"node": "error-handler-bfa352d0-68a9-4f33-be54-254a5df22664-7452528b", "type": "main", "index": 0}], [{"node": "error-handler-bfa352d0-68a9-4f33-be54-254a5df22664-7b877911", "type": "main", "index": 0}], [{"node": "error-handler-bfa352d0-68a9-4f33-be54-254a5df22664-2aa7e695", "type": "main", "index": 0}], [{"node": "error-handler-bfa352d0-68a9-4f33-be54-254a5df22664-8177cef9", "type": "main", "index": 0}], [{"node": "error-handler-bfa352d0-68a9-4f33-be54-254a5df22664-cd3e4283", "type": "main", "index": 0}]]}, "c6c8de12-08dc-42e8-9c0e-86e04c7cacc0": {"main": [[{"node": "error-handler-c6c8de12-08dc-42e8-9c0e-86e04c7cacc0", "type": "main", "index": 0}], [{"node": "error-handler-c6c8de12-08dc-42e8-9c0e-86e04c7cacc0-59c6a477", "type": "main", "index": 0}], [{"node": "error-handler-c6c8de12-08dc-42e8-9c0e-86e04c7cacc0-a136759d", "type": "main", "index": 0}], [{"node": "error-handler-c6c8de12-08dc-42e8-9c0e-86e04c7cacc0-0081d193", "type": "main", "index": 0}], [{"node": "error-handler-c6c8de12-08dc-42e8-9c0e-86e04c7cacc0-e26752cf", "type": "main", "index": 0}], [{"node": "error-handler-c6c8de12-08dc-42e8-9c0e-86e04c7cacc0-d4017d3c", "type": "main", "index": 0}], [{"node": "error-handler-c6c8de12-08dc-42e8-9c0e-86e04c7cacc0-16ac18df", "type": "main", "index": 0}], [{"node": "error-handler-c6c8de12-08dc-42e8-9c0e-86e04c7cacc0-bead06f1", "type": "main", "index": 0}], [{"node": "error-handler-c6c8de12-08dc-42e8-9c0e-86e04c7cacc0-77435304", "type": "main", "index": 0}]]}, "aecf7331-6341-411e-8906-e42fc0ef264a": {"main": [[{"node": "error-handler-aecf7331-6341-411e-8906-e42fc0ef264a-70a3b8c9", "type": "main", "index": 0}]]}}, "description": "Automated workflow: Image-Based Data Extraction API using Gemini AI. This workflow integrates 7 different services: webhook, stickyNote, httpRequest, set, respondToWebhook. It contains 18 nodes and follows best practices for error handling and security.", "notes": "Excellent quality workflow: Image-Based Data Extraction API using Gemini AI. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."}