Xero API Java client library
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Unmaintained - Forks Welcomed

We will no longer be maintaining this repository, so please feel free to fork it.


The library is available from the Central Maven Repository and can be used easily by many tools including Maven, Gradle, SBT, etc.


Example Usage

Creating a client:

Reader pemReader = new FileReader(new File("my-x509-cert.pem"));
XeroClient client = new XeroClient(pemReader, consumerKey, consumerSecret);

Getting invoices:


Creating an invoice:

Invoice invoice = new Invoice();
LineItem item = new LineItem();
item.setDescription("Test Invoice");


  • This library and all dependencies are available in the Maven Central Repository
  • Compatible with Java 8 (libraries using JiBX are not due to BCEL dependency)
  • Work with standard Java classes like List<Invoice> and Date (other libraries using JAXB give you things like ArrayOfInvoice and JAXBElement<GregorianCalendar>)
  • Easily extensible - protected, non-final client

Not yet supported

Pull requests will be accepted for any not yet supported features. Changes to existing methods will be more likely to be accepted if a test is added. All fields in the XeroClient are protected to make it easy to extend in your own code without needing to update this client.

The only write call included thus far is for creating invoices and receipts because that's all we've needed. It's only a few lines to add a new write method if you find one that you need. However, this is another area where Xero's XML schemas are lacking, so you may have to submit a pull request to the Xero XML Schema project to be able to write new types as shown in this example and this example.

Support for attachments has not yet been added.

Currently, only the private app authentication method has been implemented. We use Scribe to support OAuth, so support for the public app OAuth should be straight forward to implement if needed.

Hacking on this library

The SBT build tool must be installed and Xero's XML schema library must be checked out as a sibling project. Build with:

sbt compile