An API is a set of functions, intended to save programmers from having to constantly rewrite common routines.
Example: Windows' DirectX is an API that provides functions used in games, such as 3D graphics, sound playback and joystick input.
How it connects an application to the OS depends upon which OS and API you are talking about.
________
DODGE DEMON HISTORY