API and Web serve as a way of communicating. API stands for Application Programming Interface. The only variation is that a web service enables interaction between two machines over a network. An API acts as an interface between the two different functions so that they may exchange words with each other.
An API is a procedure by which the third-party vendors may write programs that effortlessly intermingle with one another. A web service is created to possess an interface which is represented in a processible machine format usually stipulated in Web Service Description Language.
HTTP is the most useable protocol for communication. Web service also uses SOAP, REST, and XML-RPG as a Means of communication. An API accurately describes the techniques for one software program to interact with the other.