ynab / ynab-sdk-js

YNAB API Client for JavaScript
https://api.ynab.com
Apache License 2.0
217 stars 20 forks source link

How to delete transaction #142

Closed stevgouws closed 1 year ago

stevgouws commented 1 year ago

Hi, is there any way to programatically delete transactions? I'm automating some of my budgeting and as part of it I want to run integration tests that creates a bunch of dummy data in a real YNAB budget (separate from my actual one), then deletes all the transactions at the end of the tests.

I've tried using updateTransactions but it looks like the deleted flag is ignored. Am I missing something or is it something that you just don't expose int he api?

bradymholt commented 1 year ago

Hi Steven - the API does not currently support deletion but one way you could handle this is to create an account (named "Deleted Transactions" perhaps) and move these transactions to that account, since the API supports both account creation and moving transactions from one account to another.

We do have a feature request for deleting transactions and this might be something we can implement in the near future. Check back for updates on this client in the event we are able to add this feature.

stevgouws commented 1 year ago

Hey, I've gone for unit tests meanwhile but thanks yeah that's an interesting workaround.

bradymholt commented 1 year ago

New support (and example) for deleting a transaction added in v1.45.0.

stevgouws commented 1 year ago

@bradymholt That was quick & thanks for re-posting here 👍