RAG (human feedback) lets you teach Eagle Doc from corrected extractions so that future extractions improve. As a business, every learned example is attributed to one of your clients via the same client header — x-sub-business-ref or x-sub-business-id — you already send on extraction calls.
🧠
Same header, per-client learning
Add the client header to a learning request and the corrected example is filed under that client. Omit it and the example becomes business-wide. Nothing else about the Human Feedback API changes when you use a business key.
How per-client scoping works
Attribution decides which learned examples influence a given client’s extractions. The rules are deterministic:
🎯
Scoping rules
A client’s own examples rank first for that client’s extractions.
Business-wide examples — submitted with no client header — apply to every client.
Examples belonging to other clients are excluded — one client’s corrections never leak into another’s results.
Attribution starts at submission time and is not retroactive — earlier examples keep the client they were submitted under.
Submit a corrected example
Send the corrected extraction to the learning endpoint as multipart form-data — the source document (file), the original extraction JSON and your corrected JSON. Add the client header to attribute the example to that client.
Parameters
Name
Description
api-key (header)
Your business API key, prefixed APIB-. Usage is billed to the business subscription.
x-sub-business-ref (header, optional)
Your own client number. Attributes this example to that client (zero-touch: the client is created on first use). Omit to make the example business-wide.
x-sub-business-id (header, optional)
Alternative to x-sub-business-ref: the Eagle Doc client id. Use one or the other, not both.
file (form-data)
The source document (PNG, JPEG or PDF). For multi-page documents, attach a PDF or all page images.
original (form-data)
The original extraction JSON, exactly as Eagle Doc returned it. Compared against corrected so the wrong fields are found automatically.
corrected (form-data)
The same JSON with only the wrong field values fixed. Keep everything else intact.
Responses
Code
Description
200
OK — the corrected example was learned and attributed to the resolved client.
{
"message": "The learning has been updated successfully."
}
403
BadCredentialException — the API key is missing or invalid. The error body follows the standard shape:
import requests
resp = requests.post(
"https://de.eagle-doc.com/api/docu/learning",
headers={
"api-key": "APIB-your-business-key",
"x-sub-business-ref": "A-1023", # attribute this example to a client
},
files={
"file": open("invoice.pdf", "rb"),
"original": open("original.json", "rb"),
"corrected": open("corrected.json", "rb"),
},
)
print(resp.json())
import fs from "node:fs";
const form = new FormData();
form.append("file", new Blob([fs.readFileSync("invoice.pdf")]), "invoice.pdf");
form.append("original", new Blob([fs.readFileSync("original.json")]), "original.json");
form.append("corrected", new Blob([fs.readFileSync("corrected.json")]), "corrected.json");
const resp = await fetch("https://de.eagle-doc.com/api/docu/learning", {
method: "POST",
headers: {
"api-key": "APIB-your-business-key",
"x-sub-business-ref": "A-1023", // attribute this example to a client
},
body: form,
});
console.log(await resp.json());
Field-level correction rules (context, notes, fixes arrays, product lists) are identical to the personal-key flow. For the complete field reference and worked examples, see the full Human Feedback reference.
Learning from instructions
Instead of a full corrected document, you can teach a single field with a plain-language rule via the learning-instructions endpoint. It accepts the same client header, so the instruction is learned for that client only.
Parameters
Name
Description
api-key (header)
Your business API key, prefixed APIB-.
x-sub-business-ref (header, optional)
Your own client number. Learns the instruction for that client only. Omit to make it business-wide.
instructions (query parameter)
The extraction rule, e.g. "from text 'paid by Feb 02, 2025', get InvoiceDueDate: '2025-02-02'". Concatenate multiple rules with semicolons (;).
corrected (form-data)
The corrected extraction JSON the instruction applies to.
overwrite (query parameter)
Boolean — whether to overwrite prior learnings for this document.
Responses
Code
Description
200
OK — the instruction was learned for the resolved client.
{
"message": "The learning has been updated successfully."
}
403
BadCredentialException — the API key is missing or invalid.
500
InternalServerErrorException — something went wrong. Reason is not known.
import requests
resp = requests.post(
"https://de.eagle-doc.com/api/docu/learning/instructions",
params={
"instructions": "from text 'paid by Feb 02, 2025', get InvoiceDueDate: '2025-02-02'",
"overwrite": "false",
},
headers={
"api-key": "APIB-your-business-key",
"x-sub-business-ref": "A-1023", # learn for this client only
},
files={"corrected": open("corrected.json", "rb")},
)
print(resp.json())
import fs from "node:fs";
const url = new URL("https://de.eagle-doc.com/api/docu/learning/instructions");
url.searchParams.set("instructions", "from text 'paid by Feb 02, 2025', get InvoiceDueDate: '2025-02-02'");
url.searchParams.set("overwrite", "false");
const form = new FormData();
form.append("corrected", new Blob([fs.readFileSync("corrected.json")]), "corrected.json");
const resp = await fetch(url, {
method: "POST",
headers: {
"api-key": "APIB-your-business-key",
"x-sub-business-ref": "A-1023", // learn for this client only
},
body: form,
});
console.log(await resp.json());
📈
Corrections compound — per client
Keep each client’s corrections flowing and that client’s extractions keep getting better — independently of your other clients. One client’s feedback never affects another’s results.