doc. extract_ text
Extract text and tables from PDFs, scans, Office files, or emails.
25 credits. Per document. 0 when nothing is read.
Example prompt
Send this to your AI app when Heelo is connected:
Extract the text from this PDF
Input fields
| Field | Type | Description |
|---|---|---|
sourceRequired | object | The document: {data} as base64, or {asset_id} returned by doc.render_* for the same caller and end_user_id. |
end_user_id | string | Which of your end users an asset_id belongs to; must match the one it was rendered for. |
mode | "auto" | "fast" | "accurate" | auto routes by document class; fast stops at the cheapest tier; accurate may climb. |
page_numbers | array of integer | Only return these 1-based pages. Extraction still runs over the document. |
max_pages | integer | Cap on pages returned (max 500). |
Output fields
The fields in data when status is success.
| Field | Type |
|---|---|
pages | array of object |
doc_kind | string |
engine_used | string |
page_count | integer |
classification | object |
cost_hint | object |
untrusted | boolean |
Code
The call with the input fields that the tool needs. Replace each word in capitals, such as ASSET_ID. Set HEELO_API_KEY to your API key.
import os
import requests
response = requests.post(
"https://toolsprimitives.uk/v1/tools/doc.extract_text/invoke",
headers={"Authorization": f"Bearer {os.environ['HEELO_API_KEY']}"},
json={"input": {
"source": {"asset_id": "ASSET_ID"},
}},
timeout=120,
)
response.raise_for_status()
print(response.json())// Node.js 18 or newer, in an ES module.
const response = await fetch("https://toolsprimitives.uk/v1/tools/doc.extract_text/invoke", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HEELO_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
input: {
"source": {
"asset_id": "ASSET_ID"
}
},
}),
signal: AbortSignal.timeout(120_000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());