API is an interface that allows you to build on the data and functionality of another application, while a web service is a network-based resource that fulfills a specific task. Yes, there’s overlap between the two: all web services are APIs, but not all APIs are web services
API: It is a collection of ways of interacting with software components. The built-in classes and interfaces that make up Apex are a collection of features that can be considered an API. Salesforce documentation typically does not use the term API when referring to Apex features, except when referring to code API versions.
webservice: It is a service that is accessed over the web.