The full form of API is Application Protocol Interface. It is a kind of mediator which allows to communicate two individual applications.
Suppose you want to build a railway application that provides various train routes. Then for such application you need access to the railway server. This is achieved through API. Railway server provides API to access its server.