{ "updatedAt": "2026-01-04T17:21:04.000Z", "createdAt": "2025-12-21T08:27:02.744Z", "id": "N4n2HmA6azz8n7Uw", "name": "Main_paperless_ollama", "active": false, "isArchived": false, "nodes": [ { "parameters": {}, "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ -272, -448 ], "id": "14b9aab7-ef42-4b8b-a9de-7ca6403fc9bd", "name": "When clicking ‘Execute workflow’" }, { "parameters": { "modelId": { "__rl": true, "value": "ministral-3:3b", "mode": "list", "cachedResultName": "ministral-3:3b" }, "messages": { "values": [ { "content": "=[Korrespodent Start]\n{{ JSON.stringify($('getCorrespondent').all().map(i => ({ id: i.json.paperless_id, name: i.json.name }))) }}\n[Korrespodent End]\n\n[Tags Start]\n{{ JSON.stringify($('getTags').all().map(i => ({ id: i.json.paperless_id, name: i.json.name }))) }}\n[Tags End]\n\n[Documents Start]\n{{ JSON.stringify($('getDocuments').all().map(i => ({ id: i.json.paperless_id, name: i.json.name }))) }}\n[Documents End]\n\n[Dokument Inhalt Start]\n{{ $('documentObject').item.json.document[0].content.substring(1,1000) }}\n[Dokument Inhalt Ende]" } ] }, "options": { "system": "Kannst du bitte für dieses Dokument einen Title, Korrespondent, Dokumenttyp und Tags extrahieren. Die ich für mein Paperless verwenden kann?\nVersuche erst einen passenden Korrespondent und Tag aus meiner Liste was ich anhänge zu finden. Achte auf die Sin Wenn du es nicht findest weise einen passenden Vorschlag zu.\n\nStelle sicher das ausschließlich mit purem JSON. Nutze keine Markdown-Formatierung wie ` ` `json. Beginne direkt mit der öffnenden geschweiften Klammer {.\n\nBeispielantwort 1 wenn eine Korrespondent ID, Document_type und Tags vorhanden sind\n\n{\n\"Title\": \"SLK Klinik Beinoperation\",\n\"Korrespondent-ID\": 1,\n\"Korrespondent\": \"SLK Klinik\",\n\"Tags-ID\":[6,8],\n\"Tags:[\"Arztbriefe\", \"Medikamente\"],\n\"Document_type_id\": 8,\n\"Document_typ\": \"Information\"\n}\n\nBeispielantwort 2 wenn eine Korrespondent ID, Document_type und Tags nicht vorhanden sind\n{\n\"Title\": \"SLK Klinik Beinoperation\",\n\"Korrespondent-ID\": null,\n\"Korrespondent\": \"SLK Klinik\",\n\"Tags-ID\":[null],\n\"Tags:[\"Operation\", \"Varatharajan\"],\n\"Document_type_id\": null,\n\"Dokumenttyp\": \"Arztbrief\"\n}", "format": "json" } }, "type": "@n8n/n8n-nodes-langchain.ollama", "typeVersion": 1, "position": [ 1744, -448 ], "id": "8e7a99f1-ca7f-4b2d-8b30-22749e613aa2", "name": "Message a model", "executeOnce": true, "credentials": { "ollamaApi": { "id": "4Timi9hA5ACxVRmT", "name": "Ollama account" } } }, { "parameters": { "url": "=http://192.168.178.101:8000/api/documents/", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "tags__name__icontains", "value": "inbox" }, { "name": "tags__id__in", "value": "2" }, { "name": "tags__id__none", "value": "17" } ] }, "options": { "response": { "response": {} } } }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.3, "position": [ -48, -160 ], "id": "141bc592-9bcf-4b75-8490-6ed9b312b2cf", "name": "HTTP Request", "credentials": { "httpHeaderAuth": { "id": "zyL5PgYOGlAptjwA", "name": "paperless_api_token" } } }, { "parameters": { "assignments": { "assignments": [ { "id": "b5c0e99e-727e-4fe3-be0c-13fb5143cf8a", "name": "=data", "value": "={{ {...$input.first().json, \"document-id\" : $input.last().json.document[0].id} }}", "type": "object" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 2544, -304 ], "id": "d1346069-1484-453f-b2a1-85dc69c8cb62", "name": "Edit Fields", "executeOnce": false }, { "parameters": { "fieldToSplitOut": "results", "options": {} }, "type": "n8n-nodes-base.splitOut", "typeVersion": 1, "position": [ 176, -160 ], "id": "74697e07-3ac6-4f65-b3d8-637472a5a0f4", "name": "Split Out" }, { "parameters": { "options": { "reset": false } }, "type": "n8n-nodes-base.splitInBatches", "typeVersion": 3, "position": [ 400, -160 ], "id": "2c3873ee-ce74-4c04-bb32-88b7c2f51c28", "name": "Loop Over Items", "executeOnce": false }, { "parameters": { "mode": "raw", "jsonOutput": "={\n \"document\": [{{$json.toJsonString()}}]\n}\n", "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 624, -304 ], "id": "9b804e40-985c-4573-8828-6f38baa284d9", "name": "documentObject" }, { "parameters": { "operation": "get", "dataTableId": { "__rl": true, "value": "WmMZJjFqs1LTGlxy", "mode": "list", "cachedResultName": "paperless_correspondent", "cachedResultUrl": "/projects/S4tmpzSj6JlGFOze/datatables/WmMZJjFqs1LTGlxy" }, "returnAll": true }, "type": "n8n-nodes-base.dataTable", "typeVersion": 1, "position": [ 1072, -424 ], "id": "22ee408c-f667-4610-85c1-84a0c4da444c", "name": "getCorrespondent", "executeOnce": true }, { "parameters": { "assignments": { "assignments": [ { "id": "5ef46e88-d057-485e-9a75-8dcd244c737f", "name": "data", "value": "={{ $json.content.removeMarkdown().replaceAll('`','') }}", "type": "object" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 2096, -448 ], "id": "3caf3164-5298-47ea-9696-eec8fd64bb39", "name": "dataPreparationToJSON" }, { "parameters": { "mode": "combine", "combineBy": "combineAll", "options": {} }, "type": "n8n-nodes-base.merge", "typeVersion": 3.2, "position": [ 2320, -304 ], "id": "d81c00ae-3947-4625-bb23-f00a24a21ee7", "name": "Merge" }, { "parameters": { "method": "PATCH", "url": "=http://192.168.178.101:8000/api/documents/{{ $json.data['document-id'] }}/", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "bodyParameters": { "parameters": [ { "name": "title", "value": "={{ $json.data.data.Title }}" }, { "name": "tags", "value": "={{ \n $json.data.document[0].tags.concat(\n $json.data.data['Tags-ID']\n ).concat(\n [17]\n )\n.filter(item => item != null)\n.unique()\n}}" }, { "name": "correspondent", "value": "={{$json.data.data[\"Korrespondent-ID\"] || $json.data.document[0].correspondent}}" }, { "name": "document_type", "value": "={{ $json.data.data.Documenttypeid || $json.data.document[0].document_type }}" } ] }, "options": { "response": { "response": {} } } }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.3, "position": [ 2768, -184 ], "id": "74982eed-7fa2-4d69-9ae0-c2be5e28c5b0", "name": "Patch Document", "credentials": { "httpHeaderAuth": { "id": "zyL5PgYOGlAptjwA", "name": "paperless_api_token" } }, "notes": "Tag ID 16 = n8nAI\n" }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 }, "conditions": [ { "id": "f3c75165-57de-407d-a23c-23d794cb78c2", "leftValue": "={{ $json.document[0].content }}", "rightValue": "", "operator": { "type": "string", "operation": "notEmpty", "singleValue": true } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [ 848, -520 ], "id": "59084e9b-02d5-44cb-a94a-b7bf65d3fda5", "name": "If" }, { "parameters": { "assignments": { "assignments": [ { "id": "31ec728f-cb08-4bc6-af76-f96973cb39dc", "name": "component_url", "value": "http://192.168.178.101:8000/api/correspondents/", "type": "string" }, { "id": "e339d699-2f4b-4cd2-9e77-0c46cff58c29", "name": "component_name", "value": "correspondents", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -48, -352 ], "id": "4eafcff5-f2bb-4477-a2c5-ad90d7780bdd", "name": "correspondents" }, { "parameters": { "workflowId": { "__rl": true, "value": "yvSB21lQNL04DH2l", "mode": "list", "cachedResultUrl": "/workflow/yvSB21lQNL04DH2l", "cachedResultName": "paperless_get_component" }, "workflowInputs": { "mappingMode": "defineBelow", "value": { "component_name": "={{ $json.component_name }}", "component_url": "={{ $json.component_url }}" }, "matchingColumns": [ "component" ], "schema": [ { "id": "component_name", "displayName": "component_name", "required": false, "defaultMatch": false, "display": true, "canBeUsedToMatch": true, "type": "string", "removed": false }, { "id": "component_url", "displayName": "component_url", "required": false, "defaultMatch": false, "display": true, "canBeUsedToMatch": true, "type": "string", "removed": false } ], "attemptToConvertTypes": false, "convertFieldsToString": true }, "options": {} }, "type": "n8n-nodes-base.executeWorkflow", "typeVersion": 1.3, "position": [ 176, -352 ], "id": "3347554a-7ffc-4693-83b8-92c424ad912f", "name": "Call 'paperless_get_component'" }, { "parameters": { "workflowId": { "__rl": true, "value": "yvSB21lQNL04DH2l", "mode": "list", "cachedResultUrl": "/workflow/yvSB21lQNL04DH2l", "cachedResultName": "paperless_get_component" }, "workflowInputs": { "mappingMode": "defineBelow", "value": { "component_name": "={{ $json.component_name }}", "component_url": "={{ $json.component_url }}" }, "matchingColumns": [ "component" ], "schema": [ { "id": "component_name", "displayName": "component_name", "required": false, "defaultMatch": false, "display": true, "canBeUsedToMatch": true, "type": "string", "removed": false }, { "id": "component_url", "displayName": "component_url", "required": false, "defaultMatch": false, "display": true, "canBeUsedToMatch": true, "type": "string", "removed": false } ], "attemptToConvertTypes": false, "convertFieldsToString": true }, "options": {} }, "type": "n8n-nodes-base.executeWorkflow", "typeVersion": 1.3, "position": [ 176, -544 ], "id": "99e1ae45-1fe9-4e93-a365-22f290dc519c", "name": "Call 'paperless_get_component'1" }, { "parameters": { "assignments": { "assignments": [ { "id": "31ec728f-cb08-4bc6-af76-f96973cb39dc", "name": "component_url", "value": "http://192.168.178.101:8000/api/tags/", "type": "string" }, { "id": "e339d699-2f4b-4cd2-9e77-0c46cff58c29", "name": "component_name", "value": "tags", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -48, -544 ], "id": "e8afb477-be27-49cd-99eb-1cf23980590e", "name": "tags" }, { "parameters": { "operation": "get", "dataTableId": { "__rl": true, "value": "O8FtQxHCgJRAtOy1", "mode": "list", "cachedResultName": "paperless_tag", "cachedResultUrl": "/projects/S4tmpzSj6JlGFOze/datatables/O8FtQxHCgJRAtOy1" }, "returnAll": true }, "type": "n8n-nodes-base.dataTable", "typeVersion": 1, "position": [ 1072, -616 ], "id": "5d01ddb8-d779-4a39-af99-2b00531f8c04", "name": "getTags", "executeOnce": true }, { "parameters": { "mode": "combine", "combineBy": "combineAll", "options": {} }, "type": "n8n-nodes-base.merge", "typeVersion": 3.2, "position": [ 1296, -448 ], "id": "a8181ba2-a45e-4ce3-9739-ae40f05575da", "name": "Merge1", "executeOnce": true }, { "parameters": { "workflowId": { "__rl": true, "value": "yvSB21lQNL04DH2l", "mode": "list", "cachedResultUrl": "/workflow/yvSB21lQNL04DH2l", "cachedResultName": "paperless_get_component" }, "workflowInputs": { "mappingMode": "defineBelow", "value": { "component_name": "={{ $json.component_name }}", "component_url": "={{ $json.component_url }}" }, "matchingColumns": [ "component" ], "schema": [ { "id": "component_name", "displayName": "component_name", "required": false, "defaultMatch": false, "display": true, "canBeUsedToMatch": true, "type": "string", "removed": false }, { "id": "component_url", "displayName": "component_url", "required": false, "defaultMatch": false, "display": true, "canBeUsedToMatch": true, "type": "string", "removed": false } ], "attemptToConvertTypes": false, "convertFieldsToString": true }, "options": {} }, "type": "n8n-nodes-base.executeWorkflow", "typeVersion": 1.3, "position": [ 176, -736 ], "id": "63bc5899-015b-462f-867c-2f14740e0d84", "name": "Call 'paperless_get_component'2" }, { "parameters": { "assignments": { "assignments": [ { "id": "31ec728f-cb08-4bc6-af76-f96973cb39dc", "name": "component_url", "value": "http://192.168.178.101:8000/api/document_types/", "type": "string" }, { "id": "e339d699-2f4b-4cd2-9e77-0c46cff58c29", "name": "component_name", "value": "document_types", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -48, -736 ], "id": "6aabd6a7-b3c5-4ecf-8337-6c967a912380", "name": "documentType" }, { "parameters": { "mode": "combine", "combineBy": "combineAll", "options": {} }, "type": "n8n-nodes-base.merge", "typeVersion": 3.2, "position": [ 1520, -448 ], "id": "0fb2d16b-ab78-4964-9be5-39de54742b06", "name": "Merge2", "executeOnce": true }, { "parameters": { "operation": "get", "dataTableId": { "__rl": true, "value": "9CYGbOQ8zjL0gRTE", "mode": "list", "cachedResultName": "paperless_document_types", "cachedResultUrl": "/projects/S4tmpzSj6JlGFOze/datatables/9CYGbOQ8zjL0gRTE" }, "returnAll": true }, "type": "n8n-nodes-base.dataTable", "typeVersion": 1, "position": [ 1296, -784 ], "id": "369e5dcb-962c-435e-b2e0-131923ac60b4", "name": "getDocuments", "executeOnce": true } ], "connections": { "When clicking ‘Execute workflow’": { "main": [ [ { "node": "HTTP Request", "type": "main", "index": 0 }, { "node": "correspondents", "type": "main", "index": 0 }, { "node": "tags", "type": "main", "index": 0 }, { "node": "documentType", "type": "main", "index": 0 } ] ] }, "HTTP Request": { "main": [ [ { "node": "Split Out", "type": "main", "index": 0 } ] ] }, "Message a model": { "main": [ [ { "node": "dataPreparationToJSON", "type": "main", "index": 0 } ] ] }, "Split Out": { "main": [ [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "Loop Over Items": { "main": [ [], [ { "node": "documentObject", "type": "main", "index": 0 } ] ] }, "Edit Fields": { "main": [ [ { "node": "Patch Document", "type": "main", "index": 0 } ] ] }, "documentObject": { "main": [ [ { "node": "Merge", "type": "main", "index": 1 }, { "node": "If", "type": "main", "index": 0 } ] ] }, "getCorrespondent": { "main": [ [ { "node": "Merge1", "type": "main", "index": 1 } ] ] }, "dataPreparationToJSON": { "main": [ [ { "node": "Merge", "type": "main", "index": 0 } ] ] }, "Merge": { "main": [ [ { "node": "Edit Fields", "type": "main", "index": 0 } ] ] }, "Patch Document": { "main": [ [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "If": { "main": [ [ { "node": "getCorrespondent", "type": "main", "index": 0 }, { "node": "getTags", "type": "main", "index": 0 }, { "node": "getDocuments", "type": "main", "index": 0 } ], [ { "node": "Loop Over Items", "type": "main", "index": 0 } ] ] }, "correspondents": { "main": [ [ { "node": "Call 'paperless_get_component'", "type": "main", "index": 0 } ] ] }, "tags": { "main": [ [ { "node": "Call 'paperless_get_component'1", "type": "main", "index": 0 } ] ] }, "getTags": { "main": [ [ { "node": "Merge1", "type": "main", "index": 0 } ] ] }, "Merge1": { "main": [ [ { "node": "Merge2", "type": "main", "index": 1 } ] ] }, "documentType": { "main": [ [ { "node": "Call 'paperless_get_component'2", "type": "main", "index": 0 } ] ] }, "Merge2": { "main": [ [ { "node": "Message a model", "type": "main", "index": 0 } ] ] }, "getDocuments": { "main": [ [ { "node": "Merge2", "type": "main", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "meta": { "templateCredsSetupCompleted": true }, "pinData": {}, "versionId": "454abe40-5590-46bb-8fe7-7255a934e947", "triggerCount": 0, "shared": [ { "updatedAt": "2025-12-21T08:27:02.747Z", "createdAt": "2025-12-21T08:27:02.747Z", "role": "workflow:owner", "workflowId": "N4n2HmA6azz8n7Uw", "projectId": "S4tmpzSj6JlGFOze" } ], "tags": [ { "updatedAt": "2026-01-04T09:23:14.869Z", "createdAt": "2026-01-04T09:23:14.869Z", "id": "7ZDCcNolVMDFEdmE", "name": "ollama_paperless" } ] }