API (application programming interface) is a set of ready-made classes, procedures, functions, structures and constants provided by the application (library, service) or operating system for use in external software products. Programmers use this when writing all kinds of apps, in order to implement data exchange with external software in the most efficient manner.
API defines the functionality that the program provides.
If the program is treated as a control unit, then the API is a set of "knobs" that are available to the user and which he or she can tweak.
Software components interact with each other through the API. In this case, components usually form a hierarchy - high-level components use APIs of low-level, and those in turn use APIs of lower-levels.
Almost all operating systems (UNIX, Windows, OS X, etc.) have an API, with which programmers can create applications for this operating system. The main API of operating systems is a number of system calls.
In the software industry, common standard APIs for basic functionality have an important role, since they ensure that all programs that use the common API will work equally well, or at least in the usual way. In case of the GUI API, this means that the programs will have a similar user interface, which facilitates the process of mastering new software products.
On the other hand, the differences in the APIs of different operating systems make it very difficult to transfer apps between platforms. However, there are various methods for circumventing this complexity - writing "intermediate" APIs (wxWidgets API API, GTK, etc.), writing libraries that display system calls of one OS to calls of another OS (runtime environments like Wine, cygwin and etc.), the introduction of coding standards in programming languages (for example, the standard C language library), writing of interpreted languages implemented on different platforms (perl, python, php, Java, etc.).