Blinklet can read payment screenshots with a service you run yourself instead of the official one. This document is the contract between the app and such a service: the paths, the requests and responses, authentication, errors, limits, capabilities and versioning, and how to connect the app and check that it works. How you build the service (language, model, hosting) is up to you.
This document is in English only. Contract version: blinklet.v1; recognition response ledger_entry.v4.
| Path | Required | Purpose |
|---|---|---|
POST {base}/ai/receipt:parse-image |
yes | Read one screenshot and return its transactions |
GET {base}/ai/access |
recommended | The app’s Test Connection button |
GET {base}/capabilities |
optional | Say which optional paths you offer |
GET {base}/rates |
optional | Exchange rates for foreign-currency entries |
Nothing else. The official service has more endpoints (subscriptions, the free tier, App Store notifications, plans and an older ledger API); they are specific to it and not part of this contract.
https://ledger.example.com/v1; the app appends the paths above. An address entered as the full recognition URL (…/v1/ai/receipt:parse-image) is reduced to its base.http://192.168.1.10:8080/v1, http://nas.local:8080/v1) may use HTTP.Authorization: Bearer <access key>. The key is any string you choose (32+ random bytes recommended); the app keeps it in the Keychain. /capabilities and /rates are called without it.multipart/form-data (recognition) or query strings; responses are JSON, UTF-8.GET {base}/capabilities
{
"contract": "blinklet.v1",
"capabilities": {
"recognition": { "path": "ai/receipt:parse-image", "versions": ["ledger_entry.v4"], "auth": "bearer" },
"rates": { "path": "rates", "versions": ["rates.v1"], "auth": "none" }
}
}
path is relative to the base URL; versions lists the schema versions you speak. The app uses a path only in a version it knows, and ignores capabilities it doesn’t know.Each path declares what the app does without it:
| Capability | Without it |
|---|---|
recognition |
No fallback: the app shows that the service is unavailable or not set up |
rates |
Local fallback: the app asks public rate sources (Frankfurter, currency-api) directly |
GET {base}/ai/access
Authorization: Bearer <access key>
200 (any body, e.g. {}) means the address and key work. 401 means the key is missing or wrong.
POST {base}/ai/receipt:parse-image
Authorization: Bearer <access key>
Content-Type: multipart/form-data
| Field | Default when absent | Meaning |
|---|---|---|
image |
— (required) | The screenshot, JPEG or PNG |
default_currency_code |
CNY |
The ledger’s currency (ISO 4217). Use it when the image shows no currency |
timezone |
Asia/Shanghai |
The ledger’s time zone (IANA). Times without a zone in the image are in this zone |
locale |
none: Simplified Chinese | The app’s language (en, zh-Hans, ja…). note and description follow the language of the image’s text; locale is only for images without readable text |
categories |
the default list below | The user’s categories, JSON: [{"id": "food", "name": "Food", "kind": "expense"}, …]. name is what the user sees (in their language); kind is expense or income (optional). Each transaction’s category_id should be one of these ids, from its own kind |
merchants |
none | Up to 30 merchant names the ledger already uses, JSON array, most used first. When the image clearly shows one of them under another spelling or language (“STARBUCKS #12034” for 「星巴克」), return the listed name; otherwise the name as printed |
accounts |
none | Up to 10 account names the ledger already uses (often with the card’s last four digits), same rule for financial_account_name |
Every field except image may be missing (older app versions send fewer); fill in the defaults. Ignore fields you don’t know.
The default categories, used when categories is absent: expense food 餐饮, coffee 咖啡, transport 交通, taxi 打车, transit 公共交通, fresh 生鲜, shopping 购物, subscriptions 数字订阅, home 居家, travel 旅行, health 医疗, education 教育, entertainment 娱乐, telecom 通讯, fees 手续费, transfer 转账, other 其他; income salary 工资, refund 退款, transfer 转账, investment 投资, other 其他.
Example request:
curl -sS https://ledger.example.com/v1/ai/receipt:parse-image \
-H "Authorization: Bearer $KEY" \
-F image=@receipt.jpg \
-F default_currency_code=USD -F timezone=America/New_York -F locale=en \
-F 'categories=[{"id":"food","name":"Food","kind":"expense"},{"id":"other","name":"Other","kind":"expense"},{"id":"refund","name":"Refund","kind":"income"},{"id":"other","name":"Other","kind":"income"}]' \
-F 'merchants=["Starbucks","Trader Joe'"'"'s"]' -F 'accounts=["Chase Sapphire (4421)"]'
ledger_entry.v4)200 with:
{
"entry": {
"kind": "expense",
"original_amount": "54.13",
"original_currency_code": "USD",
"occurred_at": "2026-11-24T19:05:00-05:00",
"counterparty_name": "JOE'S DINER",
"title": "Joe's Diner",
"category_id": "food",
"category_name": "Food",
"financial_account_name": "Chase Sapphire (4421)",
"note": "Cheeseburgers, fries",
"description": "Dinner for two, tip included",
"confidence": 0.93,
"line_items": [
{ "name": "Cheeseburger", "quantity": "2", "unit_price": "12.00", "amount": "24.00" },
{ "name": "Tip", "amount": "8.40" }
],
"details_json": {
"is_transaction": true,
"field_confidence": { "amount": 0.98, "occurred_at": 0.9, "counterparty": 0.95, "category": 0.8, "account": 0.7 }
}
},
"transactions": [
{ "…": "the same object as entry (the first transaction)" },
{
"kind": "income",
"original_amount": "25.00",
"original_currency_code": "USD",
"occurred_at": "2026-11-23T12:00:00-05:00",
"counterparty_name": "Amazon",
"category_id": "refund",
"category_name": "Refund",
"note": "Partial refund",
"confidence": 0.9
}
]
}
transactions lists every transaction in the image, in the order shown, at most 20. entry repeats the first one for older apps. Without transactions the app takes entry as the only one."transactions": [] and entry.details_json.is_transaction: false (or original_amount: "0"). The app says it found no transaction.null; the app leaves it empty for the user. Results only prefill the form; nothing is saved until the user confirms.| Field | Meaning |
|---|---|
original_amount |
Required. Positive decimal string, "54.13"; no symbols or separators |
kind |
expense (default) or income |
original_currency_code |
ISO 4217, per transaction (rows of one list may differ) |
occurred_at |
RFC 3339 with offset |
counterparty_name, title |
Merchant or payee; title is a fallback |
category_id, category_name |
One of the request’s categories; other when none fits. Without an id the app matches category_name |
financial_account_name |
Card, bank, wallet or payment app used |
note |
The ledger’s short label: what was bought, ≤ ~16 CJK or 32 Latin characters; not the merchant again |
description |
Longer details |
confidence |
0–1 for the transaction |
line_items[] |
name (required), quantity, unit_price, amount, currency_code as strings; negative for discounts |
details_json.field_confidence |
0–1 per field (amount, occurred_at, counterparty, category, account). Below 0.6 the app marks the field for the user to check |
What the app expects the transactions to mean:
line_items. A list (statement, bill list) is one transaction per completed row.income for the refunded amount only.counterparty_name, title, financial_account_name) are copied as printed, never translated, except for the known-name rule above.GET {base}/rates?from=CAD&to=CNY&date=2026-11-21
{ "from": "CAD", "to": "CNY", "rate": 4.6676, "rate_date": "2026-11-20", "source": "ecb" }
rate: units of to per one from, 8 significant digits. rate_date: the day published, the requested date or the last one before it with rates (weekends, holidays). source: free text the app shows (ecb, currency-api, …).400 for a malformed request. 503 with {"code": "rate_unavailable"} and a Retry-After header when no rate can be found right now: the app marks the entry’s rate as pending and tries again later. Offering rates means the app doesn’t fall back to public sources for you.Errors are JSON: {"code": "…", "error": "human-readable"}.
| Status | App shows |
|---|---|
401 |
No key entered: “needs an access key”; otherwise “the key isn’t accepted” |
429 (Retry-After recommended) |
Recognition limit reached; try later |
| any other status, timeout | “The service returned an error (status)”; the user can retry, and the screenshot waits as a draft |
ledger_entry.v4, rates.v1) never changes its meaning; new optional request fields and response fields may be added within a version, and both sides ignore what they don’t know./capabilities; the app keeps speaking the versions it knows.ledger_entry: v4 adds transactions, note, category_id; request fields locale and categories (app 20261127), kind in categories, merchants and accounts (app 20261128).curl -sS https://ledger.example.com/v1/capabilities # optional: 200 with your capabilities, or 404
curl -sS -H "Authorization: Bearer $KEY" https://ledger.example.com/v1/ai/access # 200
curl -sS -H "Authorization: Bearer $KEY" -F image=@receipt.jpg \
https://ledger.example.com/v1/ai/receipt:parse-image # 200 with transactions
In Blinklet open Settings › Recognition › Self-hosted recognition, enter the base URL (https://ledger.example.com/v1) and the access key, and tap Test Connection.
Take or share a screenshot of a payment: the form fills in from your service.
For each recognition the app sends only: the screenshot (scaled down if large; a photo’s location data is removed), the ledger’s currency and time zone, the app’s language, the user’s category names, and up to 30 merchant and 10 account names the ledger already uses. It sends no other entries, amounts, Apple ID or device identifiers. The ledger itself stays in the user’s iCloud; the service never sees it.
Screenshots can contain names and card digits. Process them in memory, don’t log or store images, and keep the access key secret.
| Symptom | Check |
|---|---|
| Test Connection: “needs an access key” / “key isn’t accepted” | /ai/access returns 401: the key in the app and the service differ |
| “The service returned an error (404)” | The base URL: the app appends /ai/receipt:parse-image; enter the part before it |
| Works on Wi-Fi at home, not outside | A local address (192.168…, .local) isn’t reachable from outside; use a public HTTPS address |
| Connection fails on a public address | It must be HTTPS with a valid certificate |
| Every screenshot “no transaction” | original_amount missing or "0", or is_transaction: false |
| Notes in the wrong language | note follows the image’s text; locale is only for images without text |
| Categories always “Other” | Return a category_id from the request’s categories |
| Foreign entries never get a rate | Without rates in /capabilities the app needs network access to the public rate sources |