Turn documents into ERPNext records


The Cradl AI builder with the Export to Webhook panel open: endpoint URL, signing secret, HTTP headers and a test delivery.

Book supplier invoices, receipts and quality certificates in open-source ERP.

Overview

ERPNext can receive Cradl AI’s Webhook export directly. ERPNext gives you an incoming URL through API server script, Cradl AI posts each processed document to it, and you map the fields where you work. Nothing sits in between.

Popular use cases

  • Purchase invoices: insert draft Purchase Invoices in ERPNext from supplier PDFs, with supplier, bill number, bill date and item rows, ready to submit.
  • Purchase receipts: create Purchase Receipts from delivery notes against the open Purchase Order, so received quantities and warehouses are recorded.
  • Quality inspections: log Quality Inspection readings from supplier certificates of analysis against the item and batch they cover.

Before you begin

  • A Cradl AI agent with at least one processed document to test with.
  • ERPNext: Self-hosted, or a private bench on Frappe Cloud.

How to set it up

  1. In ERPNext, create a Server Script with Script Type API and an API Method name such as cradl_invoice, then write code that reads frappe.form_dict and inserts a draft Purchase Invoice. ERPNext docs
  2. In ERPNext, open the integration user, go to Settings > API Access and click Generate Keys. Copy the API key and secret. ERPNext docs
  3. In Cradl AI, open your agent, add a Webhook export and enter https://your-site/api/method/cradl_invoice under Endpoint with POST. Under HTTP headers, add Authorization with token api_key:api_secret, then click Test webhook. Cradl AI docs

What Cradl AI sends

Each processed document arrives as one JSON request with two parts. output holds every field under its field ID, with the value, the text as read, a confidence score and a readable name. context holds the run and document IDs. The request is signed with HMAC SHA-256 in the X-Cradl-Signature header.

This example is a certificate of analysis, as in the quality inspections use case. A table field, such as testResults, holds a list with one entry per row.

{  "output": {    "supplierName": {      "rawValue": "Gulf Coast Polymers",      "value": "Gulf Coast Polymers",      "confidence": 0.909,      "page": 0,      "name": "Supplier Name"    },    "itemCode": {      "rawValue": "RES-PE-200",      "value": "RES-PE-200",      "confidence": 0.9,      "page": 0,      "name": "Item Code"    },    "lotNumber": {      "rawValue": "L26-0611",      "value": "L26-0611",      "confidence": 0.952,      "page": 0,      "name": "Lot Number"    },    "testResults": [      {        "parameter": {          "rawValue": "Density",          "value": "Density",          "confidence": 0.929,          "page": 0,          "name": "Parameter"        },        "result": {          "rawValue": "0.952 g/cm³",          "value": "0.952 g/cm³",          "confidence": 0.909,          "page": 0,          "name": "Result"        },        "specification": {          "rawValue": "0.950–0.955 g/cm³",          "value": "0.950–0.955 g/cm³",          "confidence": 0.985,          "page": 0,          "name": "Specification"        }      },      {        "parameter": {          "rawValue": "Melt flow index",          "value": "Melt flow index",          "confidence": 0.929,          "page": 0,          "name": "Parameter"        },        "result": {          "rawValue": "0.32 g/10 min",          "value": "0.32 g/10 min",          "confidence": 0.909,          "page": 0,          "name": "Result"        },        "specification": {          "rawValue": "0.25–0.40 g/10 min",          "value": "0.25–0.40 g/10 min",          "confidence": 0.985,          "page": 0,          "name": "Specification"        }      }    ]  },  "context": {    "runId": "cradl:run:eee4d543…",    "documentId": "cradl:document:349e99a0…"  }}

Good to know

Server scripts are off by default since version 15. Turn them on with bench set-config server_script_enabled true. Shared Frappe Cloud benches don’t allow them.

Document automation for the agentic era.

Build your first agent in minutes, and let your business users review and train it from day one.