Josh Walker an analyst at forrester research describes building an application with no API as "basically like building a house with no doors. The API for all computing purpose is how you open the doors and exchange information".
What is an API and how it works?
The term API is an acronym, and it stands for "APPLICATION PROGRAMMING INTERFACE".
An API is a computing interface which defines interaction between multiple software intermediaries.
This is the technical defination but for better understanding assume API like a restaurant menu.
The menu provides a list of dishes you can order, along with a description of each dish. When you specify what menu items you want, the restaurant kitchen does the work and provides you with some finished dishes. You do not know exactly how the restaurant prepares that food and you don't really need to.
Similarly
When we use an application on phones or web, the application connects to the internet and sends data to a server. The server then retrive that data interprets, it performs the necessary actions and sends us the info we wanted in a readable way - all of this happens via API.
So here is the main question, why we use API?
If you want to build an application which gives you weather updates but for an application like this you have to get the data and update it on regular basis but by using an API of a weather site this process gets automated only you have to access the data from API and show it on your application.