Repository navigation
Feature Request: Upload statements to the Statement Vault via the REST API #4825
Closed
Taaqif
started this conversation in
Feature Requests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Add an endpoint to the REST API (
/api/v1) for uploading statement documents into the Statement Vault, e.g.POST /api/v1/account_statements, authenticated with an API key (X-Api-Key) like the other endpoints.Why
The Statement Vault is a great place to keep primary-source documents, and coverage/reconciliation make it more useful the more complete it is. Today a statement can only get there through the web UI or the MCP
upload_account_statementtool.Tools that already talk to the API, such as bank sync scripts that import transactions with
POST /api/v1/imports, could also download each month's statement PDF from the bank and file it automatically. Doing that over MCP means a separate token (MCP_API_TOKEN+MCP_USER_EMAIL, or OAuth) and a JSON-RPC client just for this one call, while everything else uses the regular API key.Proposal
POST /api/v1/account_statements(multipart):file(required): PDF, CSV or XLSX, same limits as the vault upload (25 MB)account_id(optional): link to this account on upload; without it the vault suggests a match as it does todayperiod_start_on,period_end_on,opening_balance,closing_balance,currencyResponse: the statement (id, account_id, detected period, institution, suggested account + confidence) and
duplicate: truewhen the same file (SHA-256) is already stored, mirroring the MCP tool.Nice to have:
GET /api/v1/account_statements?account_id=(list, with period) so a client can tell which months it has already filedGET /api/v1/accounts/:id/statement_coverage?year=(same data as the MCPget_statement_coveragetool)Notes
The behaviour already exists (
AccountStatement.prepare_upload!/create_from_prepared_upload!and the MCP tool), so this would mostly be a thin controller + jbuilder views + docs in the API spec.All reactions