Skip to main content
Note: A native n8n integration is coming soon! In the meantime, you can connect Cradl AI to n8n using webhooks.

Downloading Files from a Cradl Webhook in n8n

When setting up a webhook export in Cradl, the webhook event does not include the PDF/image file itself. Instead, you’ll need a few extra steps in n8n to fetch the actual document. We want to end up with a workflow like this: Overview

1. Configure the Webhook Node

Add a Webhook node and set it to listen for POST requests.
Copy the provided Test URL and paste it into the Webhook export URL field in Cradl.

2. Authenticate with Cradl

Next, you need an authentication token. Add an HTTP Request node with the following settings:
SettingValue
MethodPOST
URLhttps://auth.cradl.ai/oauth2/token
Send Body✅ (checked)
Body Content TypeForm Urlencoded
Body ParametersSee table below
Body Parameters
NameValue
client_idyour client id here
client_secretyour client secret here
grant_typeclient_credentials
audiencehttps://api.cradl.ai/v1
You can find the client_id and client_secret in your Cradl workspace at https://rc.app.cradl.ai/settings/workspace Leave everything else as default.
(See illustration below)
Step 2

3. Retrieve the File URL

Now, fetch the document metadata to get the file URL. Use the documentId acquired from the Webhook node and the access_token from the previous node. Add another HTTP Request node:
SettingValue
MethodGET
URLhttps://api.lucidtech.ai/v1/documents/{{ $('Webhook').item.json.body.context.documentId }}
Send Headers✅ (checked)
Header ParametersSee table below
Header Parameters
NameValue (Expression)
AuthorizationBearer {{ $('HTTP Request').item.json.access_token }}
Leave everything else as default.
(See illustration below)
Step 3

4. Download the File

With the fileUrl acquired from the previous node and the same access_token used in the previous node, add one more HTTP Request node to download it:
SettingValue
MethodGET
URL{{ $json.fileUrl }}
Send Headers✅ (checked)
Header ParametersSee table below
Header Parameters
NameValue (Expression)
AuthorizationBearer {{ $('HTTP Request').item.json.access_token }}
Leave everything else as default.
(See illustration below)
Step 4

5. Done!

The file is now available in your workflow.