Extract amounts
An invoice buries the number that matters between a subtotal, a tax line and a shipping fee, often in a currency your system has to infer from context rather than a clean field. This financial amount extraction endpoint reads the surrounding prose and returns each monetary figure it finds — labeled by what it represents and tagged with its currency — instead of leaving you to regex-match dollar signs and hope nothing slips through.
Run it online
Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.
The mess this untangles
Financial figures rarely arrive as clean structured data outside of accounting software. Expense reports, vendor emails, scanned-then-OCR'd receipts and free-text contract clauses all mix totals, subtotals, discounts and taxes in whatever order the author happened to write them, sometimes in more than one currency in the same paragraph when a contract references both a local fee and a foreign-denominated penalty. This endpoint exists for the moment a human would normally have to sit down and manually copy numbers into a spreadsheet.
What each extracted amount looks like
POST /text/extract-amounts returns each monetary mention with its numeric value, its currency, and a label describing what kind of amount it is where the text makes that clear — a total, a tax, a discount, a late fee, a deposit. That labeling is what separates this from a plain number-matcher: 'total: 1,200 USD' and 'late fee: 45 USD' are very different facts, and conflating them is exactly how automated reconciliation breaks.
Currency ambiguity is the quiet failure mode
The dollar sign alone is claimed by more than twenty currencies worldwide, and a bare number next to a period versus a comma as the decimal separator flips the value entirely depending on regional convention — 1.234,56 and 1,234.56 are not the same number written two ways, they can represent genuinely different magnitudes if parsed under the wrong assumption. Reading amounts in the context of the surrounding sentence, rather than in isolation, is how this endpoint avoids that class of silent error.
Where accuracy matters most
This is aimed squarely at finance and operations use, not casual text mining: accounts-payable teams reconciling vendor invoices, procurement teams auditing contract line items, and support teams verifying refund amounts mentioned in customer correspondence all need the extracted figure to be exactly right, because a misread amount in this domain isn't a cosmetic error, it's a financial one.
How it plugs into a finance workflow
The call is asynchronous: submit a document, get a task_id back immediately, and receive the structured amounts by signed webhook the moment extraction finishes, or via a signed link held for 24 hours. Cost scales with document length — a short receipt costs a fraction of a multi-page contract — and a task that fails after its retries is never billed, so a batch run never quietly overcharges for errors.
What you can do with it
Invoice reconciliation at scale
Pull the total, tax and any discount line from a batch of vendor invoices in mixed formats to cross-check against purchase orders automatically.
Contract financial audit
Extract every monetary clause from a lease or service agreement — deposit, penalty, monthly fee — to verify they match the negotiated terms before signing.
Expense report parsing
Read free-text expense submissions and pull out the claimed amount and currency without requiring employees to fill a rigid form field by field.
Refund verification in support tickets
Scan a customer's message referencing a disputed charge to confirm the exact amount and currency before a support agent processes a refund.
FAQ
How do I extract amounts from text using the API?
Send text to POST /text/extract-amounts, get a task_id immediately, and receive the list of extracted amounts, currencies and labels by webhook or a signed link once processing completes.
Does it detect the currency automatically?
Yes — it reads the surrounding context to determine currency even when the symbol alone would be ambiguous, such as a dollar sign that could refer to several different currencies.
Can it tell a total apart from a tax or a discount?
When the source text makes the distinction clear, each amount comes back labeled by what it represents, so a total and a late fee in the same document are returned as separate, identified figures.
Is there a free tier?
There's no free tier — free tiers get abused and slow everyone down. Access runs on a prepaid ForHosting KIT balance: top up from $10.00 (it never expires) and each request is charged at its published price, so a call with no balance returns HTTP 402. No subscription, no tokens, no invented credits, and a failed task is never charged.
What does the amount extraction API cost?
It's $0.003 per request plus $0.0135 per 1,000 words of input, and you're billed only for tasks that complete — a failed task after retries is never charged.
Does it handle both comma and period decimal separators?
Yes, it reads numeric formatting in context rather than assuming one convention, which matters because 1.234,56 and 1,234.56 represent different values depending on regional formatting.
Can I process a large batch of invoices at once?
Yes, each document is an independent asynchronous task, so you submit as many as needed in parallel and collect each result as its webhook fires.
How accurate is amount extraction on scanned or OCR'd text?
The endpoint works on whatever text it's given, so accuracy on OCR output depends on the quality of that OCR pass; cleaner source text produces more reliable extraction.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/text/extract-amounts \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"…"}'const res = await fetch("https://api.kit.forhosting.com/text/extract-amounts", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "…"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/text/extract-amounts",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "…"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/text/extract-amounts", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"…"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"…"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/text/extract-amounts", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "…"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "text.extract_amounts",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_tokens | 20000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
422 | task_failed | The task failed after 3 retries. You are never charged for it. |