Blinklet developer docs

Blinklet recognition service protocol

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.

What a service must implement

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.

Conventions

Capabilities (optional)

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" }
  }
}

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.

Recognize a screenshot (required)

POST {base}/ai/receipt:parse-image
Authorization: Bearer <access key>
Content-Type: multipart/form-data

Request fields

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)"]'

Response (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
    }
  ]
}
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:

Exchange rates (optional)

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" }

Errors

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

Versioning

Connect the app and check it works

1. Check the service from a computer

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

2. Connect the app

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.

3. Try it

Take or share a screenshot of a payment: the form fills in from your service.

Privacy

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.

Troubleshooting

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