An application programming interface (API) is an interface or communication protocol between different parts of a computer program intended to simplify the implementation and maintenance of software.
An API may be for a web-based system, operating system, database system, computer hardware, or software library.
An API specification can take many forms, but often includes specifications for routines, data structures, object classes, variables, or remote calls. POSIX, Windows API, and ASPI are examples of different forms of APIs. Documentation for the API usually is provided to facilitate usage and implementation.
More recently, the term has been often used to refer to a specific kind of interface between a client and a server, which has been described as a “contract” between both – such that if the client makes a request in a specific format, it will always get a response in a specific format or initiate a defined action. This is a specialized form of API though, more precisely defined as a WEB API.
In building applications, an API simplifies programming by abstracting the underlying implementation and only exposing objects or actions the developer needs. While a graphical interface for an email client might provide a user with a button that performs all the steps for fetching and highlighting new emails, an API for file input/output might give the developer a function that copies a file from one location to another without requiring that the developer understand the file system operations occurring behind the scenes.