An API is a set of routines, protocols, and tools for building software applications. It is an acronym for Application Program Interface, a software intermediary that helps two separate applications communicate with each other. They define methods of communication between various components. In essence, an API specifies how software components should interact. Moreover, APIs are used for programming graphical user interface (GUI) components.
A good API should make it easy to integrate with an online service, without having to worry about managing the underlying infrastructure and implementation. It also makes it easier to develop a program, by providing all the building elements. A programmer may then put these elements together.