For example, one may look at the task of writing "Hello World" on the screen:
APIs are as essential to computers as electrical standards are to the home. One can plug his toaster into the wall whether he is at home or at a neighbour's house, because both houses conform to the standard API for an electrical socket. If there wasn't an API standard, I would have to bring a power station with me to make my toast! Note that there is nothing stopping somebody else coming up with another standard; a UK toaster will not work in the US, just as a program written for Microsoft Windows will not work directly on DOS.
Two general lines of policies exist regarding publishing APIs:
An API which does not require royalties for access and usage is called open. The APIs provided by Free software (such as software distributed under the GNU General Public License), are open by definition, since anyone can look into the source of the software and figure out the API. Although usually authorative implementations exist for an API (such as Microsoft Windows for Windows API), there's nothing that prevents the creation of additional implementations. For example, the Windows API can be provided under Linux using software called [Wine].
It is generally legal to analyze API implementations in order to produce a compatible one. This technique is called reverse engineering for the purposes of compatibility. However, the legal situation is often ambiguous, so that care and legal counsel should be taken before the reverse engineering is carried out. For example, while APIs usually do not have an obvious legal status, they may include patents that may not be used until the patent holder gives his permission.
Examples of APIs are: