{"openapi":"3.1.0","info":{"title":"Lekha API API","description":"Indian bank statement PDF to JSON. Authenticate with the `X-API-Key` header.","version":"0.1.0"},"paths":{"/v1/statements":{"post":{"tags":["statements"],"summary":"Parse Statement","description":"Bank statement PDF in, transactions out. One credit per PDF page, charged only on success.\n\nNothing is stored; the file lives only in memory for the duration of the request.\n(A plain `def`: FastAPI runs it in a worker thread, so parsing never blocks other requests.)","operationId":"parse_statement_v1_statements_post","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_parse_statement_v1_statements_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Statement"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/account":{"get":{"tags":["account"],"summary":"Account","description":"Credits left on the account behind this API key (one credit = one PDF page). Free to call.","operationId":"account_v1_account_get","parameters":[{"name":"x-api-key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Api-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Account":{"properties":{"credits_remaining":{"type":"integer","title":"Credits Remaining"}},"type":"object","required":["credits_remaining"],"title":"Account"},"BalanceCheck":{"properties":{"passed":{"type":"boolean","title":"Passed"},"checked_rows":{"type":"integer","title":"Checked Rows"},"first_mismatch_index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"First Mismatch Index"},"expected":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expected"},"found":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Found"}},"type":"object","required":["passed","checked_rows"],"title":"BalanceCheck","description":"Running-balance reconciliation: the customer's reason to trust the output."},"Body_parse_statement_v1_statements_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"password":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Password"}},"type":"object","required":["file"],"title":"Body_parse_statement_v1_statements_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"Statement":{"properties":{"bank":{"type":"string","title":"Bank"},"parser":{"type":"string","title":"Parser","default":"bank"},"pages":{"type":"integer","title":"Pages","default":0},"ifsc":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ifsc"},"account_holder":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Holder"},"account_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Number"},"period_start":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Period Start"},"period_end":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Period End"},"opening_balance":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Opening Balance"},"closing_balance":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Closing Balance"},"transactions":{"items":{"$ref":"#/components/schemas/Transaction"},"type":"array","title":"Transactions"},"balance_check":{"anyOf":[{"$ref":"#/components/schemas/BalanceCheck"},{"type":"null"}]}},"type":"object","required":["bank","transactions"],"title":"Statement"},"Transaction":{"properties":{"date":{"type":"string","format":"date","title":"Date"},"value_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Value Date"},"description":{"type":"string","title":"Description"},"debit":{"type":"string","title":"Debit","default":"0"},"credit":{"type":"string","title":"Credit","default":"0"},"balance":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Balance"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reference"}},"type":"object","required":["date","description"],"title":"Transaction"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}