Hi folks,

Has something changed with creating bank-transaction-explanation(s) via the API? It worked fine last week (and past 5 years) but this week I am getting 401 unauthorized.

I can do all the other calls. List bank accounts, refresh-token, create-invoice, mark-invoice-as-sent but the create bank transaction explanation call is failing. I make the same change via the website UI and that works fine so it can’t be data related(?). It is just the API call that is failing.

An example call is below - can anyone see what dumb thing I am doing wrong? Because I can’t :confused:

<?xml version=‘1.0’ encoding=‘UTF-8’?><bank-transaction-explanation>
<dated-on type=“date”>2020-10-23</dated-on>
<description>Some text here</description>
<sales-tax-rate type=“decimal”>20</sales-tax-rate>
<gross-value type=“decimal”>18</gross-value>
<foreign_currency_value type=“decimal”>18</foreign_currency_value>

Authorization: Bearer [REDACTED]
User-Agent: Java/1.6.0_33
Content-Type: application/xml
Accept: application/xml
Content-Length: 952

Hi Martin :wave:

My name is Ewa and I’m one of the engineers here at FreeAgent – thanks for posting on our forum, and I’m sorry to hear you’ve run into some trouble with our API.

We’ve done a bit of digging behind the scenes and it turns out the 401 status code (which at first glance would suggest an authentication issue) is somewhat misleading here; it disguises a problem with some recently released code around bank transaction explanation creation. Our team has already identified a fix which will be shipped early next week.

In the meantime, you can avoid receiving this error by sending JSON instead of XML or removing type="date" from the <dated-on> fragment in your XML request body, which in the example above would result in the following:

<?xml version=‘1.0’ encoding=‘UTF-8’?>
 <description>Some text here</description>
 <sales-tax-rate type="decimal">20</sales-tax-rate>
 <gross-value type="decimal">18</gross-value>
 <foreign_currency_value type="decimal">18</foreign_currency_value>

I hope this is a suitable workaround for you in the short term – my apologies for the trouble, and I’ll be sure to let you know as soon as the fix has been released.

Best wishes,


Hi Ewa,

Thanks for that. Good to know I’m not losing my marbles (yet!).

I will wait for the fix.

Thank you so much for letting me know, keep up the good work.

1 Like

Hi Martin,

Just a quick one to let you know that earlier today our engineers released a fix for the issue you encountered last week, so you should once again be able to successfully create bank transactions explanations using XML requests. :tada:

If there’s anything else we can do to help, please let me know, and once again our sincere apologies for this teething issue.

Best wishes,