What is the real difference between an API and an microservice?

API = Application Programming Interface

Microservices = an architecture

In short

  • Microservice should expose a well-defined API.
  • Microservice is the way you may want to architect your solution
  • API is what your consumers see.
  • You can expose API without microservices in the backend (in fact, most non-training scenarios don't require microservices).

You may want to read http://samnewman.io/books/building_microservices/ before you decide on using microservices (unless this is for training purposes).


The Microservices approach is about breaking your system ("pile of code") into many small services, each typically has its own:

  • Clear business-related responsibility
  • Running process
  • Database
  • Code version control (e.g. git) repository
  • API (the protocol how other services / clients will contact the Microservice)
  • UI

The services themselves are kept small so as your system grow, there are more services - rather than larger services.

Microservices can use REST, RPC, or any other method to communicate with one another, so REST or an API is really orthogonal to the topic of microservices...

Reference: What is an API? In English, please.