API that mimic import transactions

Hello,

First I would like to congratulate you for the new API support. It feels great and open YNAB to many use-cases.

Is there a way to achieve manual transaction imports from a service? I tried to use '/budgets/{budget_id}/transactions/bulk' but it seems to serve different purpose. It doesn't do the following:

1. provide only payee name without payee id -> should match  to existing payee id  (actually I think it does that one but I'm not sure)

2. provide only payee name without category id -> should match category id automatically 

3. prevent settings  import id manually (should be provided by the api server)

4. prevent duplicate imports

topics #2 and #4 are the important ones and since they doesn't happen I assume you didn't expect people to use this service to import transactions. 

Is this in your pipe, do you plan to add in near to come versions?

Thanks

Eran.

 

 

2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hello,

    After reading the following link and playing with my budget records thru the API, I learned how to perform an import of transactions the same way as it is done internally by YNAB. I would like to verify my understanding to get same results for the user regardless if he imported from YNAB app or from my extension.

    Import process:

    When a user import a bunch of transactions, YNAB generates an import id per transaction by appending the following:

    1. constant 'YNAB:'
    2. transaction amount
    3. transaction date
    4. constant ':'
    5. an incremental number starting from 1. counting the number of similar keys generated by step 1-4 for each account separately

    steps 1-4 are obvious, I would be happy to get confirmation regarding step 5.

    ----

    I know your hands are probably full with feature requests still I would like to suggest an improvement. I think import process an operation by itself. Many developers will like to perform an import process similar to what YNAB does. I think having a dedicated api action for import which expose specific api parameters and abstract all the business logic will ensure developers will not break the process. 

     

    Thanks again.

    Eran

    Like 2
    • Eran Sakal Hello there.  On the API Endpoints page, if you click "Model" you'll see a description of the fields. 

       For import_id, the description is:

      If specified for a new transaction, the transaction will be treated as Imported and assigned this import_id. If another transaction on the same account with this same import_id is later attempted to be created, it will be skipped to prevent duplication. Transactions imported through File Based Import or Direct Import and not through the API, are assigned an import_id in the format: 'YNAB:[milliunit_amount]:[iso_date]:[occurrence]'. For example, a transaction dated 2015-12-30 in the amount of -$294.23 USD would have an import_id of 'YNAB:-294230:2015-12-30:1’. If a second transaction on the same account was imported and had the same date and same amount, its import_id would be 'YNAB:-294230:2015-12-30:2’. Using a consistent format will prevent duplicates through Direct Import and File Based Import. If import_id is specified as null, the transaction will be treated as a user entered transaction.


      import_id can be specified on POST /budgets/{budget_id}/transactions/bulk, POST /budgets/{budget_id}/transactions, and PUT /budgets/{budget_id}/transactions/{transaction_id} .

      If you specify an import_id, it will be considered an imported transaction and we will do account specific duplicate checking based on the import_id.  If an import_id is not specified, we will treat the transaction as if it was manually entered through one of the clients.

      provide only payee name without category id

      If you specify an payee_name without a category_id, if we can resolve a payee_id from the payee_name we will auto populate the category_id when the transaction is being created, if that payee is configured with a default category.

      an incremental number starting from 1. counting the number of similar keys generated by step 1-4 for each account separately

      Yes, that is correct.  Hopefully the import_id description above lays out how this import_id is generated on our side when importing transactions from financial institutions and through File-based import.

      Hope this helps! 

      Like 1
Like1 Follow
  • 1 Likes
  • 1 yr agoLast active
  • 2Replies
  • 1017Views
  • 3 Following