POSTing split transactions

Do you have an example of creating a new transaction that is split? I've tried several things through the API, but nothing seems to work. Is this supported? If not, do you have a timeline for it? If it is supported, can we have an example json that works? Thanks!

53replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Split transactions are now supported!  You can specify a "subtransactions" array when creating or updating a transaction like this:

    curl -H "Authorization: Bearer $API_ACCESS_TOKEN" -H "Content-Type: application/json" -X POST --data-binary @- << EOF
          "memo":"This is a split",
                "payee_name":"Split payee",
                "memo":"Split 1"
                "memo":"Split 2"

    See the API Endpoint Documentation for more details.

    The client libraries have not been updated to support splits yet, but will be in the near future.

    Like 4
      • Alfred
      • firnnauriel
      • 4 mths ago
      • 1
      • Reported - view

      Brady Fantastic news! I'll test it sometime this week. Thanks for the work.

      Like 1
    • Brady Cool. But I‘m not able to create a transaction with a transfer as a subtransaction. I tried with payee_name and payee_id. But the subtransaction has no payee in the end.

      Can you give a hint, or is there a bug?

    • Pink Yearling Per the docs, transfer payees are not allowed for splits.

  • Nice! Thanks Brady!

    Like 1
  • So excited for this! Thank you! 

    Like 1
  • Integrated split transactions into my grocery store receipt processor and it's working great. Thanks again!

    Like 2
  • Hi Brady, nice to see this feature!
    But there is a problem - why subtransactions cannot be specified for an imported transaction?
    I'm heavily relying on this field to backtrack created transactions.

  • Gold Wrench - There is a technical design reason we don't support that, currently.  One thing you could do is create a regular non-imported transaction (no import_id) as a split and then create a secondary imported transaction that will match (same account_id, amount, and date) to that first transaction.  The net result would be a single, split transaction with a matched, non-visible imported transaction counterpart.  This is effectively how things work when not using the API.

      • Gold Wrench
      • Gold_Wrench.11
      • 3 mths ago
      • Reported - view

      Brady thank you, will try it out!

    • Brady I'm trying to add a split to an already existing imported transaction. As far as I understood I just need to create a new transaction with the same account_id, amount and date as the imported transaction.

      This is the request I'm sending (where transaction is the already existing transaction, that has a import_id)

          "account_id": transaction["account_id"],
          "date": transaction["date"],
          "amount": transaction["amount"],
          "payee_id": transaction["payee_id"],
          "memo": "split", # same as old transaction, but doesn't seem to matter
          "cleared": "cleared",
          "approved": True,
          "subtransactions": [
                  "amount": amount2,
                  "category_id": splitCategoryId,
                  "amount": amount1,
                  "category_id": transaction["category_id"],

      The transaction is created correctly, the transactions are not merged and I end up with 2 transactions.

      Is there anything I'm doing wrong?

    • Slate Gray Sloth 

      It sounds like you are trying to create another transaction that will be matched to the original imported transaction.  Matching is only done for new import transactions.  When a new import transaction is created for the first time, matching is performed and if there is a non-imported transaction (user entered, import_id = null) that matches it (date, amount) they will be matched.  You cannot match a new non-imported transaction to a previously imported transaction.  Also, you cannot split an imported transaction.  They are, by design, not allowed to be splits.      

      You could create a non-import transaction with the splits before the imported transaction gets created which would cause matching to take place and the non-imported split would remain.

    • Brady Thank you for your reply.

      Since matching only occurs when an imported transaction is created, I'd need to create a second imported transaction based on the origin one.

      If I do that the original transaction remains and I end up with a duplicate (the original imported transaction without split and a new transaction with split).

      It also seems that there is no way to delete a transaction via the API.

      To summarize: There is no way to add a split to an existing imported transaction or create a new transaction with a split and delete the original imported transaction?

    • Slate Gray Sloth Correct - I don't think the API currently supports what you are trying to achieve here.  One stop-gap here could be to update the original imported transaction amount to $0 (with a memo) to clear out its effect on the budget.  This is obviously not ideal but could work for your particular workflow.

    • Brady What I wish to achieve (and I believe this is true for others), is to automatically apportion income transactions between "To Be Budgeted" and "Tax Year XXXX->YYYY"

      The reason I want to be able to do this with a split transaction is that I'd be able to tell whether any given transaction has been processed for tax accrual. As it is, I use the API to read and subtotal the correct tax amount per month so that I can manually verify.

      As I understand it, we cannot split an imported transaction and if we were to do so via the Web UI, we'd effectively been creating a new transaction that's been "matched".

      Your suggested solution of pre-creating a transaction to be automatically matched with an imported transaction is impractical as it requires prior knowledge of the transaction.

      Do you think it would be worth us putting in a feature request to be able to match transactions over the API?

      Using the API to find an unmatched / unsplit imported transaction, create a new split transaction and match it to the pristine one would achieve the goal I think myself and others are after?

    • Tomato Deer  - Yes, submitting a feature request would be the way to go here.  When using a YNAB client (e.g. web) and you split a transaction that was imported we actually do change that imported transaction to a split.  The API doesn't support this, though and there is a specific technical reason for not supporting it.  But, it's feasible to implement this ability to do so so a feature request to "Allow an imported transaction to be split" would be appropriate.  Thanks!

    • Brady Thank you for the suggestion, I've submitted a feature request to allow the API to split imported transactions.

Like17 Follow
  • 3 wk agoLast active
  • 53Replies
  • 1564Views
  • 32 Following