An application Programming interface (API) is a source code which acts as an interface between different software to communicate with each other. It gives the protocol on any kind of communication that happens from and to software from any other software, web or computer software. It is a library of specifications regarding data structures, object classes and variables. Hence it can be compiled when an application is built, unlike application binary interface.
It should not be confused with user interface, which is how a user interacts with the software. API runs behind the user’s visual interface and has the sole function of acting as software-to-software interface. For example, while paying phone bill through online portal, the user enters his phone number and credit card details. The API of the telecommunication company sends the details entered by the user to the credit card bank. There the details are verified and the response is sent back to the telecommunication website, again through its API.
An API has resemblance with SaaS (Software as A Service), since a software can use API to link to some second software to access facilities provided by that second software. This makes the first software to avoid codes for the service provided by the second software. This is why a software company makes its API public, so that other software developers could make their software compatible.