Skip to main content

Introduction

Use Cradl AI’s Webhook export to send extracted data to an n8n workflow. You can also fetch and download the original file inside n8n.
A native n8n integration is coming soon. Until then, connect via Webhook.

Before you begin

  • An n8n instance (Cloud or self‑hosted) with permission to create workflows
  • A Cradl AI agent with at least one test document
  • API client credentials (client_id, client_secret) from your workspace settings

Connect Cradl AI to n8n

Create an n8n Webhook and point your agent’s Webhook export to it.
1

Add a Webhook node in n8n

In n8n, add a Webhook node and set HTTP Method to POST. Copy the Test URL (you’ll paste it into Cradl AI).
n8n Webhook node overview
2

Add a Webhook export in Cradl AI

In your agent, add a new export and choose Webhook. Paste the n8n Test URL into URL and set HTTP Method to POST. Click Test webhook and verify that the n8n Webhook node receives a request (2xx).
When you go live, switch the n8n Webhook to use its Production URL and update the export URL in Cradl AI.

Payload format

The Webhook body includes extracted fields and context such as context.documentId. See the Webhook → Payload format for a full example.

Download the file in n8n (optional)

Webhook payloads don’t include the original file. The steps below show how to get an access token, fetch the document metadata to obtain fileUrl, and then download the file.
1

Get an access token

Add an HTTP Request node with Parameters and Body Parameters as shown below.
ParameterValue
MethodPOST
URLhttps://auth.cradl.ai/oauth2/token
Send Body✅ (checked)
Body Content TypeForm Urlencoded
Body ParametersSee table below
ParameterValue
client_idyour client id here
client_secretyour client secret here
grant_typeclient_credentials
audiencehttps://api.cradl.ai/v1
Create token request in n8n
Save access_token from the response.
2

Fetch document metadata (get fileUrl)

Add another HTTP Request node with the parameters below. The response includes fileUrl.
ParameterValue
MethodGET
URLhttps://api.lucidtech.ai/v1/documents/{{ $('Webhook').item.json.body.context.documentId }}
Send Headers✅ (checked)
HeaderValue (Expression)
AuthorizationBearer {{ $('HTTP Request').item.json.access_token }}
Fetch document metadata in n8n
3

Download the file

Add a final HTTP Request node with the parameters below. Configure the node to return binary if you want to store or pass the file downstream.
ParameterValue
MethodGET
URL{{ $json.fileUrl }}
Send Headers✅ (checked)
HeaderValue (Expression)
AuthorizationBearer {{ $('HTTP Request').item.json.access_token }}
Download the file in n8n

Best practices

  • Keep node names stable (e.g., Webhook, HTTP Request) if you use expressions that reference them
  • Return a fast 2xx from the Webhook node; perform longer work asynchronously downstream
  • Store secrets using n8n Credentials instead of hardcoding values
  • Use the Webhook’s Production URL for live traffic

Troubleshooting

  • No requests arriving in n8n: verify the export URL and click Test webhook in Cradl AI; ensure the Webhook node is active
  • 401 from token or API calls: check client_id/client_secret, grant_type=client_credentials, and audience=https://api.cradl.ai/v1
  • Expression resolves to undefined: confirm node names match your expressions and inspect the incoming JSON with the Expression Editor to validate the path (e.g., body.context.documentId)
  • Cannot download file: include the Authorization: Bearer <ACCESS_TOKEN> header when requesting fileUrl
I