Is it possible to programmatically (or in machine-readable form) get location data from an AirTag

airtaggeolocationprivacy

AirTags seem to be an incredibly useful way of creating a de-facto globally available location tracker, by taking advantage of the sheer number of iOS devices around.

I'd love to be able to obtain an AirTag and get location data from it (or more precisely from the Apple 'Find My' network) programmatically or in machine-readable form, though. Currently as I understand it the location is only available through the 'Find My' tool (digression: see this fascinating recent article illustrating that), which in effect means it's limited to what's plotted on a map. Can I get lat/long co-ordinates from this? Can I programmatically trigger the request for location? This would be a great way to (for example) plot everywhere I travel, by popping one in my bag and having a central server somewhere request my location periodically and log it. Real-time would be ideal, but even a history of locations would be good.

(Note: I wasn't sure if this question was better suited for here or StackOverflow. Happy if the community wants to move it).

Best Answer

Yes, it is possible to do so via a private API - however it is a bit of a "hack" as this is not officially supported by Apple.

You can find an open source implementation of using the private API here:

https://github.com/seemoo-lab/openhaystack/tree/main/OpenHaystack/OpenHaystackMail

Note that in order to use the private API, you'll need a specific entitlement for your app that is not available to third parties. This can be worked around by disabling GateKeeper, installing the program linked above as a plugin for Mail, enabling the plugin in Mail, and then re-enabling GateKeeper.