Defacto2 has a downloadable daily dump of the MySQL 5.7 database.
Instructions on how to use the dump can get found at github.com/Defacto2/database.
Currently, the source code to Defacto2 is not open, but the medium-term goal is to have it publically accessible on GitHub.
Defacto2 has a GitHub page at github.com/defacto2 where you can find notes and wikis for Defacto2 and repositories for historical scene websites. As well the defacto2.net repository where you can submit issues and feature requests for this website.
For clarification there is no Defacto2 API.