Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Organisation unique identifier

Started by Brendan Doherty -   in API Endpoints

Does the APIKey element on /Organisation endpoint uniquely identify the organisation for different users? (It appears to from my initial testing, but I'd like Xero to confirm).
There isn't currently a 100% reliable unique key to identify an organisation. The <ApiKey> exposed on the Organisation endpoint is unique across all organisations, but this may not be populated for all organisations.

As a second option, you could used the <CreatedDateUTC> element on the organisation. This records the timestamp down to the nearest millisecond that the organisation was created. It's unlikely that you'll see 2 organisations that were created on the same millisecond. Again, this isn't 100% reliable, but may be good enough for your purposes.

Dan..
 

Daniel Barratt (Xero Staff)  

I need something similar – a unique identifier for the oauth connected Xero organisation.

… and noticed there's a field xero_org_muid which is returned during oauth's get token which looks to do the trick.

The question is, I couldn't find any documentation on this field yet, is it safe to use and rely on in the future? Or is it a safer bet to use the <CreatedDateUTC> as mentioned above?
 

Dale Vink  

It's probably best to stay away from the xero_org_muid parameter. This was developed quickly and without much thought. The algorithm that creates was hand-crafted and could well cause collisions across different organisations. We're currently looking to develop a unique organisation identifier that's reliable and re-usable across many Xero applications.

In the meantime, a combination the <ApiKey> and <CreatedDateUTC> is the least worst option.

Dan..
 

Daniel Barratt (Xero Staff)  

Thanks for the mighty quick response!

Ahh okay, I noticed the same GET "org" value on the callback request but will stay away from that too.
A hash of <ApiKey> and <CreatedDateUTC> it is!
 

Dale Vink  

Hi folks, apologies for digging up an old thread, but I was pointed to this by a developer so I thought updating it to point to an article on shortcodes as the best way to uniquely identify an organisation, might be a good idea.
 

Ronan Quirke (Community Manager)