Whenever I ask people about the difference between an API and a library, I get different opinions. Some give this kind of definition, saying that an API is a spec and a library
I think that Library
is a set of all classes and functions that can be used from our code to do our task easily. But the library can contain some of its private functions for its usage which it does not want to expose.
API
is a part of library which is exposed to the user. So whatever documentation we have regarding a library, we call it an API Documentation
because it contains only those classes and functions to which we have access.