{"openapi":"3.1.0","info":{"title":"Ledgerary API","version":"1.0.0","description":"Ledgerary turns any bank statement, credit-card statement or financial PDF into clean, structured data — every transaction with date, description, amount and running balance, checked against the statement totals. Convert to Excel, CSV, JSON, QuickBooks or Xero in seconds, or call the same engine from your code with a single-key API and MCP server so AI agents can parse statements the way your bookkeeping team does. Free to start — built for bookkeepers, accountants, lenders and the agents building on top of them.","contact":{"name":"Ledgerary","url":"https://ledgerary.com","email":"hello@ledgerary.com"}},"servers":[{"url":"https://ledgerary.com"}],"security":[{},{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"nmr_live_*"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]},"Transaction":{"type":"object","properties":{"date":{"type":["string","null"],"format":"date","description":"yyyy-mm-dd as printed, or null if unreadable."},"description":{"type":"string"},"amount":{"type":"number","description":"Signed: negative = money out, positive = money in."},"direction":{"type":"string","enum":["debit","credit"]},"balance":{"type":["number","null"],"description":"Running balance if the statement printed one."},"category":{"type":["string","null"]}},"required":["description","amount","direction"]},"ExtractionMeta":{"type":"object","properties":{"doc_type":{"type":"string","enum":["bank_statement","credit_card_statement","investment_statement","other_financial"]},"institution":{"type":["string","null"]},"account_holder":{"type":["string","null"]},"account_number_masked":{"type":["string","null"]},"currency":{"type":["string","null"]},"period_start":{"type":["string","null"],"format":"date"},"period_end":{"type":["string","null"],"format":"date"},"opening_balance":{"type":["number","null"]},"closing_balance":{"type":["number","null"]}}}}},"paths":{"/api/v1/extract":{"post":{"summary":"Extract every transaction from a bank/card statement PDF — balance-checked, with a confidence score.","operationId":"post_api_v1_extract","security":[{},{"bearerAuth":[]}],"parameters":[{"name":"format","in":"query","required":false,"description":"excel | csv | json | quickbooks | xero | sage — return a converted file instead of JSON.","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"extraction_id":{"type":["string","null"]},"status":{"type":"string","enum":["completed"]},"meta":{"type":"object","properties":{"doc_type":{"type":"string","enum":["bank_statement","credit_card_statement","investment_statement","other_financial"]},"institution":{"type":["string","null"]},"account_holder":{"type":["string","null"]},"account_number_masked":{"type":["string","null"]},"currency":{"type":["string","null"]},"period_start":{"type":["string","null"],"format":"date"},"period_end":{"type":["string","null"],"format":"date"},"opening_balance":{"type":["number","null"]},"closing_balance":{"type":["number","null"]}}},"transactions":{"type":"array","items":{"type":"object","properties":{"date":{"type":["string","null"],"format":"date","description":"yyyy-mm-dd as printed, or null if unreadable."},"description":{"type":"string"},"amount":{"type":"number","description":"Signed: negative = money out, positive = money in."},"direction":{"type":"string","enum":["debit","credit"]},"balance":{"type":["number","null"],"description":"Running balance if the statement printed one."},"category":{"type":["string","null"]}},"required":["description","amount","direction"]}},"totals":{"type":"object","properties":{"debits":{"type":"number"},"credits":{"type":"number"}}},"balance_check":{"type":"string","enum":["passed","failed","unknown","not_applicable"]},"balance_delta":{"type":["number","null"]},"confidence":{"type":"number","minimum":0,"maximum":1},"page_count":{"type":"integer"},"warnings":{"type":"array","items":{"type":"string"}},"request_id":{"type":"string"},"disclaimer":{"type":"string"},"attribution":{"type":"string","description":"Present on free/anonymous responses only."}},"required":["status","meta","transactions","totals","balance_check","confidence","page_count","request_id"]}}}},"402":{"description":"Upgrade required (Free plan has no API access)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"422":{"description":"Could not process the document","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"file_base64":{"type":"string","description":"Base64-encoded PDF bytes."},"file_name":{"type":"string"},"file_url":{"type":"string","format":"uri","description":"https:// URL to fetch the PDF from."}},"description":"Provide exactly one of file_base64 or file_url (or send multipart/form-data with a `file` field instead of JSON)."}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}}}}}}}},"/api/v1/extractions":{"get":{"summary":"List the caller's own saved extractions, newest first.","operationId":"get_api_v1_extractions","security":[{"bearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer"},"extractions":{"type":"array","items":{"type":"object"}}}}}}},"402":{"description":"Upgrade required (Free plan has no API access)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"422":{"description":"Could not process the document","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/extractions/{id}":{"get":{"summary":"Get one saved extraction with its full transaction list.","operationId":"get_api_v1_extractions_id","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Extraction id returned by POST /extract.","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"meta":{"type":"object","properties":{"doc_type":{"type":"string","enum":["bank_statement","credit_card_statement","investment_statement","other_financial"]},"institution":{"type":["string","null"]},"account_holder":{"type":["string","null"]},"account_number_masked":{"type":["string","null"]},"currency":{"type":["string","null"]},"period_start":{"type":["string","null"],"format":"date"},"period_end":{"type":["string","null"],"format":"date"},"opening_balance":{"type":["number","null"]},"closing_balance":{"type":["number","null"]}}},"transactions":{"type":"array","items":{"type":"object","properties":{"date":{"type":["string","null"],"format":"date","description":"yyyy-mm-dd as printed, or null if unreadable."},"description":{"type":"string"},"amount":{"type":"number","description":"Signed: negative = money out, positive = money in."},"direction":{"type":"string","enum":["debit","credit"]},"balance":{"type":["number","null"],"description":"Running balance if the statement printed one."},"category":{"type":["string","null"]}},"required":["description","amount","direction"]}}}}}}},"402":{"description":"Upgrade required (Free plan has no API access)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"422":{"description":"Could not process the document","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/extractions/{id}/export":{"get":{"summary":"Download a saved extraction converted to Excel, CSV, JSON, QuickBooks, Xero or Sage.","operationId":"get_api_v1_extractions_id_export","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Extraction id.","schema":{"type":"string"}},{"name":"format","in":"query","required":true,"description":"excel | csv | json | quickbooks | xero | sage.","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"402":{"description":"Upgrade required (Free plan has no API access)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"422":{"description":"Could not process the document","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}}}}},"/api/v1/pricing":{"get":{"summary":"Machine-readable pricing — plans, included pages, per-page overage, rate limits and features.","operationId":"get_api_v1_pricing","security":[{},{"bearerAuth":[]}],"parameters":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"unit":{"type":"string","enum":["page"]},"currency":{"type":"string"},"anonymous":{"type":"object"},"plans":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["free","pro","scale"]},"name":{"type":"string"},"price_usd_per_month":{"type":"number"},"included_pages_per_month":{"type":"integer"},"overage_usd_per_page":{"type":"number"},"rate_limit_per_minute":{"type":"integer"},"batch_max_files":{"type":"integer"},"api_access":{"type":"boolean"}}}}}}}}},"402":{"description":"Upgrade required (Free plan has no API access)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"422":{"description":"Could not process the document","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]},"request_id":{"type":"string"}},"required":["error"]}}}}}}}}}