Let's Develop an application with an analogy.
An Architect (Read Application Developer) wanted to build a House(Read Application), so he prepared for all its aspects including structure, plumbing, wiring, decors etc(Read Different Libraries). He can't do all of the stuff himself so he took help from various experts in those fields, who are really good at doing what they do. But he needed communicate his needs and requirements face to face or via mail (Read Invoking API )so that they can cater to his need and provide the asked service. After some time a fellow Architect came and wanted to accomplish a similar task but with a few add on features like swimming pool (A New Library). He can conveniently use the framework provided by our architect and add new features invoking any new service.
Carefully lets review-
A library is a collection of functions / objects that serves one particular purpose. you could use a library in a variety of projects. (Various specialized services in our case)
An API is an interface for other programs to interact with your program or library without having direct access. ( giving specifications for our need to various vendors in our case)
A framework is a collection of patterns and libraries to help with building an application. ( The master plan laid down by our architect for building a house )
A framework thus can be easily extended to plan a town having various houses, which may be same or similar (having some new feature like swimming pool).
eg- Angular js- a JS framework may use many libraries like iniline editing of text using an exposed API of that library.