What is an API?

An API is an abstraction that describes an interface for the interaction with a set of functions used by components of a software system. The software providing the functions described by an API is said to be an implementation of the API.

An API can be:

    * general, the full set of an API that is bundled in the libraries of a programming language, e.g. Standard Template Library in C++ or Java API.

    * specific, meant to address a specific problem, e.g. Google Maps API or Java API for XML Web Services.

    * language-dependent, meaning it is only available by using the syntax and elements of a particular language, which makes the API more convenient to use.

    * language-independent, written so that it can be called from several programming languages. This is a desirable feature for a service-oriented API that is not bound to a specific process or system and may be provided as remote procedure calls or web services. For example, a website that allows users to review local restaurants is able to layer their reviews over maps taken from Google Maps, because Google Maps has an API that facilitates this functionality. Google Maps' API controls what information a third-party site can use and how they can use it.

API may be used to refer to a complete interface, a single function, or even a set of APIs provided by an organization. Thus, the scope of meaning is usually determined by the context of usage.
[edit] Advanced explanation

An API may describe the ways in which a particular task is performed. For example, in Unix systems, the math.h include file for the C language contains the definition of the mathematical functions available in the C language library for mathematical processing (usually called libm). This file would describe how to use these functions and the expected result. For example, on a Unix system the command man 3 sqrt will present the signature of the function sqrt in the form: