Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Invoice CurrencyRate

Started by Stardraw Accounts -   in API Endpoints

How can I set the CurrencyRate for an Invoice?
I want to use the current xe rate, but there doesn't seem to be an API to set it or retrieve it.
At the moment, the rate defaults to 1.000 which is obviously wrong and means I have to manually modify each DRAFT Invoice to set.
Hi Stardraw,

When creating an invoice, if you specify a <CurrencyCode>, but omit the <CurrencyRate> element, Xero API will automatically use the rate of the day for your organisation - which is normally provided by xe.com.

If you have your own source of currency rates, or need to match a rate used from another system, then you can specify the <CurrencyRate> element yourself.

If you're seeing invoice rates of 1.0000 being returned in the xml response, then you might want to see if the xml serializer that you're using is putting in 1.0000 by mistake. Also, invoices created using the organisation base currency will always have a rate of 1.0000.


Daniel Barratt (Xero Staff)  

Hi Dan,

Will Xero always use the current rate of the day?

Say if you used the API to transfer an invoice generated on the previous day.

Would Xero match the invoice date to an earlier currency rate of the day?



Jamie Nicholson  

Hi Jamie,

If you create a foreign currency invoice via the API and don't specify a currency rate to use, the API will use the rate of the day corresponding to the invoice date that you would have specified.

This should mimic how invoices are created in the main Xero application. From the help docs on Foreign currency bills and invoices:

"The exchange rate used on the sales invoice, bill or credit note will be the rate on the invoice, bill or credit note date i.e. the 'Date' field or the closest rate to that date if one doesn't exist for the date entered"


Daniel Barratt (Xero Staff)  

Fantastic thanks Dan that's perfect.

Jamie Nicholson