Series links:
- Part 1/5 – Introduction
- Part 2/5 – Database Planning
- Part 3/5 – AWS Setup
- Part 4/5 – Backend APIs (you are here)
- Part 5/5 – Frontend
What
A tiny set of APIs to save entries with files, search them, get suggestions, and export CSV.
Why
- Clear, stable contracts make the frontend simple.
- You can implement these endpoints in any backend framework.
How
Use your own domain names. The example hostnames below are placeholders.
Upload
POST https://upload.your-domain.com- Purpose: create a new accounting entry and upload one or more files (bills/receipts) to storage.
- Send as
multipart/form-datawith fields:date(e.g.,01-oct-2025),amount,crdr(CR/DR),category,description, and repeatedfilefields for uploads.
- Response: success/failure and the new entry id/human code.
Filter/Search
POST https://filter.your-domain.com- Purpose: get a list of entries with optional filters.
- JSON body:
{ pageNumber, limit, queryString?, startDate?, endDate? }. - Response: array of entries (each may include documents with URLs).
Category Autocomplete
POST https://getcats.your-domain.com- Purpose: return category suggestions as the user types.
- JSON body:
{ searchFor }. - Response:
[ { "appended_category": ["Grocery", "Fuel", ...] } ].
Description Autocomplete
POST https://getdesc.your-domain.com- Purpose: return description suggestions as the user types.
- JSON body:
{ searchFor }. - Response:
[ { "appended_description": ["Swiggy dinner", "Amazon order", ...] } ].
Export CSV
POST https://exportcsv.your-domain.com- Purpose: download a CSV for the current filters.
- JSON body:
{ queryString?, startDate?, endDate? }. - Response: CSV text stream; the browser downloads it as a file.
Notes:
- Security: each request can include a lightweight signature (two headers like
x-messageandx-signature). Keep time synced and only accept recent timestamps. - Documents: for viewing, serve a short‑lived link or an authenticated redirect so the files remain private in storage.
Thoughts / Caveats
- Keep responses consistent; the frontend normalizes fields but predictable names help.
- Use pagination (
pageNumber,limit) to keep listing fast. - Rate‑limit and log errors; failed uploads usually come from bad networks or very large files.