{
  "name": "Document -> LlamaExtract",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -800,
        496
      ],
      "id": "fa597ecf-efa3-4ab8-862e-263503653fce",
      "name": "When clicking ‘Test workflow’"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.cloud.llamaindex.ai/api/v1/files",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "parameterType": "formBinaryData",
              "name": "upload_file",
              "inputDataFieldName": "data"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        80,
        496
      ],
      "id": "c1891a8c-293d-4ec6-9d5f-d80eb46ee2a7",
      "name": "Upload Document to LlamaExtract",
      "credentials": {
        "httpBearerAuth": {
          "id": "t0Uqyp0Q0H75sJpn",
          "name": "Llamaindex Bearer Auth"
        }
      }
    },
    {
      "parameters": {
        "url": "https://api.cloud.llamaindex.ai/api/v1/extraction/extraction-agents/by-name/granite-agent",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -576,
        496
      ],
      "id": "40d8a7da-d081-4d54-972a-679f513912a4",
      "name": "Get Extraction Agent",
      "credentials": {
        "httpBearerAuth": {
          "id": "t0Uqyp0Q0H75sJpn",
          "name": "Llamaindex Bearer Auth"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.cloud.llamaindex.ai/api/v1/extraction/jobs",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"webhook_configurations\": [\n    {\n      \"webhook_url\": \"your-webhook-url\",\n      \"webhook_headers\": {},\n      \"webhook_events\": [\n        \"extract.pending\", \"extract.success\", \"extract.error\", \"extract.partial_success\"\n      ]\n    }\n  ],\n  \"extraction_agent_id\": \"{{ $('Get Extraction Agent').item.json.id }}\",\n  \"file_id\": \"{{ $('Upload Document to LlamaExtract').item.json.id }}\",\n  \"data_schema_override\": {},\n  \"config_override\": {\n    \"priority\": \"low\",\n    \"extraction_target\": \"PER_DOC\",\n    \"extraction_mode\": \"BALANCED\",\n    \"multimodal_fast_mode\": false,\n    \"use_reasoning\": false,\n    \"cite_sources\": false,\n    \"chunk_mode\": \"PAGE\",\n    \"invalidate_cache\": false\n  }\n}",
        "options": {
          "redirect": {
            "redirect": {}
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        304,
        496
      ],
      "id": "406aa819-d7a2-44bc-9931-5d9a3b2a2fa1",
      "name": "Run Extraction Job",
      "credentials": {
        "httpBearerAuth": {
          "id": "t0Uqyp0Q0H75sJpn",
          "name": "Llamaindex Bearer Auth"
        }
      }
    },
    {
      "parameters": {
        "url": "={{ $json.property_pitch_deck[0] }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -144,
        496
      ],
      "id": "7e472bea-665c-4238-98ff-d8f83db75056",
      "name": "Download Notion Pitch Deck"
    },
    {
      "parameters": {
        "resource": "databasePage",
        "operation": "get",
        "pageId": {
          "__rl": true,
          "value": "",
          "mode": "url"
        }
      },
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2.2,
      "position": [
        -368,
        496
      ],
      "id": "5771eb88-a576-4a99-9b51-93e4b5c068b5",
      "name": "Get Pitch Deck",
      "credentials": {
        "notionApi": {
          "id": "i9koSu1TWLJJkhIS",
          "name": "Stephen Notion account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "8c2b9d3c-7446-43fe-baa7-910d7a782b69",
              "leftValue": "={{ $json.status }}",
              "rightValue": "IN PROGRESS",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            },
            {
              "id": "adbafacb-d6f0-491a-a024-0b95e52dcdc0",
              "leftValue": "={{ $json.status }}",
              "rightValue": "PENDING",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "or"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        800,
        432
      ],
      "id": "f5355106-b169-4314-ba99-37801ca8fd9e",
      "name": "If Pending"
    },
    {
      "parameters": {
        "url": "=https://api.cloud.llamaindex.ai/api/v1/extraction/jobs/{{ $('Run Extraction Job').item.json.id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        576,
        496
      ],
      "id": "71ccf4a0-a2ed-4842-a5c0-007d3ccd63fc",
      "name": "Poll For Results of Extraction",
      "retryOnFail": false,
      "credentials": {
        "httpBearerAuth": {
          "id": "t0Uqyp0Q0H75sJpn",
          "name": "Llamaindex Bearer Auth"
        }
      }
    },
    {
      "parameters": {
        "url": "=https://api.cloud.llamaindex.ai/api/v1/extraction/jobs/{{ $('Run Extraction Job').item.json.id }}/result",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1008,
        368
      ],
      "id": "9fa1dd41-b53b-406d-91f9-057aab7221ea",
      "name": "Get Results of Extraction",
      "retryOnFail": false,
      "credentials": {
        "httpBearerAuth": {
          "id": "t0Uqyp0Q0H75sJpn",
          "name": "Llamaindex Bearer Auth"
        }
      }
    },
    {
      "parameters": {
        "amount": 30
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1008,
        608
      ],
      "id": "38980980-d5dd-4249-9061-93b114f2f6b1",
      "name": "Wait 30 Seconds",
      "webhookId": "bfc3ab44-b40d-490f-a9d1-bfcbdeb8fe5d"
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "llama-index-results",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -800,
        720
      ],
      "id": "7fb46560-e0a7-48cd-bc39-0b7e983e51f9",
      "name": "Webhook",
      "webhookId": "9daf8a36-2491-4d41-9848-3b27ef6cfc8e"
    },
    {
      "parameters": {
        "content": "## Polling Example\nGet job by ID and check if it is pending or in progress. \nConnect this to the main workflow if you want to use polling. ",
        "height": 640,
        "width": 864
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        432,
        224
      ],
      "id": "a09f99f3-891c-4ad2-90de-8f147eba75e8",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "url": "=https://api.cloud.llamaindex.ai/api/v1/extraction/jobs/{{ $('Set Return Data').item.json.body.data.job_id }}/result",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -160,
        720
      ],
      "id": "111218eb-f5ba-4824-bd32-a40692110b95",
      "name": "Get Results of Extraction1",
      "retryOnFail": false,
      "credentials": {
        "httpBearerAuth": {
          "id": "t0Uqyp0Q0H75sJpn",
          "name": "Llamaindex Bearer Auth"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "ea95aeb3-2502-4311-aae7-fcc30abd3b9f",
              "name": "body",
              "value": "={{ $json.body }}",
              "type": "object"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -368,
        720
      ],
      "id": "707e2189-3f87-4c52-b0d2-18bcf6af3b4f",
      "name": "Set Return Data"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "3edf7e04-28af-4243-a388-98f7fa326cae",
              "leftValue": "={{ $json.headers[\"x-webhook-event-type\"] }}",
              "rightValue": "extract.success",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.3,
      "position": [
        -592,
        720
      ],
      "id": "a91691af-f121-4cf6-ba55-48591b46d063",
      "name": "Filter"
    }
  ],
  "pinData": {},
  "connections": {
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Get Extraction Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Extraction Agent": {
      "main": [
        [
          {
            "node": "Get Pitch Deck",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Document to LlamaExtract": {
      "main": [
        [
          {
            "node": "Run Extraction Job",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Extraction Job": {
      "main": [
        []
      ]
    },
    "Download Notion Pitch Deck": {
      "main": [
        [
          {
            "node": "Upload Document to LlamaExtract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Pitch Deck": {
      "main": [
        [
          {
            "node": "Download Notion Pitch Deck",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Pending": {
      "main": [
        [
          {
            "node": "Wait 30 Seconds",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Results of Extraction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Poll For Results of Extraction": {
      "main": [
        [
          {
            "node": "If Pending",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 30 Seconds": {
      "main": [
        [
          {
            "node": "Poll For Results of Extraction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Return Data": {
      "main": [
        [
          {
            "node": "Get Results of Extraction1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Set Return Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false
  },
  "versionId": "6b171b47-17e8-4a63-9db7-c4d158e97ec6",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "91ff29cf289b94d2caa8a7a4821e53d150affc29af69fb5d8a62fce13e322667"
  },
  "id": "r8ZTwQrbnibIGDO8",
  "tags": [
    {
      "updatedAt": "2026-02-10T16:54:20.430Z",
      "createdAt": "2026-02-10T16:54:20.430Z",
      "id": "WiPfwUZYcO7Er2qC",
      "name": "Template"
    }
  ]
}