Lumen Bakery
14 Harbour Row
28.09.202612:41- 2 x Flat white7.80
- 1 x Club sandwich12.40
- 2 x Lunch special28.00
Card **** 4417
thank you
state
claim EUR 48.20, 2026-09-28
matches Truthtotal, currency, date
0.00true
approves at 0.900.00 false0.501.00 trueyour code approves the claim
currency Choiceconfidence 0.94
input 1,184 tokensoutput 0, free
One photo of a receipt and the expense claim it should back up, in one request. matches is a Truth question that compares three fields at once; currency is a Choice read straight off the print. Both are answered from a single read of the image.
Sending an image#
Add an images array next to the state. Each image has an id you choose, a media_type and the bytes as base64 in data, without a data: prefix. Refer to images by id in your instructions when there is more than one.
curl https://api.decisionnode.com/v1/decide \
-H "Authorization: Bearer $DECISIONNODE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "decisionnode-latest",
"state": {
"claim": { "amount": 48.2, "currency": "EUR", "date": "2026-09-28" }
},
"images": [
{ "id": "receipt", "media_type": "image/jpeg", "data": "<base64>" }
],
"questions": {
"matches": {
"type": "truth",
"instructions": "Does the receipt show the same total, currency and date as the claim?",
"criteria": {
"true": "Total, currency and date on the receipt all match the claim",
"false": "Any of them differs, or the receipt does not show it"
}
},
"currency": {
"type": "choice",
"instructions": "Which currency is the receipt in?",
"criteria": {
"EUR": "euro",
"GBP": "pound sterling",
"USD": "US dollar"
}
}
}
}'Image object
idstringrequired- Your name for the image, for example
receiptorphoto_1. media_typestringrequiredimage/jpeg,image/pngorimage/webp.datastringrequired- The image bytes, base64 encoded, with no
data:prefix.
Encoding a file#
Read the file's bytes, base64 encode them and put the text in data, with the media_type that matches the file. Each image may be up to 10 MB before encoding; the other limits are on Limits.
import base64, pathlib
raw = pathlib.Path("receipt.jpg").read_bytes()
data = base64.b64encode(raw).decode()
image = {"id": "receipt", "media_type": "image/jpeg", "data": data}What the model reads#
- Printed and handwritten text, including totals, dates and reference numbers.
- Objects and their condition, as in a listing photo.
- Layout: which number is the total, which line is the date, whether a stamp or signature is present.
- Several images against each other, such as a photo and the document it should match.
- How many: cars in a drone frame, items on a shelf, with a Number question.