An API is a messenger that receives a task/request, sends it to the system/tells it what to do, and comes back with a response.
The reason why API’s are important because they make life easier. An example of an API is the twitter feed on the right side on this blog post. The widget sends a request to Twitter’s API for the username that I provided, then it communicates with Twitter’s servers and responds with the twitter feed for that username.
Same this is true for all other social media widgets like Instagram, Facebook, Youtube etc.