Add API errors, and nicer log output for API calls