An application programming interface (API) is the set of conventions by which a user application program written for a specific purpose communicates with software infrastructure such as the operating system, data base management services, web services, etc. Non-web-based APIs are specific to programming languages, although there may be multiple APIs to access the same service.
The application service presented may be by a physical computer, or an abstraction such as a Java virtual machine or a .NET common language runtime.
User applications, in this context, could serve either human or computer users. A web browser, word processor, or computer game is an application with a human interface. Alternatively, an electrical power grid manager, a missile guidance system or the control of a cardiac pacemaker is an application that serves a computer.
The term "application layer", in Computer networking reference models, refers to the services that support applications, not the applications themselves. APIs provide access to the top of the application layer.