9

Is there a way to programmatically retrieve a list of kindle ebooks that a user has purchased?

I've searched for an answer extensively on SO, however the few related questions I could find are ancient. The Amazon documentation is also not very helpful as from what I can tell the Amazon Associates Program API only lets you do lookups against Amazon's product database, it doesn't let you retrieve information for a signed in user.

apokryfos
  • 38,771
  • 9
  • 70
  • 114
Jason Kulatunga
  • 5,814
  • 1
  • 26
  • 50
  • The topic [Get Kindle Library Book List](https://stackoverflow.com/q/7191429/4156577) has useful information for people who want to download lists of *their own* books, including code snippets or links. I posted working C# code just a few minutes ago. – DarthGizka Sep 16 '20 at 15:16

3 Answers3

6

Yes there is. Due to the bloated and extremely slow management web page for the kindle I invested a few hours into finding a way of creating my own. So far, there is just a library of functions for listing and deleting titles (books and personal docs), but you can make useful stuff on top of it. You can find a Python version here and a JS version here.

This is alpha-quality, reverse-engineered software, that is literally a few minutes old as I write this, but if it scratches your itch ...

Beware: it is not suitable for third parties as you need the email and password of the user. For general, safe, third-party access to that info you would need OAuth support on Amazon's side.

oligofren
  • 20,744
  • 16
  • 93
  • 180
  • There is a new, better API used internally, which supports batch deletes. Might want to have a look at that: https://github.com/fatso83/amazon_fiona_js/blob/master/TODO.md#new-api – oligofren Sep 17 '20 at 09:58
  • Also recommend trying to this: https://gist.github.com/jkubecki/d61d3e953ed5c8379075b5ddd8a95f22 – oligofren Jan 26 '21 at 13:12
3

No. User purchase history is not available externally. Think about this from reverse, would you want Amazon to make available to third-parties everything you may have purchased? I know I wouldn't, and I suspect most customers would not either. Hence, it's unlikely such an API would ever exist.

Your best bet is to find what files are downloaded on the device and somehow infer the titles. Using that route you run into needing to do an ANR (Ambiguous Name Resolution) based on filenames, and if that fails then you'll need to find a way to crack open the files, bypass the DRM encryption, and read metadata.

  • 9
    If Amazon use OAuth2, it can let the user decide whether to authorize a third-party program access his private information or not. There are some useful use cases: I develop a program for myself so I do want to authorize the program to access my information. And if a program promise that it won't share my information to any body else and it is very useful, I may authorize it to my privacy too...etc. I don't know why Amazon don't do this. – Tyler Liu Jan 19 '13 at 13:42
  • 1
    Third parties? No. Myself? Yes, of course! In particular, I would very much like to "archive" the titles I have already read - now that I have 287 books in my Kindle collection, it's little short of unusable without this feature. If I could simply subdivide my set of books into "read", "unread" and "currently reading", it would give a much, much better user experience ... so far, it looks like my best way to achieve that is either by poking around inside the web reader's innards, or by downloading all 287 of them to my Mac and parsing the .apnx files. Of course I'd prefer a proper API! – James Sutherland May 12 '16 at 19:36
1

This isn't anything as good as a web service, but, if you're the user (i.e., you're trying to get a list of the titles you own): If you install Kindle for PC then you can let it sync and then look in %LOCALAPPDATA%\Amazon\Kindle\Cache\KindleSyncMetadataCache.xml. It contains the ASIN and some other fields (title, authors) (doesn't have purchase date). Seems to contain only books, though that could just be because I don't have documents sent to my Kindle for PC.

(And I hope they don't encrypt it in the future...)

davidbak
  • 5,775
  • 3
  • 34
  • 50