An application programming interface (API) is a set of source code of routines and protocols, developed to be used as a platform by software or website components to share information with each other.
Just like other APIs, magento provides core API which supports SOAP and XML RPC protocols.
The magento core API is based on roles and permissions that allow sharing and managing of customers, categories, products, sales orders, shopping carts and inventory. It provides different methods to work according to our requirement.
To use the magento API first we need to create a role from Admin -> System -> Web Services -> Roles -> Add New Role and need to assign proper resources. If you want to give all permissions then select all resources otherwise select specific resources according to your requirements.
After creating a role we have to create a user from Admin -> System -> Web Services -> Users -> Add New User and need to give user name and API key for authentication and also assign proper role. Here API key is your password for that user.
Now to use the magento core API and its methods we have to connect with it using either SOAP or XML RPC protocol with proper user name and API key as an authentication. For that refer this magento article.
Note: To use the SOAP protocol we have to enable php_soap extension and to use the XML RPC protocol we have to enable php_xmlrpc extension in our php server.
Hope this will help you.