Creating transactions from your own script and reading them back through an expense tracker's API is a fair thing to want. Before you build on any tracker's API, confirm it exists, see what it can do, and plan for the day it changes. Here is how we would go about it.
First, find out what the tracker actually offers
Do not assume. Look at the product's own documentation and pages. For SpendixAI, the documented ways in are statement upload in PDF, CSV or Excel with a review before saving, expenses added by hand singly or several at once, and a connection for Claude or ChatGPT through MCP, where you pick the scope and can start read-only. we cannot point to a documented public API from the product facts I have, so check the FAQ and features pages before building around one.
Steps we would follow for any tracker API
- Read what the key can do. Ideally you can limit it to creating and reading, and revoke it without touching your login.
- Store the key in an environment variable or a secrets manager, never in the script or in a repository.
- Test with a throwaway record, then read it back and compare every field.
- Add a unique reference to each record you send, so a retry cannot create a second copy.
- Log what you sent and what came back, including failures, so you can reconcile later.
- Decide what happens when the call fails: queue and retry, or alert you.
A made-up example of why the unique reference matters
Say your script pushes four small purchases: stationery ₹640, courier ₹185, tea ₹120 and a data recharge ₹799. The total is 640 + 185 + 120 + 799 = ₹1,744. The call times out after the server has already saved the records, so your script retries. Without a unique reference, the tracker now holds eight rows and ₹3,488 of spending. With one, the second attempt is recognised as the same batch, or at least you can find and remove the copies.
| Check | Why it matters |
|---|---|
| Fields accepted: date, amount, currency, merchant, account | Missing fields cause rows that will not categorise or reconcile |
| Currency handling | The base currency stays fixed once transactions exist, so decide before you send |
| Duplicate protection | Retries are the commonest source of double entries |
| Limits and plan | Pro allows 2,000 transactions a month, so check volume against your plan |
| Deleting | A recycle bin with a 30-day window makes mistakes recoverable |
What if there is no API?
You can still automate more than you think. Produce a CSV from your own system in a fixed column order and import it. Pro includes CSV exports and statement imports, and imported rows are reviewed before saving. For one-off clean-ups, use the batch add in the app.
Honest limits
- Scripts that write transactions can multiply a mistake very quickly, so test with small batches.
- Reading back and comparing totals is the only real proof that it worked.
- Anything beyond what the product documents is an assumption, so write down what you are assuming.
What we would log and monitor
Once a script writes records, treat it like any other small system. Keep one log line per run with the number of records sent, the number accepted and the total amount. If you send ₹1,744 on Monday and the tracker shows ₹1,744 for the same rows, the loop is closed. If the figures drift, you will see it within a day instead of at month end.
- Alert yourself when a run sends zero rows on a day it should have sent some.
- Keep failed records in a file so you can resend them deliberately.
- Rotate the key on a schedule, and at once if a laptop is lost or a repository is shared.
- Read the totals in the tracker once a week with your own eyes.
Checklist before you rely on it
- Key limited and revocable.
- Unique reference on every record.
- Count and total compared after every batch.
- A manual route, such as CSV import, that you can fall back on.
Useful ideas start with a clearer picture of your own spending.
Explore your reports
